Example of Defining Literals

Figure 51. Defining named constants
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
H DATFMT(*ISO)
 * Examples of literals used to initialize fields
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
D.....................................Keywords+++++++++++++++++++++++++++++
D DateField       S               D   INZ(D'1988-09-03')
D NumField        S              5P 1 INZ(5.2)
D CharField       S             10A   INZ('abcdefghij')
D UCS2Field       S              2C   INZ(U'00610062')
 * Even though the date field is defined with a 2-digit year, the
 * initialization value must be defined with a 4-digit year, since
 * all literals must be specified in date format specified
 * on the control specification.
D YmdDate         S               D   INZ(D'2001-01-13')
D                                     DATFMT(*YMD)
 * Examples of literals used to define named constants
D DateConst       C                   CONST(D'1988-09-03')
D NumConst        C                   CONST(5.2)
D CharConst       C                   CONST('abcdefghij')

 * Note that the CONST keyword is not required.
D Upper           C                   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

 * Note that the literal may be continued on the next line
D Lower           C                   'abcdefghijklmn-
D                                     opqrstuvwxyz'

 * Examples of literals used in operations
C                   EVAL      CharField = 'abc'
C                   IF        NumField > 12
C                   EVAL      DateField = D'1995-12-25'
C                   ENDIF


[ Top of Page | Previous Page | Next Page | Contents | Index ]