The control specification, more commonly referred to as the header specification, is used to control various options and features of the source program. Keywords are used to set default formats, assign names, and establish the currency symbol. Figure 2.1 illustrates the header specification ruler and Table 2.3 defines the layout by column.
Column | Title | Value | Description |
---|---|---|---|
6 | Form type | H | Identifies the statement as a header (control) specification. |
7 | Comment | Blank | Normal Header specification. |
* | Comment. | ||
7 – 80 | Keyword functions | Header keyword | Optional keywords that control module/program settings. See header keywords in Table 2.4. |
Keyword | Parameters | Description | ||
---|---|---|---|---|
ATLSEQ | *NONE *SRC *EXT | Alternate collating sequence. Identifies where the collating sequence is specified. A value of *SRC, or just the keyword, indicates it is specified near the end of the source program with the **ALTSEQ identifier. The *EXT indicates the collating sequence is specified when the program is compiled. If the keyword is not specified, no collating sequence is used. This is the same as specifying ALTSQ(*NONE). | ||
ALWNULL (compiler directive) | *NO *INPUTONLY *USRCTL | Allow Null. This keyword allows the use of database file records that contain fields with the null indicator property. *NO - Null capable fields are not supported. A runtime error is generated if the program reads a database record containing a null. *INPUTONLY - Null capable fields are allowed. They can be read into the program but not written to or updated in the database file. *USRCTL - Full null capable field support is allowed. Null capable fields can be read, modified, and written to the database. | ||
BNDDIR | Binding directory names | Specify the binding directories needed by this source member during the bind phase of the compile process. Binding directory names are OS/400 objects and may be qualified or unqualified. All binding directory names must be enclosed in apostrophes. If more than one binding directory name is required, separate the names with a colon : symbol. | ||
COPYNEST | 1 to 2048 32 | Controls the maximum number of /COPY nests that can occur for this source. | ||
COPYRIGHT | 'Text' | Copyright notice to be stored in the compiled program object. Up to 255 characters can be specified. | ||
CURSYM | 'Symbol' | Any quoted character or symbol can be specified, except the following: * 0 , (comma) . (period) - C R or a blank. | ||
DATEDIT | Format [separator] | This value sets the default format for numeric fields that are edited with the Y edit code, and sets the date format for *DATE and UDATE. Valid entries are: *MDY, *YMD, and *DMY. The separator can be any character. The default separator is the slash (/). Use an & (ampersand) when blanks are needed as the separator. | ||
DATFMT | Format [separator] | Specifies the default format to be used for date fields and literals used in the program. If this keyword is not specified, the *ISO format (ccyy-mm-dd) is used. Any of the following date formats can be specified: | ||
Date Format | Description | Format | ||
*MDY | Month Day Year | mm/dd/yy | ||
*DMY | Day Month Year | dd/mm/yy | ||
*YMD | Year Month Day | yy/mm/dd | ||
*JUL | Julian | yy/ddd | ||
*ISO | ISO standard | ccyy-mm-dd | ||
*USA | USA standard | mm/dd/ccyy | ||
*EUR | Europe standard | dd.mm.ccyy | ||
*JIS | Japan standard | ccyy-mm-dd | ||
The optional separator can be any of the following: / - , . &. The default separator is the / (slash). Use an & (ampersand) when blanks are needed as the separator. Only *MDY, *YMD, *DMY, and *JUL support separators. | ||||
DEBUG | *NO *YES | Controls output of the DUMP operation. | ||
DECEDIT | 'symbol' | Controls the symbol used to edit numeric values in the program. Valid entries are: | ||
*JOBRUN | '.' | Decimal point is the period (.123) | ||
',' | Decimal point is the comma (,123) | |||
'0.' | Decimal point is the period (0.123) | |||
'0,' | Decimal point is the comma (0,123) | |||
If *JOBRUN is specified, the external job attribute DECFMT is used as the DECEDIT control. | ||||
DECPREC | 31 | 30 | Controls the default precision for numeric expressions. Originally, RPG supported 30-digit numeric values. For compatibility with the SQL language, 31 digits are supported. | ||
DFTACTGRP (compiler directive) | *YES *NO | This indicates that the program is to run in the default activation group on the AS/400. When a program runs in the default activation group, it is running in a restricted environment. Advanced RPG features are not supported in the default activation group. *YES - Run in the default activation group. *NO - Run in an ILE activation group. | ||
DFTNAME | program name | The default name for the program. Used to name the program when no name is specified on the CRTBNDRPG or CRTRPGMOD commands. Traditionally, this keyword is not used in RPG programs. | ||
EXPROPTS | *MAXDIGITS *RESDECPOS | Controls the default operation extender for the EVAL and EVALR operations. *MAXDIGITS indicates that the M operation extender is used. *RESDECPOS indicates that the R operation extender is used for EVAL and EVALR operations. Use the individual operation extenders to override a specific EVAL or EVALR operation. | ||
EXTBININT | *NO *YES | Convert externally described data that is in binary format (i.e., the "B" data-type) to the integer data-type. If *NO is specified, or the keyword is not specified, no conversion is performed. If the keyword is specified (optional with *YES), externally described binary fields are converted to integer data-types. This allows the full range of integer values (32768) to be stored in the field. Only externally described fields whose attributes are binary, with zero decimal positions, are converted. | ||
FIXNBR | *NOZONED *ZONED *INPUTPACKED *NOINPUTPACKED | Controls correcting decimal data errors that can occur when a database record is read. *ZONED generates internal code that fixes zoned (signed) decimal fields during an input operation. *INPUTPACKED generates internal code that translates invalid packed decimal data to zero during an input operation. | ||
FLTDIV | *NO *YES | FLTDIV and FLTDIV(*YES) causes mathematical expressions containing divide operations to be performed using floating point division. If FLTDIV(*NO) is specified or the keyword is not specified, divide operations are performed using packed decimal. | ||
FORMSALIGN | *NO *YES | This option causes a message to be sent to the computer operator immediately after the first line of output is printed. There are system functions that perform a similar task and do it much better. | ||
FTRANS | *NONE *SRC | Identifies whether or not file translation will occur. The translation table must be specified near the bottom of the source program with the **FTRANS identifier. | ||
GENLVL | 10 0 to 20 | The GENLVL keyword controls the highest accepted error severity for the source member to compile; generating an object. The default is 10, and is sufficient for most source compiles. In some situations, GENLVL(20) might need to be specified. | ||
INDENT | *NONE Indent-character | When an indent value is specified, the printed compiler listing indents any Calculation specifications containing structured operations codes. This can provide a more readable compiler listing. Any two characters may be specified for the indent character. Traditionally, only one character the vertical bar | is used, for example:
| ||
INTPREC | 10 20 | Intermediate results use integer data-types, 4-byte integers when INTPREC(10) is specified, or 8-byte integers when INTPREC(20) is specified. If, however, an expression contains an 8-byte integer, an 8-byte integer intermediate result is always used. | ||
NOMAIN | Use this keyword in source files that contain only procedures and no mainline RPG calculations. Source files that contain this keyword must be compiled with the CRTRPGMOD command. Source files that contain the NOMAIN keyword cannot be compiled directly into a program object. | |||
OPENOPT | *NOINZOFL *INZOFL | The Open Options keyword indicates whether the overflow indicators should be switched to *OFF when the print file is opened. Use this keyword when a print file is closed and then reopened within the same instances of the program. | ||
OPTION | *NODEBUGIO *SRCSTMT | Use the OPTION keyword to control how the debug code is generated for the compiled source member. Normally RPG generates debug code for all areas of the language. In practice, however, it may be more productive to prevent some of the debug from being generated. OPTION(*NODEBUGIO) causes the debug code to not be generted for FILE input/output operations. OPTION(*SRCSTMT) causes the compiler to generate debug statement numbers that match that of the RPG source. | ||
THREAD | *SERIALIZE | Access to the procedures in the compiled RPG module is serialized. This option is used for a program that runs in a multi-thread environment, such as when it is called by a Java application. | ||
TIMFMT | Format [separator] | Specifies the default format for time field and literals used in the program. If this keyword is not specified, the *ISO format (hh.mm.ss 24-hour clock) is used. | ||
Time Format | Format | Description | ||
*HMS | hh:mm:ss | U.S. Standard | ||
*ISO | hh.mm.ss | ISO standard | ||
*USA | hh:mm AM | PM | U.S.A 12-hour format | ||
*EUR | hh.mm.ss | European standard | ||
*JIS | hh:mm:ss | Japanese standard | ||
The optional separator can be any of the following characters: , . &. The default separator is the : (colon). Use an & (ampersand) when blanks are needed as the separator. Only the *HMS format supports separators. | ||||
TRUNCNBR | *YES *NO | This keyword allows traditional RPG operation codes, such as Z-ADD, MOVE, MULT, and DIV, to generate an error when high-order truncation occurs. Traditionally, this is not generated. This support allows the traditional operation codes to generate errors similar to the EVAL and EVALR operations, which don't support high-order truncation. |
.....H.Functions++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In addition, the parameters needed to compile the RPG IV source can be specified in the header specification. When a compiler parameter is specified, it must use the RPG IV keyword syntax. Specifically, each parameter argument must be separated with a colon. Because compiler options vary from operating system release to release, therefore only compiler keywords that are fundamental to the RPG syntax are illustrated here.