What CL Is
AS400/ i-Series Control Language (CL) is a set of commands that use to control operations and to request system related function on the IBM AS400 computer.
IBM provides CL as an integrated part of the OS/400 operating system, not as separate product.
CL commands can be used at least two ways:
1. by typing them individually onto an AS/400 command line, or
2. by grouping them together into a CL program
CL programs typically consist of multiple CL commands that define procedures or operations on the AS/400. By combining multiple commands within a CL program, you can automate most AS/400 operation.
What CL Is Not
- CL is not high level language(HLL)
- CL is not use to create business application(example perform add or update records in a database file/table)
- CL have limited printing capabilities
- CL does not support the use of sub files within the application displays
- CL does not support individual fields in program describe files/table
Manipulations using CL, are limited to reading files and only a single file can be opened for I/O(Input/Output) operations. This make CL unsuitable for developing a complete business application.
Controlling Workflow with CL
CL programs control the workflow of an application by allowing you to create job-streams, which consist of CL commands to be executed in order.
Within a CL program you can:
- alter the order of execution by testing various conditions that may exist during the execution of a job.
- have statement/command to monitor for errors that might occur while running a job and perform corrective actons or abort the job
- incorporate conditional logic and
- special functions that are not avaliable when you enter individual commands on the command line.
CL program can :
- pass values to and from CL programs
- pass parameters to and from CL programs
to make them more flexible and to permit or restrict the execution of blocks of program code. You can test and debug CL program just like HLL program.
CL programs, unlike JCL(Job Control Language), are implemented as compiled program objects, rather than interpreted job streams. A CL program is a permanent object created by compiling a group of CL commands.
CL Execution Environment and Restrictions
CL command may be entered into the system interactively on command line or in a CL program. Individual CL commands and complied CL programs can be submitted for batch processing using the SBMJOB(Submit Job) command. Command can be included with a language procedure.
Another command SBMDBJOB(Submit Database Job) can be use for submitting for interpretation or compiled into a program object for batch processing.
Example of command that used interactively. STRSEU(Start Source Entry Utility).
Example of command that used within in batch process. CRTCLPGM(Complile a CL Program)
Example of commands that are valid within a CL program. GOTO and ENDPGM.
CL programs, unlike JCL(Job Control Language), are implemented as compiled program objects, rather than interpreted job streams. A CL program is a permanent object created by compiling a group of CL commands.
CL Execution Environment and Restrictions
CL command may be entered into the system interactively on command line or in a CL program. Individual CL commands and complied CL programs can be submitted for batch processing using the SBMJOB(Submit Job) command. Command can be included with a language procedure.
Another command SBMDBJOB(Submit Database Job) can be use for submitting for interpretation or compiled into a program object for batch processing.
Example of command that used interactively. STRSEU(Start Source Entry Utility).
Example of command that used within in batch process. CRTCLPGM(Complile a CL Program)
Example of commands that are valid within a CL program. GOTO and ENDPGM.
Example of a CL Program and is it output
Source member:
Output: