Supported RPG Features

External indicators *INU1 through *INU8 correspond to the eight job switches (the SWS parameter on CHGJOB / SBMJOB). They can be read, set, and used as conditioning indicators in both free- and fixed-format:

// Free-format
*INU1 = *ON;
IF *INU1;
  DSPLY 'Switch 1 is on';
ENDIF;

// Fixed-format: U1 in conditioning columns (9-11), SETON/SETOFF
C                   SETON                                        U1
C   U1    'ON'      DSPLY
C                   SETOFF                                       U1

EXTIND - Conditioning a File on an External Indicator

The EXTIND(*INUn) keyword on a file declaration conditions whether the file is opened at program initialization. When the named external indicator is ON, the file is opened normally; when it is OFF, the file is not opened (equivalent to USROPN with no subsequent OPEN - any I/O against it raises status 1211).

// Free-format: open CUSTMAST only when *INU1 is ON
DCL-F CUSTMAST DISK(*EXT) USAGE(*INPUT) EXTIND(*INU1);

// Fixed-format:
FCUSTMAST  IF   E           K DISK                    EXTIND(*INU1)

The external indicator is sampled once at program initialization; a later change to the indicator does not re-open or close the file.

External indicators are program-scoped and are not synchronized with any external job state or job switch settings at program-cycle boundaries.