VMS Help
FORTRAN, Data, Records

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  The Compaq Fortran record handling capability enables you to declare
  and operate on multi-field records.  A Compaq Fortran record is a
  named data entity, consisting of one or more fields, that you
  create in your program.  Creating a record requires both a
  structure declaration (to describe the fields in the record) and a
  RECORD statement to establish the record in memory.

  1 - Examples

  Structure APPOINTMENT:

     Structure /APPOINTMENT/
       RECORD /DATE/             APP_DATE
       STRUCTURE /TIME/          APP_TIME (2)
           LOGICAL*1             HOUR, MINUTE
       END STRUCTURE
       CHARACTER*20              APP_MEMO (4)
       LOGICAL*1                 APP_FLAG
     END STRUCTURE

  The following statement results in the creation of both a variable
  named NEXT_APP and a 10-element array named APP_LIST.  Both the
  variable and each element of the array have the form of the
  structure APPOINTMENT.

     RECORD /APPOINTMENT/ NEXT_APP,APP_LIST(10)

  The following examples show aggregate and scalar field references.

  Aggregate:

    NEXT_APP                ! The record NEXT_APP
    NEXT_APP.APP_TIME(1)    ! An array field of the variable
                            ! NEXT_APP
    APP_LIST(3).APP_DATE    ! A 4-byte array field in the record array
                            ! APP_LIST(3)

  Scalar:

    NEXT_APP.APP_FLAG       ! A LOGICAL field of the record
                            ! NEXT_APP

    NEXT_APP.APP_MEMO(1)(1:1)
                            ! The first character of APP_MEMO(1),
                            ! a character*20 field of the record
                            ! NEXT_APP

  2 - Field References

  Fields within a record can be accessed collectively or
  individually.  Record references are either qualified or
  unqualified.

  A qualified reference refers to a typed data item and can be used
  wherever an ordinary variable is allowed.  Type conversion rules
  are the same as for variables.  Its form is:

     rname[.cfname...cfname].afname

  Unqualified references refer to a record structure or substructure
  and can be used (in most cases) like arrays.

     rname[.cfname...cfname]

  rname    The name used in the RECORD statement to
           identify a record.

  cfname   A substructure field name within the record
           identified by record-name.

  afname   The name of a typed data item within a structure
           declaration.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.