Previous Topic: Coding Standards for CL Programs

Next Topic: Coding Standards for RPG III Programs

Field Names in CL Programs

Variable names should be meaningful. Variables used in commands should be named after the relevant keyword with ‘&’ appended to the beginning; for example SRCFILE(&SRCFILE). Use OS/400 standard abbreviations where possible.

For more information, refer to the OS/400 Programmer’s Guide.

Parameters passed between programs should, where possible, have the same name in the calling and the called programs.

Calling program CL:

Called program CL:

Parameters passed to command processing programs should, where possible, have the same name as the parameter keyword—as specified by the PARM statements in the command source.

Command source:

Called program CL:

Use three-character mnemonics to build CL program labels; for example, ‘ENDPGM:’, ‘SNDERR:’.

Where a parameter is a data structure passed from a command, for example, a qualified name, use a short name for the parameter and give the sub fields full names.

Command source:

Called program CL: