To program using CL, you must understand the procedures and concepts specific to CL programming.
A CL source program is a set of CL source statements that can be compiled into either an original program model (OPM) program or an Integrated Language Environment (ILE) module.
A CL program or CL procedure is a group of CL commands that tells the system where to get input, how to process it, and where to place the results. The program or procedure is assigned a name.
CL is a high-level programming language for system functions.
CL programs and procedures can be used in batch or interactive processing.
CL source statements consist of CL commands.
To create a program using CL source statements, you must enter the source statements into a database source member.
You can then create an Integrated Language Environment (ILE) program by compiling the source member into a module and binding the module into a program object.
Process for creating a CL program or CL procedure
All programs are created in steps: source creation, module creation, and program creation.
1. Source creation. CL source statements consist of CL commands. In most cases, source statements are entered into a database file in the logical sequence determined by your application design.
2. Module creation. Using the Create Control Language Module (CRTCLMOD) command, we create a system object *module. The created CL module can be bound into programs. A CL module contains one CL procedure.
eg.CRTCLMOD MODULE(QGPL/PGMA) SRCFILE(QTAPSRC)
3. Program creation. Using the Create Program (CRTPGM) command, this module (along with other modules and service programs) is used to create a program.
ILE Program: If you want to create a program consisting of only one CL module, you can use the Create Bound CL Program (CRTBNDCL) command, which combines steps 2 and 3.
OPM Object: If you want to create an original program model (OPM) CL program from the CL source statements, you can use the Create CL Program (CRTCLPGM) command.