This section describes the enhancements made to ILE RPG after 7.1.
CTL-OPT OPTION(*SRCSTMT : *NODEBUGIO)
ALWNULL(*USRCTL);
DCL-F custFile usage(*update) extfile(custFilename);
DCL-F screen workstn;
DCL-F qprint printer(132) oflind(qprintOflow);
DCL-C MAX_ELEMS 1000;
DCL-S fullName VARCHAR(50)
INZ('Unknown name');
DCL-DS ds1 QUALIFIED;
num INT(10);
address UCS2(100);
END-DS;
DCL-PR Qp0lRenameUnlink INT(10) EXTPROC(*DCLCASE);
oldName POINTER VALUE OPTIONS(*STRING);
newName POINTER VALUE OPTIONS(*STRING);
END-PR;
The following example shows a free-form subprocedure definition.
DCL-PROC getCurrentUserName EXPORT;
DCL-PI *n CHAR(10) END-PI;
DCL-S curUser CHAR(10) INZ(*USER);
RETURN curUser;
END-PROC;
IF endDate < beginDate;
C GOTO internalError
ENDIF;
duration = %DIFF(endDate : beginDate : *days);
. . .
C internalError TAG
Use Control-specification keyword VALIDATE(*NODATETIME) to allow the RPG compiler to treat date, time, and timestamp data as character data, without performing the checks for validity.
This may improve the performance of some date, time, and timestamp operations.

| Element | Description |
|---|---|
| CCSID keyword |
|
| DFTACTGRP keyword | DFTACTGRP(*NO) is assumed if there are any free-form Control specifications, and if at least one of the ACTGRP, BNDDIR, or STGMDL keyword is used. |
| OPENOPT keyword | OPENOPT(*{NO}CVT) controls the default for
the DATA keyword for database files.
|


| Element | Description |
|---|---|
| /FREE and /END-FREE directives | These directives are no longer necessary to indicate the beginning and ending of free-form code. They are ignored by the compiler. |


| Element | Description |
|---|---|
| CCSID keyword |
|
| DTAARA keyword | In a free-form definition:
|
| EXTFLD keyword | In a free-form subfield definition
|
| EXTNAME keyword | In a free-form data structure definition
|
| EXPORT and IMPORT keywords | In a free-form definition
|
| EXTPROC keyword | In a free-form prototype definition or a procedure-interface
definition
|
| LIKE keyword | In a free-form definition, the LIKE keyword has an optional second parameter specifying the length adjustment. |
| LEN keyword | In a free-form definition, the LEN keyword is allowed only for a data structure definition. For other free-form definitions, the length is specified as part of the data-type keyword. |
| CLASS, DATFMT, PROCPTR, TIMFMT, and VARYING keywords | These keywords are not used in a free-form definition. The information specified by these keywords is specified as part of the related data-type keywords. |
| FROMFILE, PACKEVEN, and TOFILE keywords | These keywords are not allowed in a free-form definition. |
| OVERLAY keyword | The parameter cannot be the name of the data structure for a free-form subfield definition. The POS keyword is used instead. |


| Element | Description |
|---|---|
| Timestamp literals | Timestamp literals can have between 0 and 12 fractional seconds. |


| Element | Description |
|---|---|
| File and Definition statements | File and Definition statements can be intermixed. |


| Element | Description |
|---|---|
| %CHAR | When the operand is a timestamp, the length of the returned value depends on the number of bytes in the timestamp. If the format is *ISO0, the number of bytes can be between 14 and 26. If the format is *ISO, the number of bytes can be 19, or between 21 and 32. |
| %DEC | When the operand is a timestamp, the number of digits can be between 14 and 26, depending on the number of fractional seconds in the timestamp. |
| %DIFF | When the operand is a timestamp, an optional fourth parameter specifies the number of fractional seconds to return. |
| %SECONDS | When %SECONDS is used to add seconds to a timestamp, the parameter can have decimal positions specifying the number of fractional seconds. |
| %SUBDT |
|
| %TIMESTAMP |
|


| Element | Description |
|---|---|
| Length entry | The length entry for a timestamp can be 19, or a value between 21 and 32. |
| Decimal-positions entry | The decimal-positions entry for a timestamp can be a value between 0 and 12. |


