Supported RPG Features

/SET changes the default type attributes applied to every following declaration that omits the corresponding keyword, until the matching /RESTORE pops the previous default back. Honored in both fixed-format and free-format, and across /COPY//INCLUDE member boundaries (an implicit /RESTORE is applied at each member's end).

Directive Behavior
/SET CCSID(*CHAR:ccsid) Sets the default character CCSID (e.g. *UTF8/1208, or an EBCDIC page) of following no-CCSID character fields - so, for example, CCSID(*CHAR:*UTF8) makes them collate in Unicode.
/SET CCSID(*GRAPH:ccsid) Sets the default code page of following bare GRAPH / VARGRAPH (double-byte graphic) fields.
/SET CCSID(*UCS2:ccsid) Sets the default code page of following bare UCS2 / VARUCS2 fields.
/SET DATFMT(fmt) Sets the default date format of following bare DATE fields.
/SET TIMFMT(fmt) Sets the default time format of following bare TIME fields.
/RESTORE CCSID(*CHAR|*GRAPH|*UCS2) / /RESTORE DATFMT / /RESTORE TIMFMT Restores that one attribute to the value in effect before its most recent /SET. /RESTORE CCSID with no class restores all three CCSID classes. A bare /RESTORE with no keyword is a no-op (as on IBM i).

/SET directives nest, and each /RESTORE names the attribute(s) to restore (they need not match the /SET keywords exactly). An explicit CCSID, DATFMT, or TIMFMT keyword on an individual definition always overrides the active /SET default. The three CCSID classes keep independent stacks, so restoring one leaves the other two in effect.

     /SET CCSID(*CHAR:*UTF8)
DCL-S Name  CHAR(20);          // defaults to CCSID 1208 (Unicode collation)
     /RESTORE CCSID(*CHAR)
DCL-S Code  CHAR(20);          // back to the job-default character CCSID