Basic Introduction to CL Programming

The CL Program or CL Procedures is a collection of CL Commands that are used on the AS400 system to get input, carry out the process and the final results will be obtained. The program or procedure is given a name (CL Program object with type * PGM and CLP attribute) and can be called in the AS400 comman line or can be used in other programs or procedures. Things that must be considered in making CL Program is the Source Program (Source Physical File), compile and bind the source according to the procedure.

If you enter CL Command separately from the Command Entry screen, each command is separately processed. With the CL Program, there is no need to input one by one so that the time needed can be faster. Plus, the CL procedure can be used in batch or interactive processes.

CL Procedure can be written for various purposes, for example:

  • To control the order of processing and call other programs in the procedure.
  • To display a menu and run commands based on the options selected from the menu.
  • Make user work (on workstations) easier and reduce errors.
  • To read a database file.
  • To handle errors issued by commands, programs or procedures by monitoring certain messages (MSGW)
  • To control the operation of an application by creating variables that are used in the application such as data, time or other conditions.
  • For a system operator, this can simplify and reduce errors in writing parameters for things that are regular and consistent, such as save file. raise the subsystem and others.

Benefits of using CL Procedures:

  • Simplify the process of using the CL Command a lot and consistent, because it can be made in one procedure and called it only once (not one by one)
  • CL Procedure is flexible, parameters can be sent to CL pocedure to adjust the operation to be performed.
  • CL Procedure can be tested and debug like other programming languages.
  • There are special functions that can simplify and not be found in commands that are inputted individually.
  • CL Procedures can be associated with other procedures or other programming languages.

We cannot use CL Procedure on:

  • Use printers or ICF files.
  • Using subfiles in display files.
  • Use program-described display files.

Source: IBM-World

Leave a Reply