Previous Topic: Coding Standards for RPG III ProgramsNext Topic: RPG III Coding Structures and Program Logic


Program Layout

All programs should follow the standard layout. Use continuous lines to break the program up into its logical sections. Three characters are assigned standard meanings:

Structured programming constructs should not cross subsection boundaries; that is, the following should not occur:

Subroutines must be preceded by one or two lines of text to indicate their function. This should follow the BEGSR statement. Use SR in columns seven and eight of the BEGSR and ENDSR statements for greater readability, for example:

Each file must be followed by a comment statement, which states its contents. For logical files, the access path will preferably be indicated. (Text should be the title line for the file). The comment should be after rather than before the statement, as that gives a better effect on compilation listings:

Each input record/data structure should be followed by a comment statement to indicate such things as its function and contents. For example:

Code files in order of frequency of use—input primary or display files should appear first. Place ancillary files last.