CL programming

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 by which it can be called by other procedures or bound into a program and run. As with other kinds of procedures, you must enter, compile, and bind CL source statements before you can run the program or procedure.

When you enter CL commands individually (from the Command Entry display, for instance, or as individual commands in an input stream), each command is separately processed. When you enter CL commands as source statements for a CL program or procedure, the source remains for later modification if you choose; the commands are compiled into a module if you use the ILE compiler. This module remains as a permanent system object that can be bound into other programs and run. Thus, CL is actually a high-level programming language for system functions. CL program or procedure ensure consistent processing of groups of commands. You can perform functions with a CL program or procedure that you cannot perform by entering commands individually, and the CL program or procedure provides better performance at run time than the processing of several separate commands.

CL programs and procedures can be used in batch or interactive processing. Certain commands or functions are restricted to either batch or interactive jobs. CL source statements consist of CL commands. You cannot use all CL commands as CL source statements, and you can use some of them only in CL procedures or original program model (OPM) programs. CL source statements can be entered in a database source member either interactively from a workstation or in a batch job input stream from a device. 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.

CL programs and procedures can be written for many purposes, including:

These are some of the advantages in using CL programs and procedures for an application:

You cannot use CL programs and procedures for the following purposes: