Example: Simple CL program

This example is a CL program that calls several programs.

A CL program or procedure can be as simple or as complex as you want. To consolidate several activities normally done by the system operator at the beginning of the day (to call programs A, B, and C, for example), you can create a CL procedure called STARTUP with the following code:

PGM  /*  STARTUP  */
CALL PGM(A)
CALL PGM(B)
CALL PGM(C)
ENDPGM

In this example, the Programmer Menu is used to create the program. You can also use the Programming Development Manager (PDM) or Remote System Explorer (RSE), which are functions of the WebSphere® Development Studio for System i® licensed program.

To enter, create, and use this program or procedure, follow these steps.

How to enter, create, and use a CL program

To enter CL source, follow these steps:

  1. Select option 8 (Edit source) on the Programmer Menu and specify STARTUP in the Parm field. (This option creates a source member named STARTUP that will also be the name of the program.)
  2. Specify CLLE in the Type field and press the Enter key.
  3. On the SEU display, use the I (insert) line command to enter the CL commands (CALL is a CL command).
 Columns........:   1  71              Edit                         QGPL/QCLSRC
 Find......: _____________________________________________              STARTUP
 FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
       ************** Beginning of data ***********************************
.......
.......
.......
.......
.......
.......

When you have finished entering the source statements, complete these steps:

  1. Press F3 to exit from SEU.
  2. Accept the default on the exit display (option 2, Exit and update member) and press the Enter key to return to the Programmer Menu.
  3. Select option 3 (Create object) to create a program from the source statements you entered. You do not have to change any other information on the display.
Note: The referenced programs (A, B, and C) do not have to exist when the program STARTUP is created.

When the program is created, you can call it from the Programmer Menu by selecting option 4 (Call program) and specifying STARTUP in the Parm field. If you want to run this example program, however, the referenced programs must exist by the time the CALL commands are run.