CL400 Interview Questions
1. What are the
disadvantages in CL? (Or) What is the difference between RPG and CL?
a. You
can’t perform Insert, Update and Delete operation in CL.
b. You
can’t use printer files in CL.
c. You
can’t use sub files in CL except Message Subfile
d. You
can use only one file in CL.
2. How do you read a specific
record in a keyed database file in a CL program?
OVRDRF FILE
(filename) POSITION (*KEYx a b c) and RCVF
3. What CL command is used to
read a file?
RCVF - Receive
File
4. How can you read
a file in CL?
Thro’ RCVF command we can read a file. To read all the records we should
use MONMSG command with MSGID (CPF0864). So if the end of file
reached then the message CPF0864 is
sent to the program so the variable will not be changed by the RCVF command.
5. How can you read
a file in CL?
Thro’ RCVF command we can read a file. To read all the records we should
use RCVF followed by MONMSG command
with MSGID (CPF0864) and followed by
GOTO with command label to branch and prier to RCVF command. So if the end of
file reached then the message CPF0864
is sent to the program so the variable will not be changed by the RCVF command otherwise.
6. How can you set
lower limit to a file in CL?
By
two way we can set.
i.
POSDBF with parameter
“File Position” set to “*Start”.
ii.
OVERDBF which allows to position the file by Key Value,
by RRN value, or set to *START
7. What CL command is equivalent
to write a display file in RPG?
SNDF - Send File
8. What CL command is equivalent
to write/read a display file in RPG?
SNDRCVF -
Send/Receive File
9. What CL command is used to
determine the logical files associated with a particular physical file?
DSPDBR - Display
Database Relations
10. If the field is defined in
DDS, how is it referenced in a CL program?
By declaring the
field (DCL) and placing an ampersand in front of the variable name.
11. What are the
data types available in CL?
*CHAR,
*DEC, *LGL
12. What is the main use of
MONMSG?
Error trapping.
13. What MONMSG in
CL?
This command monitors the
messages send to the program message queue for the conditions specified in the
command. There are two levels of MONMSG commands.
Program level is specified
immediately following the last declares command in your CL program. You can use
as many as 100 program level MONMSG commands.
Command level immediately follows a
CL command. You can use as many as 100 command level MONMSG commands for a
single command.
If you monitor a message by
giving message ID as CPF0000 then any error will come to MONMSG routine
14. How can a programmer send a
message from a CL program?
Using the
SNDPGMMSG command - Send Program Message
15. What are the
various messages in CL?
A message is a communication
sends from one user or program to another. There are two types of messages
available. One is Immediate messages,
which are created by the program or system user when they are sent and not
permanently stored in the system. Another type is Predefined messages, which is created
before they are used. These messages are placed in a message file when they are
created, and retrieved from the file when they are used. The CRTMSGF command is
used to create a Predefined message.
The ADDMSGD, DSPMSGD, RMVMSGD commands are used to add a message description,
display message description and remove message description respectively.
CHGMSGD or WRKMSGD is used to change the description.
Predefined message in CL SNDUSRMSG, SNDPGMMSG, RTVMSG
Predefined message in display files ERRMSGID, SFLMSGID, MSGCON and MSGID
Immediate message in CL SNDUSRMSG,
SNDPGMMSG, SNDMSG, SNDBRKMSG
Immediate message in display files ERRMSG,
SFLMSG
16. What is the purpose of the
CHGVAR command?
To change the
value associated with a CL variable
17. How do you access the local
data area in a CL program?
RTVDTAARA DTAARA
(*LDA) RTNVAR (&var)
18. What are the various steps involve accessing
Data Area in CL?
First we get the
data from the data area by using the command RTVDTAARA. If you want edit the
data of the data area use CHGDTAARA command else if you want view the data of
the data area use DSPDTAARA command
19. What is a command label?
An area of
transfer within a CL program from which to continue processing directed by a
GOTO command.
20. Explain parameter passing.
To pass
variables from a CL or RPG program to another CL or RPG program.
21. How can a programmer exit
out of a CL program?
By using a
RETURN command.
22. Why would the PGM line contain a PARM?
The CL program
is using a value passed from another processing program.
23. How to create user-defined command?
First of all create a CL program
with a command and compile it. After create a CMD type program. Then by using
CRTCMD command define user-defined command.
E.g.
CLP 01
PGM
DSPLIBL
ENDPGM
CMD01
CMD
CRTCMD
CLP name ---------------------- : CLP01
Library
---------------------- :
SKANDASAMS
CMD named ------------------- : CMD01
Library ---------------------- : SKANDASAMS
User-defined command ------ : A
Now if you type A and press enter
key, system will display library list.
24. How to retrieve
a Date in CL?
By using RTVSYSVAL command we ca
retrieve a date in CL. The various date formats are *JOB, *SYSVAL, *MDY, *DMY,
*YMD, *JUL etc. [if you want system time, you have to specify *time in the
format]
25. What are the
different date types?
v *ISO – YYYY-MM-DD
v *USA –
MM/DD/YYYY
v *EUR
– DD.MM.YYYY
v *JUL
– YY/DDD
v *JOB
v *SYSVAL
v *MDY
v *DMY
v *YMD
v *JUL
*ISO is the default date type.
Format of system value is MM/DD/YY
26. How can you
check the date in CL?
By the command CVTDAT.
27. What is the max
length of variable in CL?
11
28. What are the
advantages of CL?
§ Because
commands are compiled and stored in a form, they can be run immediately and it
is faster than entering the commands in command line.
§ Some
CL commands cannot be executed in command line, so we need CL program for them.
Eg. RTVSYSVAL, RTVDTAARA
§ Cl
program can be tested and debugged like other HLL program.
29. How to find the
field description of an object?
DSPFFD,
DSPOBJD
DCL (Declare CL Variable) Command Description
ReplyDeleteType Maximum Length Default Length1
Decimal 15 digits, 9 decimal positions 15 digits, 5 decimal positions
Character 9999 characters2 32 characters
Logical 1 character 1 character
Please vist www.as400interviewquestions.com
ReplyDelete