Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


CL programs and Procedures

CL programs and Procedures
CL programs and Procedures, CL proceudre, CL program, CL module, service program, CRTSRVPGM, CRTPGM, CRTCLPGM, CRTBNDCL, CALLPRC,CRTCLMOD, PGM, ENDPGM, CL, CL basics, CL introduction, CLLE, CLP, Control language, Advantages of CL programs and procedures.
CL programs and Procedures

CL programs and Procedures

We can write CL commands as a source statement in a CLP or CLLE source member and can create a CL program or CL procedure out of it.

A CL program is the set of CL source statements that are then compiled either to OPM program (original program model) or ILE module (Integrated Language Environment) that can be bound into programs made up of modules written in CL programs or other languages.

Advantages of CL programs and procedures

  • CL programs and procedures are faster than using individual CL commands.
  • Some functions require several CL commands to execute rather than a single CL command to perform specific system functions.
  • CL programs and procedures can be tested and debugged like any other High-level language.
  • CL programs and procedures can accept parameters that make CL commands to be performed for the particular requirement.
  • CL modules can be bound with any other ILE high-level modules into a program.
  • Some commands are designed so that they can only be called from CL programs or procedures such as RTV* (any Retrieve command), command that calls procedures, logic control commands, etc.
  • Types of CL programs and procedures

    There are four types of CL programs and procedures namely

    1. Procedure
    2. Module
    3. Program
    4. Service program

    CL procedure

    A CL procedure is a set of self-contained HLL statements that performs a particular function and returns to the caller. It begins with PGM and ends with ENDPGM.

    CL module

    A CL module is the object that gets created when HLL statements get compiled using an ILE compiler. A CL module is created using the CL command CRTCLMOD (Create CL Module). A module must be bound into a program to run.

    A CL module consists of two parts User-written procedure and the program entry procedure generated by the CL compiler. In HLL like RPG, a single module can contain multiple procedures.

    CL program

    A CL program is created from the CL commands source statements.

    The OS supports two types of programs.

    1. ILE program
    2. OPM CL program

    ILE programs

    An ILE program is an IBM i object that consists of one or more modules. Modules cannot be run until they are bound into the programs. The programs must have an entry procedure. A CL compiler generates an entry procedure in each module it creates.

  • A single module ILE program can be created using the command CRTBNDCL (Create Bound CL program).
  • CRTPGM (Create Program) command can be used to create an ILE program that may contain module objects generated by different ILE compilers including ILE CL.
  • OPM CL programs

    An OPM CL program is created using the CL command CRTCLPGM (Create CL program).

    Service program

    A service program is an IBM i object that contains one or more modules. We can run programs that are not bound to service programs and do not call any service program procedure. However, we cannot run any service program procedure unless that service program is bound to a program.

    In order to call procedures in a service program, We must first export the procedure name. A service program can be created using the CL command CRTSRVPGM (Create Service Program).

    A program has only one entry point. However, a service program can have multiple entry points. We cannot call the service program directly. We can call procedures in a service program in another program or the service program.

    Related Post

    Post a Comment

    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain