4、CL programming (二)

一、Passing parameter in CL

Ü   PASSING THE PARAMETER IN CL

4、CL programming (二)

PGM(CTO04R00)

4、CL programming (二)


二、QCMDEXC API

Ü  QCMDEXC

 

·        This is an API to execute command from HLL.

·        We can change the command at run time.

·        The commands that are only used in CL programare not permissible here.

·        Below is the process on how to use this API.

D CMD             S              1    DIM(75) CTDATA PERRCD(75)
D CMDLEN          S             15 5
C                   EVAL      CMDLEN = %LEN(%TRIM(CMD))
C* Execute Command  using QCMDEXC
C                   CALL      'QCMDEXC'
C                   PARM                    CMD
C                   PARM                    CMDLEN

 Example

4、CL programming (二)


OUTPUT

 Dataqueue DTAQ000 is deleted from IROBO1.


三、Example-SNDF,RCVF,SNDRCVF

Ü   To read from the database file and then writeit on the screen.

4、CL programming (二)

Below is the display file that hasbeen used in the program:

4、CL programming (二)

***NOTE:  We can use SNDRCVFinstead of SNDF and RCVF.

          SNDRCVF is used onlyfor display file.

 OUTPUT

4、CL programming (二)

We press ENTER to get the screen below:

4、CL programming (二)


四、Example RCVF

ÜCL program toread a database file and display its field’s value on the console & promptevery time before reading a new record from the file

 Ø  Physical file used in theprogram = CUST

4、CL programming (二)

Ø  CL Program

4、CL programming (二)

OUTPUT

 Below is the output that we get on the console.

4、CL programming (二)