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> StatementsExample<strong>The</strong> following is an example of RECORD, STRUCTURE and UNION usage. <strong>The</strong> size of eachelement of the recarr array would be the size of typetag (4 bytes) plus the size of the largest MAP(the employee map at 24 bytes).STRUCTURE /account/INTEGER typetag ! Tag to determine defined mapUNIONMAP ! Structure for an employeeCHARACTER*12 ssn ! Social Security NumberREAL*4 salaryCHARACTER*8 empdate ! Employment dateEND MAPMAP ! Structure for a customerINTEGER*4 acct_custREAL*4 credit_amtCHARACTER*8 due_dateEND MAPMAP ! Structure for a supplierINTEGER*4 acct_suppREAL*4 debit_amtBYTE num_itemsBYTE items(12) ! Items suppliedEND MAPEND UNIONEND STRUCTURERECORD /account/ recarr(1000)3.15. POINTER (Cray)<strong>The</strong> POINTER statement is an extension to FORTRAN 77. It declares a scalar variable to be apointer variable (of type INTEGER), and another variable to be its pointer-based variable.F77 extensionSyntaxPOINTER (p1, v1) [, (p2, v2) ...]v1 and v2are pointer-based variables. A pointer-based variable can be of any type, includingSTRUCTURE. A pointer-based variable can be dimensioned in a separate type, in aDIMENSION statement, or in the POINTER statement. <strong>The</strong> dimension expression may beadjustable, where the rules for adjustable dummy arrays regarding any variables which appearin the dimension declarators apply.p1 and p2are the pointer variables corresponding to v1 and v2. A pointer variable may not be an array.<strong>The</strong> pointer is an integer variable containing the address of a pointer-based variable. <strong>The</strong>storage located by the pointer variable is defined by the pointer-based variable (for example,array, data type, etc.). A reference to a pointer-based variable appears in <strong>Fortran</strong> statements<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 53

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

Saved successfully!

Ooh no, something went wrong!