HELPLIB.HLB  —  FORTRAN  Compatibility Features, Record Structures
  A record is a named data entity, consisting of one or more fields,
  which you can use when you need to declare and operate on
  multi-field data structures in your programs.

  To create a record, you must have 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 illustrate 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 /DATE/ record, part of the record
                            ! APP_list(3) in the array APP_list

  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 may 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, for example:

     rname[.cfname...cfname]

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

     cfname   Is a substructure field name within the record
              identified by record-name.

     afname   Is the name of a typed data item within a structure
              declaration.

3  –  Aggregate Reference

  An aggregate reference resolves into a reference to a structured
  data item (a record structure or substructure).  For example:

  Data Declarations:

     STRUCTURE /STRA/
         INTEGER  INTFLD, INTFLDARY (10)
     END STRUCTURE
       . . .
     STRUCTURE /STRB/
         CHARACTER*20  CHARFLD
         INTEGER  INTFLD, INTFLDARY (10)
         STRUCTURE STRUCFLD
             COMPLEX  CPXFLD, CPXFLDARY (10)
         END STRUCTURE
         RECORD  /STRA/  RECFLD, RECFLDARY (10)
     END STRUCTURE
       . . .
     RECORD  /STRB/  REC, RECARY (10)

  Reference Examples:

     REC --- A record name
     RECARY(1) --- A record array reference
     REC.RECFLD --- A reference to a substructure
     REC.RECFLDARY(1) --- A reference to a substructure array element
     RECARY(1).RECFLD --- A reference to a substructure in a record
       array element
     RECARY(1).RECFLDARY(1) --- A reference to a substructure array
       element in a record array
Close Help