Grab the Opportunity


 CL  400 INTERVIEW QUESTIONS & ANSWERS

CL/400 – Control Language


Q             How will you declare a variable in CL program?
A             with the help of command DCL

Q             What are the differences between CLP and CLLE?
A             CLP is OPM (Original Program Model) while CLLE is ILE
                In CLP creation of program is one step while in CLLE it is two step. (We have to create a module and then bind it with program.)
                In CLLE Activation Group concept is available.

Q             How many files can be declared in CLP program?
A             Only One file can be declared in CLP /CLLE program.

Q             How to define a file in CL program and how to read from and write to a file?
A             To declare a file DCLF command is used
                RCVF is used to read from a file
                SNDRCVF is used to write and read from the display file only.

Q             How to read / write data to a database file or printer file ?
A            
                                                CL/CLLE                              RPG/RPGLE                         DISPLAY FILE
                READ                    RCVF                                     READ/CHAIN                     READ / RCVF
                WRITE                                                                  WRITE                                  WRITE / SNDF
                                                                                                                                                EXFMT (Read and Write)

Q             What is the use of overriding using files, PRTF, DSPF ?
A             You can use the Override with Database File (OVRDBF) / Printer file (OVRPRTF) / Display File  
                (OVRDSPF) command to replace the file named in a CL procedure or program or to change 
               certain parameters of the existing database file. And It can also be used to access a file member       
               other than the first member in case of database file.OVRDBF (FILE1) (FILE2) : File1 is new  
               file which is overriding and File2 is overridden file

Q             About MONMSG?
A             It is a CL command to monitor and error/eception message so that in case of an error a dump is 
               avoided and the control is in program.  It is also used to monitor user message.

Q             Command to LOCK the file?
A             ALCOBJ – Allocate object  in CL with lock state *EXECL

Q             What is the scope of OVRDBF?
A             By default it is *ACTGRPDFN, there are some other like : *CALLLVL *JOB

Q             What is SHARE(*YES) in OVRDBF?
A             Allow HLL program to share same access path / ODP created by OPNQRYF In called program 
               FILE1 is used.

Q             OPNQRYF command?
A             It is Dynamically creation of access path, and it can have resultant fields i.e. if the expression is
               A = B + C then B and C are from the file while A is defined in OPNQRYF. We can divert the  
               output of command to an OUTFILE.  Command associated with OPNQRYF is CPYFRMQRYF 
               to save the output permanently.

Q             Syntax of OPNQRYF ?
A             OPNQRYF FILE(LIB/FILE) OPTION(*INP/*ALL/*UPD/*DLT/*OUT) QRYSLT  
               (Expression) KEYFLD(Filed) UNIQUEKEY(Field) MAPFLD(Field)  
               OPNSCOPE(*ACTGRP)
                Expression specified in QRYSLT is a selection criteria for record selection.
                MAPFLD are nothing but resultant fields.

Q             Can you access OPNQRY file in Program?
A             Yes, we can use OPNQRY in the program and sequence of commands are as follow :
                                OVRDBF with SHARE(*YES)
                                OPNQRYF
                                CALL to any program (either CL/CLLE/RPG/RPGLE)
                                If we want to store the output of OPNQRYF to some database file then  
                                CPYFRMQRYF
                                CLOF file
                                DLTOVR

Q             About QCMDEXC?
A             The Execute Command (QCMDEXC) API runs a single command.  It is used to run a command 
                from within a high-level language (HLL) program or from within a CL program where it is not 
                known at compile time what command is to be run or what parameters are to be used. With two 
                mandatory parameter 1) Command String Char(*) and 2) Length of command string as 
                CHAR(15)

Q             About DATA Queue?
A             Data queue is an AS/400 object of type *DTAQ used to transfer data between program and job. 
               Only object description is saved.  It is most efficient way to communicate between jobs. It even 
               faster (high speed communication) than Files and Message queue.
               Once we receive a data from data queue that received entries are automatically removed from data 
               queue.
                CRTDTAQ DTAQ(QTEMP/MYDTAQ) MAXLEN(30) SEQ(*FIFO) 
                SENDERID(*YES) TEXT('TEST DATAQ')

                                From above command name of data queue is MYDTAQ created in lib QTEMP with 
              the length of 30 char and retrival sequence is FIFO (we can have FIFO LIFO KEYED) which  
              includes sender information.(job name and user profile is included)

Q             What is the importance of KEYED data queue?
A             With the help of  KEYED sequence we can retrieve the record dynamically as per the value of 
                KEY.

Q             What is JOBLOG?
A             It is a log of a particular job. Which consists of all the commands executed for the particular job.

Q             How to VIEW Spool File..?
A             There two ways to view a spool file one is DSPSPLF and another is do WRKSPFL  and select 
                 the required file type option 5 and it will view a spool file.

Q             About Journalling..?
A             Journalling is nothing but working under commitment control. For journalling we need to have a 
                Journal Receiver and Journal.  When working under commitment control files are journaled in 
                journal which is attached to a journal receiver. While journalling a file we can specify the entries to 
                be omitted.. like open close entries are omitted.
                CRTJRNRCV,  CRTJRN,  STRCMTCTL,  ENDCMTCTL, STRJRNPF,  ENDJRNPF are the 
                various command involved in journalling.

Q             What is a Batch Job?
A             Batch job is a job where user interaction is not involved.

Q             what is SBMJOB?
A             It is a CL command to submit the a job for batch processing.

Q             How to change job priority?
A             we can change the job priority with the help of CHGJOB command.  Or we can change the job  
                priority with the help of WRKUSRJOB and selecting the a particular job for change.

Q             What is Message Queue ?
A             It is queue where you can receive the message from different job. Or we can send a message to a 
                message queue. It is referred as *MSGQ

Q             what are the different type of message queue?
A             Job message queue, User message queue,

Q             What are the different types of messages?
A             Program message, user message, System messages.

Q             What is OUTFILE?
A             Output of some CL commands (e.g. DSPFD, DSPFFD)  can be directed to a file is known as 
                OUTFILE. OUTFILE is a Physical file on which we can have almost all the file operation.

Q             Whether Level check error will exists in case of CL program?
A             No, As CL program doesn’t check for the format identifier while compilation or execuation.

Q             How to schedule job with the help of SBMJOB?
A             With the help of parameters Schedule data (SCDDATE) and Schedule Time (SCDTIME) by 
                default the values are *CURRENT

Q             If we want to recompile 500 logicals based on single physical file then how will you do it?
A             With the help DSPDBR we can get the all the dependent logical files. Divert the output of 
                DSPDBR to an OUTFILE; read that OUTFILE; pass the name of logical file to CRTLF 
                command in a CL program to create Logical file.

Q             How to create a module in CLLE ?
A             with the help of CRTCLMOD or option 15 from WRKMBRPDM .

Q             How to specify a Library list while submitting a remote job?
A             We can specify *CURRENT, *SYSVAL (System lib) or *JOBD (Lib. list from Job’s 
                description) or We can specify the list of lib in the command itself.

No comments