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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

[field_declaration]...[field_declaration]END MAPwhere field_declaration is a structure declaration or RECORD statement contained within a uniondeclaration, a union declaration contained within a union declaration, or the declaration of a typeddata field within a union.Data can be initialized in field declaration statements in union declarations. Note, however, it isillegal to initialize multiple map declarations in a single union.Field alignment within multiple map declarations is performed as previously defined in structuredeclarations.The size of the shared area for a union declaration is the size of the largest map defined for thatunion. The size of a map is the sum of the sizes of the field(s) declared within it plus the spacereserved for alignment purposes.Manipulating data using union declarations is similar to what happens using EQUIVALENCEstatements. However, union declarations are probably more similar to union declarations for thelanguage C. The main difference is that the C language requires one to associate a name with each"map" (union). Fortran field names must be unique within the same declaration nesting level ofmaps.The following is an example of RECORD, STRUCTURE, MAP and UNION usage. The size ofeach element of the recarr array would be the size of typetag (4 bytes) plus the size of the largestMAP, the employee map (24 bytes).STRUCTURE /account/INTEGER typetag ! Tag to determine defined map.UNIONMAP! 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_items48 Chapter 2

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

Saved successfully!

Ooh no, something went wrong!