RPGIV and ILE Specifications in AS400 |
Inroduction to RPGIV
RPG code is written in various specifications available in RPG programming and many of them are position-dependent. We need to write the RPG code in the source program in the specifications available in RPG and each specification is optional.
The compiler differentiates each line of the code based on the specification in which it is written.
RPG Specifications
There are seven types of specifications that can be coded in the RPG program in the order mentioned below.
H specs (Control specifications)
This specification will provide the compiler with the information of compilation options for the program, how that program will run, name of program, date format, data format.
F specs (File Description specifications)
In this specification, we will declare all the files such as PF, LF, DSPF, Subfiles, PRTF which will be used in the program.
D specs (Definitions specifications)
In this specification, we will declare the variables in these specs.
I specs (Input specifications)
In this specification, we can rename some file fields and file record format names. We can define Data structure, named constant.
C pecs (Calculation specifications)
In this specification, we write our code logic. All the calculation logic will come here. All the file operations such as Read, Write, Update, Delete, etc are performed in these specs.
All the API calls, program calls, Subroutine execution, procedure calls, module call, calls to sub-procedures.
O pecs (Output specifications)
In this specification, we will define the layout of the program described printer file.
P pecs (Procedure specifications)
In this specification, we define the boundary of procedures such as Begin and End of procedure blocks. We can define the procedure name and whether it is an Exported procedure or not.
Specifications allowed in Main Source Section
- H specs (Control)
- F specs (File definition)
- D specs (Definition)
- I specs (Input)
- C specs (Cakculation)
- O specs (Output)
Specifications allowed in Subprocedure Section
- P specs (Procedure Begin)
- F specs (File definition)
- D specs (Definition)
- C specs (Cakculation)
- P specs (Procedure End)