Compiling CL source program

A CL source program must be compiled before it can be run.

To create a CL program in one step, you can use the Create CL Program (CRTCLPGM) command or the Create Bound Control Language Program (CRTBNDCL) command, which create a bound program with one module.

You can also create a CL module with the Create Control Language Module (CRTCLMOD) command. The module must then be bound into a program or service program using the Create Program (CRTPGM) or Create Service Program (CRTSRVPGM) command.

You can use the Include CL Source (INCLUDE) command to embed another source file during compilation.

The following example creates the module ORD040C and places it in library DSTPRODLB:

CRTCLMOD     MODULE(DSTPRODLB/ORD040C) SRCFILE(QCLSRC)
             TEXT('Order dept general menu program')
 

The source commands for ORD040C are in the source file QCLSRC, and the source member name is ORD040C. By default, a compiler listing is created.

On the Create CL Program (CRTCLPGM) command or the Create Bound Control Language Program (CRTBNDCL) command, you can specify listing options and whether the program should operate under the program owner's user profile.

A program can run using either the owner's user profile or the user's user profile.