CL Programming
CL programs and procedures are made up of CL commands. The commands
are compiled into an OPM program or a module that can be bound into programs
made up of modules written in CL or other languages. Advantages of
using CL programs and procedures include:
- Using CL programs and procedures is faster than entering and running the
commands individually.
- CL programs and procedures provide consistent processing of the same set
of commands and logic.
- Some functions require CL commands that cannot be entered individually and
must be part of a CL program or procedure.
- CL programs and procedures can be tested and debugged like other
high-level language (HLL) programs and procedures.
- Parameters can be passed to CL programs and procedures to adapt the
operations performed by the program or procedure to the particular
requirements of that use.
- You can bind CL modules with other ILE* high-level language modules into a
program.
CL programs and procedures can be used for many kinds of
applications. For example, CL procedures can be used to:
- Provide an interface to the user of an interactive application through
which the user can request application functions without an understanding of
the commands used in the program or procedure. This makes the work
station user's job easier and reduces the chances of errors occurring
when commands are entered.
- Control the operation of an application by establishing variables used in
the application (such as date, time, and external indicators) and specifying
the library list used by the application. This ensures that these
operations are performed whenever the application is run.
- Provide predefined routines for the system operator, such as procedures to
start a subsystem, to provide backup copies of files, or to perform other
operating functions. The use of CL programs and procedures reduces the
number of commands the operator uses regularly, and ensures that system
operations are performed consistently.
Most of the CL commands provided by the system can be used in CL programs
and procedures. Some commands are specifically designed for use in CL
programs and procedures and are not available when commands are entered
individually. These commands include:
- Logic control commands that can be used to control which operations are
performed by the program or procedure according to conditions that exist when
the program or procedure is run. For example, if a certain
condition exists, then do certain processing, else do
some other operation. These logic operations provide both conditional
and unconditional branching within the CL program or procedure.
- Data operations that provide a way for the program or procedure to
communicate with a work station user. Data operations let the program
or procedure send formatted data to and receive data from the work station,
and allow limited access to the database.
- Commands that allow the program or procedure to send messages to the
display station user.
- Commands that receive messages sent by other programs and
procedures. These messages can provide normal communication between
programs and procedures, or indicate that errors or other exceptional
conditions exist.
- The use of variables and parameters for passing information between
commands in the program or procedure and between programs and
procedures.
- Calling other procedures (only programs can be called from the command
line or in the batch job stream).
Using CL programs and procedures, applications can be designed with a
separate program or procedure for each function, and with a CL program or
procedure controlling which programs or procedures are run within the
application. The application can consist of both CL and other HLL
programs or procedures. In this type of application, CL programs or
procedures are used to:
- Determine which programs or procedures in the application are to be
run.
- Provide system functions that are not available through other HLL
languages.
- Provide interaction with the application user.
CL programs and procedures provide the flexibility needed to let the
application user select what operations to perform and run the necessary
procedures.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.