10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

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.

<strong>Fortran</strong> Statementsrecord_namelistis a list of one or more variable or array names separated by commas.DescriptionYou create memory storage for a record by specifying a structure name in the RECORDstatement. You define the field values in a record either by defining them in the structuredeclaration or by assigning them with executable code.You can access individual fields in a record by combining the parent record name, a period (.),and the 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 the COMMON, SAVE, NAMELIST, DATA and EQUIVALENCE statements.Aggregate references may only appear in aggregate assignment statements, unformatted I/Ostatements, and as parameters to subprograms.Records are allowed in COMMON and DIMENSION statements.ExampleSTRUCTURE /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.RECORD /PERSON/ POPULATION(2), ME...ME.AGE = 34! Assign values for the variable meME.LIVING = .TRUE. ! to some of the fields.ME.FIRST = 'Steve'ME.ID = 542124822...POPULATION(1).LAST = 'Jones' ! Assign the "LAST" field of! element 1 of array population.POPULATION(2) = ME ! Assign all the values of record! "ME" to the record population(2)3.18. REDIMENSION<strong>The</strong> REDIMENSION statement, a PGF77 extension to FORTRAN 77, dynamically defines thebounds of a deferred-shape array. After a REDIMENSION statement, the bounds of the arraybecome those supplied in the statement, until another such statement is encountered.F77 extension<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 56

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

Saved successfully!

Ooh no, something went wrong!