User Tools

Site Tools


pre_set_label_prefix_.htm
Navigation:  Language Reference > 5 - Declaration Attributes > Variable and Entity Attributes >====== PRE (set label prefix) ====== Previous pageReturn to chapter overviewNext page

PRE( [ prefix ] )

blk2blue.jpg

PRE Provides a label prefix for complex data structures.
prefix Acceptable characters are alphabet letters, numerals 0 through 9, and the underscore character. A prefix must start with an alpha character or underscore. By convention, a prefix is 1-3 characters, although it can be longer.

The PRE attribute provides a label prefix for a FILE, QUEUE, GROUP, REPORT, or ITEMIZE structure. PRE is also valid on a LIKE declaration to provide a separate prefix when LIKE is used to declare another copy of a complex data structure.

PRE is used to distinguish between identical variable names that occur in different structures. When a data element from a complex data structure is referenced in executable statements, assignments, and parameter lists, the prefix is attached to its label by a colon (Pre:Label).

PRE is essentially a legacy attribute which is being replaced by a more flexible method to distinguish between identical variable names that occur in different structures: Field Qualification syntax. When referenced in executable statements, assignments, and parameter lists, the label of the structure containing the field is attached to the field label by a period (GroupName.Label).

NewCNet.jpg

The use of PRE with TYPE in a FILE structure is not supported.

Example:

MasterFile FILE,DRIVER('Clarion'),PRE(Mst)     !Declare master file layout

Record      RECORD

AcctNumber   LONG   !Referenced as Mst:AcctNumber or MasterFile.AcctNumber

           END

          END

Detail      FILE,DRIVER('Clarion'),PRE(Dtl)     !Declare detail file layout

Record       RECORD

AcctNumber    LONG  !Referenced as Dtl:AcctNumber or Detail.AcctNumber

            END

           END

SaveQueue  QUEUE,PRE(Sav)

AcctNumber  LONG    !Referenced as Sav:AcctNumber or SaveQueue.AcctNumber

          END

G1     GROUP,PRE(Mem)                !Declare some memory variables

Message STRING(30)                   !with the Mem prefix

      END

G2     LIKE(G1),PRE(Me2)             !Another GROUP LIKE the first containing same

CODE                                !variables using the “Me2” prefix

IF Dtl:AcctNumber <;> Mst:AcctNumber !Is it a new account

 Mem:Message = 'New Account'        !display message

 Me2:Message = 'Variable in LIKE group'

END

IF Detail.AcctNumber <;> Masterfile.AcctNumber    !Same expression

 G1.Message = 'New Account'         ! display message

 G2.Message = 'Same Variable in LIKE group'

END

See Also:

Reserved Words

Field Qualification

pre_set_label_prefix_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1