12.07.2015 Views

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.8.1 RecordsA record, a DEC extension to FORTRAN 77, is a user-defined aggregate data item having thefollowing form:RECORD /structure_name/record_namelist[,/structure_name/record_namelist]...[,/structure_name/record_namelist]where:structure_namerecord_namelistis the name of a previously declared structure.is a list of one or more variable or array names separated by commas.You create memory storage for a record by specifying a structure name in the RECORD statement.You define the field values in a record either by defining them in the structure declaration or byassigning them with executable code.You can access individual fields in a record by combining the parent record name, a period (.), andthe field name (for example, recordname.fieldname). For records, a scalar reference means areference to a name that resolves to a single typed data item (for example, INTEGER), while anaggregate reference means a reference that resolves to a structured data item.Scalar field references may appear wherever normal variable or array elements may appear withthe exception of COMMON, SAVE, NAMELIST, DATA and EQUIVALENCE statements.Aggregate references may only appear in aggregate assignment statements, unformatted I/Ostatements, and as parameters to subprograms.The following is an example of RECORD and STRUCTURE usage.STRUCTURE /person/ ! Declare a structure defining a personINTEGER idLOGICAL livingCHARACTER*5 first, last, middleINTEGER ageEND STRUCTURE! Define population to be an array where each element is! of type person. Also define a variable, me, of type! person.46 Chapter 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!