Free-Form Control Statement
A free-form control statement begins with CTL-OPT followed by zero or more keywords, followed by a semicolon.
Rules for control statements
You can specify zero or more control statements in your source file.
If a control-specification keyword cannot be repeated, it cannot appear more than once in any control statement.
You can mix free-form and fixed-form control statements. Each contiguous group of fixed-form specifications constitutes a single control statement.
When the compilation of a program contains any free-form control statements, the presence of the ACTGRP, BNDDIR, or STGMDL keyword will cause the DFTACTGRP keyword to default to *NO.
The only directives that are allowed within a free-form
control statement
are /IF, /ELSEIF, /ELSE, and /ENDIF.
CTL-OPT
/IF DEFINED(*CRTBNDRPG)
ACTGRP(*CALLER)
/ENDIF
OPTION(*SRCSTMT);
Examples of control statements
- Two free-form control statements, each having several keywords
ctl-opt datfmt(*iso) timfmt(*iso) alwnull(*usrctl); ctl-opt option(*srcstmt)ccsid(*char:*jobrun);
- One control statement with no keywords. The only effect of this statement
is to prevent the RPG compiler from searching
for a control specification data area.
ctl-opt;
- A mixture of free-form and fixed-form control statements.
- A fixed-form statement consisting of three specifications
- A free-form statement beginning with CTL-OPT and ending with a semicolon
- A fixed-form statement consisting of one specification
H OPTION(*SRCSTMT : 1 H *NODEBUGIO) 1 H ACTGRP(*NEW) 1 CTL-OPT ALWNULL(*USRCTL) 2 CCSID(*UCS2 2 :1200) 2 CCSID(*CHAR:*JOBRUN); 2 H DATFMT(*YMD) TIMFMT(*USA) 3