Control
Language:
Control language also knows
as CL. CL is a language which is used in AS400 for controlling purpose. It is
basically a well organized language as its basic is commands with different parameter.
Let’s study an example to
study how CL works.
Steps to create a CL
program:
1. WRKMBRPDM
2. Press F6
3. Give the object name
4. Type parameter should have value as CLP.
Press Enter
You will get a blank screen.
We will study a program which
will display User Profile.
1- PGM
2- DCL
VAR(&USER) TYPE(*CHAR) LEN(10)
3- DCL
VAR(&MSG) TYPE(*CHAR) LEN(40)
4- RTVUSRPRF
RTNUSRPRF(&USER)
5- CHGVAR
VAR(&MSG) VALUE(&USER)
6- SNDPGMMSG
MSG(&MSG)
7- ENDPGM
Let’s see what each line
will do in this program’
1st line show
start of the program
2nd and 3rd
line we declare two variable named User and Msg.
4th line shows a
command which is used to retrieve user profile.
5th line moves
value of user profile to msg variable.
6th line sends
the user name to program message which is basically appears upon the bottom.
7th line shows
how to end a CL program.
So If we try to understand
basic structure of any CL Program:
ü Start
ü Declare variables
ü Declare files
ü Use calculation or assignment
ü End program.
Just one more thing here,
whenever we write any program its developer responsibility to add meaning full
comments to programs. So in CL /* */ are
used to do comment.
/* This Program will send
User Profile*/
No comments:
Post a Comment