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.

DescriptionYou 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 meansa reference 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 me toME.LIVING = .TRUE. ! 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)RECURSIVE 90The RECURSIVE statement indicates whether a function or subroutine may call itself recursively.128 Chapter 3

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

Saved successfully!

Ooh no, something went wrong!