Sign in

docs RPG Reference

Syntax of Keywords

Syntax of Keywords

Keywords may have no parameters, optional parameters, or required parameters. The syntax for keywords is as follows:

    Keyword(parameter1 : parameter2)

where:

  • Parameter(s) are enclosed in parentheses ( ).

    Note: Parentheses should not be specified if there are no parameters.

  • Colons (:) are used to separate multiple parameters.

The following notational conventions are used to show which parameters are optional and which are required:

  • Braces { } indicate optional parameters or optional elements of parameters.
  • An ellipsis (…) indicates that the parameter can be repeated.
  • A colon (:) separates parameters and indicates that more than one may be specified. All parameters separated by a colon are required unless they are enclosed in braces.
  • A vertical bar (|) indicates that only one parameter may be specified for the keyword.
  • A blank separating keyword parameters indicates that one or more of the parameters may be specified.

Note: Braces, ellipses, and vertical bars are not a part of the keyword syntax and should not be entered into your source.

Table 1. Examples of Keyword Notation

NotationExample of Notation UsedDescriptionExample of Source Entered
braces {}PRTCTL (data_struct {:*COMPAT})Parameter data_struct is required and parameter *COMPAT is optional.PRTCTL (data_struct1)
braces {}TIME(format {separator})Parameter format{separator} is required, but the {separator} part of the parameter is optional.TIME(*HMS&)
colon (:)RENAME(Ext_format :Int_format)Parameters Ext_format and Int_format are required.RENAME (nameE: nameI)
ellipsis (…)IGNORE(recformat {:recformat…})Parameter recformat is required and can be specified more than once.IGNORE (recformat1: recformat2: recformat3)
vertical bar ()FLTDIV{(*NO*YES)}
blankOPTIONS(*OMIT *NOPASS *VARSIZE *STRING *TRIM *RIGHTADJ)One of *OMIT, *NOPASS, *VARSIZE, *STRING, *TRIM, or *RIGHTADJ is required and more than one parameter can be optionally specified.OPTIONS(*OMIT : *NOPASS : *VARSIZE : *TRIM : *RIGHTADJ)