| Element | Description |
|---|---|
| /SET directive | Temporarily set a new value for the following
Control statement keywords:
These values are used to supply a default value for definition statements when the value is not explicitly provided on the definition. |
| /RESTORE directive | Restore the previous setting to the value it
had before the most recent /SET directive that set the value. These values are used to supply a default value for definition statements when the value is not explicitly provided on the definition. |


| Element | Description |
|---|---|
| CTL-OPT | Begins a free-form Control statement |
| DCL-F | Begins a free-form File definition |
| DCL-C | Begins a free-form Named Constant definition |
| DCL-DS | Begins a free-form Data Structure definition |
| DCL-SUBF | Begins a free-form Subfield definition. Specifying "DCL-SUBF" is optional unless the subfield name is the same as an operation code allowed in free-form calculations. |
| END-DS | Ends a free-form Data Structure definition. If there are no subfields, it can be specified after the last keyword of the DCL-DS statement. |
| DCL-PI | Begins a free-form Procedure Interface definition |
| DCL-PR | Begins a free-form Prototype definition |
| DCL-PARM | Begins a free-form Parameter definition. Specifying "DCL-PARM" is optional unless the parameter name is the same as an operation code allowed in free-form calculations . |
| END-PI | Ends a free-form Procedure Interface definition. If there are no parameters, it can be specified after the last keyword of the DCL-PI statement. |
| END-PR | Ends a free-form Prototype definition. If there are no parameters, it can be specified after the last keyword of the DCL-PR statement. |
| DCL-S | Begins a free-form Standalone Field definition |
| DCL-PROC | Begins a free-form Procedure definition |
| END-PROC | Ends a free-form Procedure definition |


| Element | Description |
|---|---|
| DATA{*{NO}CVT) | Controls whether a file is opened so that database performs CCSID conversion to and from the job CCSID for alphanumeric and graphic fields. |
| HANDLER(handler {:communication-area}) | Specifies that the file is an Open Access file. |
| DISK{(*EXT | record-length)} | Device keywords to specify the
device type of a free-form File definition.
|
| PRINTER{(*EXT | record-length)} | |
| SEQ{(*EXT | record-length)} | |
| SPECIAL{(*EXT | record-length)} | |
| WORKSTN{(*EXT | record-length)} | |
| USAGE(*INPUT *OUTPUT *UPDATE *DELETE) | Specifies the usage of the file in a free-form file definition. |
| KEYED{(*CHAR : key-length)} | Indicates that the file is keyed in a free-form file definition. |


| Element | Description |
|---|---|
| CHAR(length) | Fixed-length alphanumeric data type |
| VARCHAR(length {:prefix-size}) | Varying-length alphanumeric data type |
| GRAPH(length) | Fixed-length Graphic data type |
| VARGRAPH(length {:prefix-size}) | Varying-length Graphic data type |
| UCS2(length) | Fixed-length UCS-2 data type |
| VARUCS2(length {:prefix-size}) | Varying-length UCS-2 data type |
| IND | Indicator data type |
| INT(digits) | Integer data type |
| UNS(digits) | Unsigned integer data type |
| PACKED(digits {:decimals}) | Packed decimal data type |
| ZONED(digits {:decimals}) | Zoned decimal data type |
| BINDEC(digits {:decimals}) | Binary decimal data type |
| FLOAT(size) | Float data type |
| DATE{(format)} | Date data type |
| TIME{(format)} | Time data type |
| TIMESTAMP{(fractional-seconds)} | Timestamp data type |
| POINTER{(*PROC)} | Pointer data type. The optional parameter *PROC indicates that it is a procedure pointer. |
| OBJECT{(*JAVA : class-name)} | Object data type. The parameters are optional if it is defining the return type of a Java constructor. |


| Element | Description |
|---|---|
| EXT | Indicates that a data structure is externally described. This keyword is optional if the EXTNAME keyword is specified as the first keyword for a data structure definition. |
| POS(subfield-start-position) | Specifies the starting position of a subfield in the data structure. |
| PSDS | Specifies that the data structure is a Program Status Data Structure. |
