You are on page 1of 11

CL-commands & DS and DTAs, Tables, queues

. Define what a data area is along with a brief example of what it may be used for? Data area is a storage area to store limited information. Example: a new and unique customer number is generated whenever a new customer is added to customer master file. Data area keeps track of last record added and add 1 to it. Through program we can access new customer number. 9. Define what a data queue is along with a brief example of what it may be used for? Data queues provides communication between programs by calling APIs QSNDDTAQ and QRCVDTAQ along with parameters like data queue name, library in which data queue exists, variable to store the number of characters to be sent, variable to store the information to be sent. We can send the same data queue to the many programs. . List the steps/commands necessary to accomplish the following: a. Copy data from the file ORDHDR into file ORDHIST b. The file ORDHIST may or may not exist c. If the file ORDHDR does exist, it may or may not contain data d. The file ORDHIST may or may not contain data, if the file does contain data the old data should be erased Commands: a. CPYF FILE(ORDHDR) TOFILE(ORDHIST) b. CPYF FILE (ORDHDR) TOFILE (ORDHIST) CRTFILE (*YES) c. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *ADD d. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *REPLACE 32. When would you use expand subfile or not use this approach? It is the most desirable method in building a real time applications. We can use at all the times. Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable) 1) CVTDAT DATE() RTNVAR( ) FROMFMT( ) TOFMT( ) Source code is required to convert from one date format to another date format. The source code in CLP is given below: PGM DCL VAR(&VAR1) LENGTH(6) TYPE(*CHAR) VALUE(YYMMDD) DCL VAR(&RCVD) LENGTH(6) TYPE(*CHAR) DCL VAR(&VAR2) LENGTH(4) TYPE(*CHAR) DCL VAR(&VAR3) LENGTH(2) TYPE(*CHAR) CHGVAR VAR(&VAR2) VALUE(%SST(&VAR1 3 4)) CHGVAR VAR(&VAR3) VALUE(%SST(&VAR1 1 2)) CHGVAR VAR(&RCVD) VALUE(&VAR2 *CAT &VAR3) SNDMSG MSG(&RCVD) TOUSR(*USRPRF) ENDPGM . Define a Job Queue? Job queues are queues of batch jobs waiting to be processed. 45. Define a Output Queue? Output queues are queues of jobs waiting to be printed.

Classification: GE-GDC Internal

46. What is the function of CPYSPLF command? It copies the spooled file to the data base file. 47. What is the function of CPYF command? To copy the data from the one file to another. 48. What is the function of CRTDUPOBJ command? To create the replica from the original object. . What is the CLP command to access a Query/400? WRKQRY 54. Purpose of Overrides? The basic purpose of Overrides is to temporarily change the attributes of a file. So you dont have to create permanent files for every combination of attributes your application might need. Overrides gives you the flexibility to use existing model files and dynamically change their attributes. 55. Define Data Structure? Data structures are specified in the Input specifications of an RPG/400 program to define an area in storage and layouts of related sub fields. 56. What is the purpose of Data structure? * Divide a field in to sub fields * Change the format of a field * Group non-contiguous data in a contiguous format * Define an area of storage in more than one format * Define Multiple occurrences of data structures. 57. List and explain the different type of data structures? * Data area data structure When the data area is defined in an RPG/400 program as a data area data structure, its data is implicitly retrieved for processing and written back at the end of the program. In the data area data structure, letter U must be entered to define the data structure as a data area data structure. * File information data structure A file information data structure provides exception/error information that may be occurred when processing a file during program execution. This type of data structure contains pre defined sub fields that identify * The name of the file for which the error occurred * The record processed when the error occurred * The operation being processed when the error occurred * The status code number * The RPG/400 routine in which the error occurred. Exception errors may be controlled by testing for an error code in the *STATUS field which is included in a file information data structure. Specifically, keywords including *FILE, *RECORD, *OPCODE, *STATUS, *ROUTINE provide the previously named information. * Program status data structure Program status data structure however identity exception/errors that are generated in the program by RPG/400 operations and not by a file. Note that any code greater than 00099 is flagged as an exception/error. Four keywords *STATUS, *ROUTINE, *PROGRAM, *PARMS are supported by a program status data structure. . What is the difference between Array and Table? Array: Array is stored any where in the body of the input records. Table: Table is stored at the begining of the input records. Array: We can access all the elements in array by specifying the array name. Table: Only one table element can be accessed at a time. Array: Array can be searched randomly. Table: Table can be searched consecutively.

Classification: GE-GDC Internal

. How can you identify End of file in CLP program? With the help of MONMSG MSGID(CPF0864) we can identify end of file in clp program. . Define an Interactive Job? * A user requests a job. * Job is created and job name, job attributes are assigned. * Job is placed on a job queue. * The sub system QINTER takes the job from the job queue and starts processing. * The output generated by the interactive job is placed on the output queue * The spool sub system QSPL prints the output. 85. How can you check the existence of object in a system? With the help of CHKOBJ clp command, we can find existence of object on the system. The usage of command in clp is as follows: CHKOBJ OBJ(JBA001DT) OBJTYPE(*DTAARA) MONMSG MSGID(CPF9801) EXEC(DO) CRTDTAARA DTAARA(QGPL/JBA001DT) TYPE(*CHAR) LEN(6) + VALUE(010196) TEXT(The last day that had job acct.+ data extracted) ENDDO RTVDTAARA DTAARA(JBA001DT *ALL) RTNVAR (&FROMDATE) The execution of above steps is listed below: steps 1: First it checks the data area object on the system. 2: If the data area object not found, the MONMSG command executes with the help of message identifier, next we can dynamically create the data area. 3. If the data area object found, control transfers to statement below ENDDO. It is always good CLP programming approach to check the object before you rename, delete the objects on the system. . What is the maximum number of parameters allowed in CLP? 43 (Forty three) . How do you know that records are locked? By using a command WRKOBJLCK. . What are the different types of Data Areas? The different types of Data Areas are general data area, local data area, group data area, pip (program initialization parameter data area) data area. *General Data Area It can be created by user implicitely or explicitly It can be referred by any other jobs. It can be associated with a library. It can be created, deleted by the user. * Local Data Area It can not be referred by any other job. It is automatically created and deleted by the system. It is not associated with any library. *Group Data Area It is automatically created and deleted by the system We can access the group data area value through clp. It is meant for group jobs. *Pip Data Area It is meant for pre start jobs. What is Data Area? Data area is an object used to hold data for access by any job running on the system. A data area can be locked to a single user, thus preventing other users from processing at the same time.

Classification: GE-GDC Internal

157. What are the types of data areas? User defined Data Area, Local Data Area (LDA), Group Data Area (GDA), Program Initialization Parameter (PIP) Data Area. 158. What is LDA? LDA is created by the system for each job in the system, including auto-start jobs, jobs started on the system by a reader, and subsystem monitor jobs. 159. What is the type, length of a LDA? *CHAR, 1024 bytes 160. What is GDA? The system creates a GDA when an interactive job becomes group jobs. Only one GDA can exists for group. 161. How to create a user defined (general) data area? Using CRTDTAARA command 162. What are the different ways to input data into data area? CHGDTAARA (using CL) Using OUT opcode in RPG 163. How to retrieve data from data area? Using RTVDTAARA command in CL. Using IN opcode in RPG 164. What are the valid user defined data area types? CHAR, NUMERIC and LOGICAL 165. How can a data area be locked after being updated? Using OUT *LOCK 166. What is the use of Data Queues? Data queue is a type of system object that you can create. Data Queues are used in Program to program communication. 167. How to create a data queues? Using CRTDTAQ command. 168. What are the valid data types in Data Queue? Char, Numeric, and Logical 169. What are the two types of read performed on data queues? Read with lock, and read without lock. How do you put jobs in batch mode? SBMJOB 175. What is the use of OVRDBF ? You can use the Override with Database file (OVRDBF) command to replace the database file named in a CL program or to change certain parameters of the existing database file. 176. What is the use of OVRPRTF ? Override with Printer file (OVRPRTF) command is used to override certain parameters of the printer files used in the program or to replace the printer file.

Classification: GE-GDC Internal

177. How to change file attributes such as size, file wait time, record wait time etc. , permanently? Using CHGPF command 178. What is the use purpose of CRTCMD? To create user defined command. 179. What is class of service ? A set of link and node characteristics associated with a session. 180. How to see active jobs of the system. Using WRKACTJOB command 181. How do you detect unused spool storage? Using Reclaim Spool Storage. 184. What process the command SBMRJEJOB does? Sends RJE input stream to host system What are the different types of variables available in CL? DEC, CHAR, LGL 229. How do you pass parameters in CL? Using PARM keyword. 230. What is difference between CAT, TCAT, BCAT? CAT Concatenate two variables or constants into one continuous string. BCAT Truncates all trailing blanks in the first character string, one blank is inserted, then the two character strings are concatenated. TCAT Truncates all trailing blanks in the first character string, the two character strings are concatenated. 231. What are the different types of messages in CL? Immediate message, Break message, Program message, User message 232. How to trap errors in CL? By using Monitor Message Command (MONMSG) 233. What is the maximum length of a variable name in CL? Maximum 11 characters (including &) 234. What are the limitations of CL (compare to RPG) ? you can not use CL program to ADD or UPDATE records in database files. Use Printer or ICF files. Use Program described files. Use the concept of subfile (to display more than one record), but a single output message subfile is a special type of subfile that is supported well in CL. Use subroutines. You cannot declare more than one object (file) in a CL programme. . How do you write and read a value (similarly as EXFMT of RPG) using a display file in CL? SNDRCVF. 382. How do you display a screen in CL? SNDF. 383. How to check end of file in CL? Monitor the message ID (CPF0864). 384. Can you update a file in CL? NO. 385. Can you add a record to a physical file through CL? NO 386. What opcode is used for submit job? Why it is used? SBMJOB opcode is used and it is used for

Classification: GE-GDC Internal

background processing. 387. How do you monitor message in CL? By using monitor message ID: (MONMSG MSGID (CPF0000) 388. Except report design what else can be done by O spec? We can write a Physical File from O spec. 389. What is the full for of CA and CF? Command Attention and Command Function. 390. Difference between WRKUSRJOB and WRKACTJOB? All the jobs in WRKUSRJOB are seen including Active jobs where as in WRKACTJOB only active jobs are seen. . What does the OVRDBF command do? It overrides the PF temporarily for a job. 454. How does the RUNQRY show the output? RUNQRY shows the output always in RRN (Relative Record Number) & not in keyed sequence. How can we run a Batch Job? SBMJOB Command. 474. Difference between CALL & SBMJOB? CALL performs interactively job while SBMJOB performs batch job. . Use of Data Structures? Dividing a field into sub fields. Changing the format of a field. Grouping non-contiguous data in a contiguous format. Defining an area of storage in more than 1 format. 480. Types of Data Structures? a. File Information Data Structure. b. Program Status Data Structure. c. User Defined Data Structure. d. Multiple Occurrence Data Structure. e. Date Area Data Structure. . What is an Output Queue? They are the holding areas that store printed output generated from Batch programs or Interactive applications. What is a table? A table is collection of data elements in one column, data elements Must be of same type and same length. 508. What is a Compile Time Table? We can hard code data within the program is said to be Compile Time Table. 509. What is a Run Time Table? Data from a separate disk file is loaded into a table each time the Program runs. 510. Give the Table definition? TABMT 1 12 2 A Where 1 = Number of entries per record 12 = Total number of entries 2 = Length of each entry A = Ascending Sequene 511. If the data is likely to change over a period of time & Moreover data is large than which type of table is preferred? Compile Time Table. 512. What is Alternate Table? RPG tables stores information in 1 column. To store information in multiple columns, it uses the concept of Alternate Table. 513. What is an Array? Array is a collection of data, the data elements must be of same Length and same type. . What is the command to view the library list? DSPLIBL 519. What is the command to create PF? CRTPF The command to display a list of spooled files? WRKSPLF 526. Change in the externally described file does not require recompilation of the program? (True/False) False 527. Command to display current library is? DSPCURLIB . Consider the following command: WRKOBJ OBJ (*ALLUSR/DBTMEF) Object DBTMEF in all libraries except system libraries. 597. Which of the CL command can be used to determine which logical files are dependent on a specific file? DSPDBR 598. Which CL command is used to trap error messages during program execution? MONMSG 599. Which CL command can be used at program execution to redirect the file named in an RPG program? OVRDBF 600. What is the length of the variable in the given example? DCL VAR (&Name) TYPE (*Char)? Default 32 & for Decimal 15,5

What is the command to create FRF? Ans:CRTPF DLCOBJ command is mandatory for removing lock on any object?

Classification: GE-GDC Internal

Ans:False

How will you find a string using PDM? Ans:By using FNDSTRPDM. How will you search an array? Ans:LOKUP What are the different types of arrays? Ans:Preruntime gets populated at the time input. Runtime gets populated at the time execution.Compile time gets populated at the time of compilation. What is QCMDEXC? Ans:It is used to execute a single CL command within the RPG program. What is OPNQRYF, MONMSG commands Ans: 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 It is a CL command to monitor and error/exception 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. Which of the CL command can be used to determine which logical files are dependent on a specific file? Ans:DSPDBR

Which CL command is used to trap error messages during program execution? Ans:MONMSG Which CL command can be used at program execution to redirect the file named in an RPG program? Ans:OVRDBF What is the length of the variable in the given example? Ans:DCL VAR (&Name) TYPE (*Char)? Default 32 & for Decimal 15,5 We can determine weather a record is in use bye another user with the help of status code (*STATUS). If *STATUS = 01218 i.e. record already locked. Define what a data area is along with a brief example of what it may be used for? Ans:Data area is a storage area to store limited information. Example: a new and unique customer number is generated whenever a new customer is added to customer master file. Data area keeps track of last record added and add 1 to it. Through program we can access new customer number. Define what a data queue is along with a brief example of what it may be used for? Ans:Data queues provides communication between programs by calling API's QSNDDTAQ and

Classification: GE-GDC Internal

QRCVDTAQ along with parameters like data queue name, library in which data queue exists, variable to store the number of characters to be sent, variable to store the information to be sent. We can send the same data queue to the many programs. List some of the commonly used commands for debugging Ans:STRDBG(for batch jobs), STRISDB. Define the RCVF command? Ans:RCVF command used to receive the records either from the data base file or device file. List the steps/commands necessary to accomplish the following: a. Copy data from the file ORDHDR into file ORDHIST b. The file ORDHIST may or may not exist c. If the file ORDHDR does exist, it may or may not contain data d. The file ORDHIST may or may not contain data, if the file does contain data the old data should be erased Ans:Commands are as follows a. CPYF FILE(ORDHDR) TOFILE(ORDHIST) b. CPYF FILE (ORDHDR) TOFILE (ORDHIST) CRTFILE (*YES) c. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *ADD d. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *REPLACE Define what a data area is along with a brief example of what it may be used for? Ans:Data area is a storage area to store limited information. Example: a new and unique customer number is generated whenever a new customer is added to customer master file. Data area keeps track of last record added and add 1 to it. Through program we can access new customer number. Define what a data queue is along with a brief example of what it may be used for? Ans:Data queues provides communication between programs by calling API's QSNDDTAQ and QRCVDTAQ along with parameters like data queue name, library in which data queue exists, variable to store the number of characters to be sent, variable to store the information to be sent. We can send the same data queue to the many programs. How would you design the process for a nightly, high volume check producing process that needs to select only records that are flagged to be processed? Ans: With the help of OPNQRYF Clp command, we can select the records from the data base file. The process involves following steps: Steps: 1. OVRDBF with SHARE (*YES) 2. OPNQRYF 3. CALL the program 4. DLTOVR 5. CLOF

Define a Job Queue? Ans:Job queues are queues of batch jobs waiting to be processed. Define a Output Queue? Ans:Output queues are queues of jobs waiting to be printed. What is the function of CPYSPLF command? Ans:It copies the spooled file to the data base file. What is the function of CPYF command? Ans:To copy the data from the one file to another.

Classification: GE-GDC Internal

What is the function of CRTDUPOBJ command? Ans:To create the replica from the original object. What is the CLP command to access a Query/400? Ans:WRKQRY

What is the purpose of Overrides? Ans:The basic purpose of Overrides is to temporarily change the attributes of a file. So you don't have to create permanent files for every combination of attributes your application might need. Overrides gives you the flexibility to use existing model files and dynamically change their attributes. Define Data Structure? Ans:Data structures are specified in the Input specifications of an RPG/400 program to define an area in storage and layouts of related sub fields. What is the purpose of Data structure? Ans: * Divide a field in to sub fields * Change the format of a field * Group non-contiguous data in a contiguous format * Define an area of storage in more than one format * Define Multiple occurrences of data structures. List and explain the different type of data structures? Ans: * Data area data structure When the data area is defined in an RPG/400 program as a data area data structure, its data is implicitly retrieved for processing and written back at the end of the program. In the data area data structure, letter "U" must be entered to define the data structure as a data area data structure. * File information data structure A file information data structure provides exception/error information that may be occurred when processing a file during program execution. This type of data structure contains pre defined sub fields that identify * The name of the file for which the error occurred * The record processed when the error occurred * The operation being processed when the error occurred * The status code number * The RPG/400 routine in which the error occurred. Exception errors may be controlled by testing for an error code in the *STATUS field which is included in a file information data structure. Specifically, keywords including *FILE, *RECORD, *OPCODE, *STATUS, *ROUTINE provide the previously named information. * Program status data structure Program status data structure however identity exception/errors that are generated in the program by RPG/400 operations and not by a file. Note that any code greater than 00099 is flagged as an exception/error. Four keywords - *STATUS, *ROUTINE, *PROGRAM, *PARMS are supported by a program status data structure. What is Alternate Table? Ans:RPG tables stores information in 1 column. To store information in multiple columns, it uses

Classification: GE-GDC Internal

the concept of Alternate Table. What is an Array? Ans:Array is a collection of data, the data elements must be of same Length and same type.

Printed output items placed in an output queue are known as? Ans:Spool Files. When a spooled file is created, it is placed into an? Ans:OUTQUEUE The command to display a list of spooled files? Ans:WRKSPLF Command to display current library is? Ans:DSPCURLIB

What are Data Structures? Ans:Data Structures define an a storage & layout of fields within the defined structure. How can we know the triggers associated with the PF? Ans:DSPFD with parameter TYPE (*TRG) How can we add & remove trigger to a PF? Ans:ADDPFTRG & RMVPFTRG What is an Output Queue? Ans:They are the holding areas that store printed output generated from Batch programs or Interactive applications. What does print writer do? Ans:It is a system job that selects files from the output queue & prints Them on a printer. It provides the interface between output queues Spooled files & the printer. What is a table? Ans:A table is collection of data elements in one column, data elements Must be of same type and same length. What is a Compile Time Table? Ans:We can hard code data within the program is said to be Compile Time Table. What is a Run Time Table? Ans:Data from a separate disk file is loaded into a table each time the Program runs. Give the Table definition? Ans:TABMT 1 12 2 A Where 1 = Number of entries per record 12 = Total number of entries 2 = Length of each entry A = Ascending Sequene If the data is likely to change over a period of time & Moreover data is large than which type of table is preferred? Ans:Compile Time Table.

Classification: GE-GDC Internal

Classification: GE-GDC Internal

You might also like