You are on page 1of 10

What is the disadvantage of using Global variable?

Ans:We can not trace out at which point the value of variable is changed. What is Service Program? Ans:A Service Program is a collection of runnable procedures and available data items easily accessible by other ILE programs. In many respects it is similar to a subroutine library and procedure library. A service program differs from a program in two ways: It does not contain a program entry procedure. This means that you cannot call a service program using the CALL operation. A service program is bound into a program or other service programs using bindin g by reference. What is the structure of Service Program ? What is signature ? What is *ISO date format? Ans:YYYY-MM-DD for other formats refer to IBM manual or ERIS document. If we tried to move year part of *ISO date into a field of length 3, what will h appen ? Ans:Program crashes, as in case of *ISO format it required fields of 4,2,2. How to avoid using indicators in ILE ? Ans:By using the standard Built In Expressions like %FOUND,%EOF, NOT %EOF, %BOF, NOT %BOF etc. Display / Printer File Explain the keywords EDTCDE & EDTWRD Ans: EDTCDE & EDTWRD are key words used for formatting purpose. EDTCDE cannot be appl ied to Character filed. And EDTCDE has some Codes pre-defined for example, EDTCDE(Z) for suppressing the leading zero Y for date field. EDTWRD can be used to define user defined formatting for a fields. Disadvantage of using Validity Check keyword? How to overcome these disadvantage s ? Ans:If invalid values are entered, The option filed is displayed in reverse image. System defined message is displayed which may not be user friendly. Keyboard is locked, we have to reset it. To overcome above disadvantage validations is done within program and user frien dly/defined message is displayed. What are the important factors in Error message subfile ? Ans:We must define error message record format (SFLMSG). And a Program Queue. (P GMQ) and Record format is associated to a line number. How to define to define a Hidden filed in DSPF ? Ans:Define a filed in a DSPF of use HIDDEN.(H) How To get the cursor position? Ans:With the help of RTNCSRLOC keyword, here we need to define a field to get ro w and column. Length of variable should be 5,0 fixed We can specify *FILED for filed *REC for Record on which a key is pre ssed.

What is OVERLAY? Ans:It allows a record format to be displayed on screen retaining the previous d isplayed record formats. What key word is used when screen is re-display? Ans:RSTDSP is a parameter to be specified at compile time for display file. Command Attention key and Command Function Key ? Ans:With the help of Command attention key we can pass only the indicator status to program not the data from screen. While command function key passes indicator status as well as a data from scree n to program. How to validate input values in Display file ? Ans:With the help of Validity check key words VALUE, RANGE, COMP What is the stored procedure and how do you define a stored procedure. Ans:A stored procedure is a program that can be called to perform operations tha t can include both host language statements and SQL statements. Procedures in SQL provide the same benefits as procedures in a hot language. That is, a common piece of code need only be written and maintained once and can be called from several pro grams. Stored procedures can be used in both distributed and non-distributed applications. It is defined using DECLARE PROCEDURE statement, syntax is as below EXEC SQL DELCARE P1 PROCEDURE (:PARM1 INOUT CHAR(10)) (EXTERNAL NAME MYLIB/PROC1 LANGUAGE RPGLE SIMPLE CALL WITH NULLS); END-SQL We can have parameters as IN , OUT , INOUT type. Language can be RPGLE, C, CL, e tc.. MYLIB/PROC1 this PROC1 is a program written and compiled separately and it is of language which you are specifying in section LANGUAGE. Using Nested Select statement SELECT * FROM FILE1 WHERE FILE1.FLD1 EQ (SELECT FILE2.FLD1 FROM FILE2) How do you achieve referential integrity? Ans:By adding Referential Integrity Constraints to a Physical file or Logical fi le. Constraints like PRIMARY KEY, FOREGIN KEY, DELETE RULE, UPDATE RULE. ETC. Commands are ADDPFCST for Physical file and ADDLFCST for Logical file. Type of *REFCST *UNQCST *PRIKEY *CHKCST constraints - A referential constraint is being added - A unique constraint is being added. - A primary key constraint is being added - A check constraint is being added

Type of Delete rule (DLTRULE) *NOACTION 1. Deleting a record in parent file is permitted (not restricted) if data for a non-null parent key does not match data for a foreign key. Deleting a record in a parent file is restricted (does not occur) if data for a non-null parent key matches data for a

foreign key. *RESTRICT Deleting a record in a parent file is permitted if data for a non-null parent ke y does not match data for a foreign key. Deleting a record in a parent file is restricted if data for a non-null parent k ey matches data for a foreign key. *CASCADE The cascade delete rule is used. Deleting a record in a parent file causes match ing records in the dependent file to be deleted when data for a non-null parent key matches data for a foreign key. Type of Update rule (UPDRULE) *NOACTION No Action *RESTRICT Updating a y does not Updating a ey matches record in a parent file is permitted if data for a non-null parent ke match data for a foreign key. record in a parent file is restricted if data for a non-null parent k data for a foreign key.

Where Stored procedure lies in the system. Ans:If we want to have a look where the stored procedure, we can have a look thr ough SQL. Select * from Different type of Cursor? Ans: Two types of Cursor Simple / Serial Cursor A serial cursor is one defined without SCROLL key word For serial cursor each row is fetched only once per OPEN When it is opened it is positioned before the first row in the table. To use serial cursor we have to re-issue OPEN Scrollable Cursor which is defined with SCROLL key word. Cursor defined with SCROLL key word Rows of cursor can be fetched many times When it is opened it is positioned before the first row in the table. When the FETCH is issued , the cursor is positioned to the row of the table that is specified by the POSITION option. (FIRST, LAST, PREV, NEXT, RELATIVE) Writing an SQL statement from selecting records from TWO files using single stat ement and Nested select statement. Ans: Using Single statement. SELECT * FROM FILE1, FILE2 WHERE FILE1.FLD1 = FILE2.FLD1 Difference between View and Index ? Ans:View will not any data.. It only shows a data from table while Index has a I ndexing Data for a sequence on which Index is created. View is similar to Logical file without having Key and Index i s similar to Logical File having Key (as keyed logical file has access path data) Table is similar to PF. Can we have records (with fields from more than one file) from multiple files an d Nested / sub query in SQL ? Ans:Yes, we can have record from multiple file with join condition and we also c an have nested query or subquery like

SELECT * FROM FILE1 WHERE FILE1.FLD1 IN (SELECT FILE2.FLD1 FROM FILE2) What is the sequence when using CURSOR? Ans: Define Cursor ,Declare Cursor ,Open Cursor ,Fetch record ,Processing ,Close Cursor Which of the following operations does NOT zero the field FLDA defined as 4,0? Ans: C MOVE *ZEROS FLDA C Z-ADD *ZEROS FLDA C Z-ADD 0 FLDA C MOVE *ALL'0' FLDA C SUB FLDA FLDA C MOVE '0000' FLDA C CLEAR FLDA C MOVE *BLANKS FLDA The last instruction does NOT zero the field FLDA. How would you design the process for a nightly, high volume check producing proc ess 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 da ta base file. The process involves following steps: Steps: 1. OVRDBF with SHARE (*YES) 2. OPNQRYF 3. CALL the program 4. DLTOVR 5. CLOF How would you join 3 separate fields, a first name, middle initial and last name together as 1 field with proper spacing? You can describe in either RPG and/or RPG ILE (Integrated Language Environment) Ans: MOVE 'Dr. ' FNAME 3 MOVE 'JOHN' MNAME 4 MOVE 'WATSON' LNAME 6 FNAME CAT MNAME: 1 VAR1 8 VAR1 CAT LNAME:1 VAR2 15 DSPLY VAR2 MOVE *ON *INLR When PGMA calls PGMB for the first time PGMB executes the *INZSR. PGMB uses the RETRN operation to return to PGMA. When PGMA call PGMB the second time is the *INZSR executed? Ans:If you specify RETRN in called program, the *INZSR will not execute again. Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptab le) 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 the purpose of Factor 1 the Operation Code and *IN15 in following code HI LO EQ C *YMD Test(D) yymmddDate 15 Ans:If the factor 1 value matches with factor2 value, the indicator specified in EQ comes *ON. Describe the function of SETLL operation in RPG language? Ans:The SETLL operation positions a file at the next record with a key or relati ve record number that is greater than or equal to key or relative record number specified in factor1. Describe the function of SETGT operation in RPG language? Ans:The SETGT operation positions a file at the next record with a key or relati ve record number that is greater than key or relative record number specified in factor 1. What is the purpose of Level Check parameter in a Physical file? Ans:Specifies whether the level identifiers of the record formats in the physica l file are checked when the file is opened by the program. 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. What is the function of CRTDUPOBJ command? Ans:To create the replica from the original object. Define Subsystem? Ans:Subsystem is nothing but it provides specialized environment to complete the execution of jobs. What are different types of Substems? Ans:QBATCH, QINTER, QSPL, QCMN, QCTL, QBASE. Define a Batch Job? Ans: * A user request the job. * The job is created (job name is assigned, job attributes are allocated) * The job is placed on a job queue * The sub system QBATCH takes the job from job queue and starts it. * Output generated by the batch job is placed on an output queue. * The spool sub system prints the output on the output queue.

Describe about Query/400? Ans:Query/400 is a licensed program that uses a query to analyze and select the information contained in the data base files and create a query repor t. A query report can be: * displayed on a workstation (screen) * printed * stored in another database file. 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 prog ram 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 structur e, its data is implicitly retrieved for processing and written back at the end of the program. In the data area dat a 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 f ield which is included in a file information data structure. Specifically, keywords including *FILE, *RECORD, *OP CODE, *STATUS, *ROUTINE provide the previously named information. * Program status data structure Program status data structure however identity exception/errors that are generat

ed in the program by RPG/400 operations and not by a file. Note that any code greater than 00099 is flagged as an except ion/error. Four keywords - *STATUS, *ROUTINE, *PROGRAM, *PARMS are supported by a program status data structure. What is the purpose of DYNSLT keyword? Ans:This is a file level keyword used in a logical file. If you specify this in a file level, the system doesn't perform record selection until the program reads file. Then on the Select/Omit criteria , it selects the records from the specified file. When would you prefer logical file than OPNQRYF? Ans:The physical file you are working with very large, creating and using a logi cal file will allow an application to perform faster than using an open query file. Since access paths created by open query files are temporary, applications that use an access path frequently will be more efficient using a logical file, since the access path will not have to be rebuilt every time the file is open. What is the difference between SFLCLR and SFLINZ? Ans:SFLCLR : It clears the subfile. SFLINZ : First it clears the subfile and ini tiliazing the numeric variables with zeros and alphanumeric variables with chara cters. Define the purpose/use for SFLRNA? Ans:Using this, we can make specified subfile record format inactive. What is the purpose of the following I UDS I 1 60ORDER# I 7 90LINE# Ans:The purpose is to define the variables in I-Spec and these are further used in C-spec. Where as U indicates data area data structure? The above code is used t o update the data area value through the program. The letter "U" indicates that the defined data structure is a data area data structure. What is the purpose of the following? A CSRLOC (F1ROW F1COL) Ans:Using this record level keyword, you can specify cursor location on an outpu t operation to the record format you are defining. The program sends output afte r setting the cursor location. Define what the operation will do, the purpose of the result field and the purpo se of *IN66? HI LO EQ C CALL 'CVTDAT' DTPRM 66 Ans:The above statement causes, call the program and pass the parameter. Define each of the following operation codes a. READ To read the records sequentially. b. READE To read the equal key records c. READP To read the previous records d. READC To read the records from the workstation file (Subfile). e. REDEP To read the equal key previous records. Define the purpose of the following code (If you know, how would this be written

in RPG ILE) HI LO EQ C *IN66 DOUEQ *OFF C KEY1 CHAIN FILEA 90 66 C 66 CALL PGM1 PRM C ENDDO Ans:Whenever the indicator *IN66 becomes *OFF, the control transfers after ENDDO statement. Otherwise, it reads the records from the data base file based on ind icator specified on HI position. If the specified indicator on LO position becom es *OFF, then only CALL statement will execute. How do you set the keywords SFLSIZ and SFLPAG if you want the subfile to dynamic ally expand? Ans:SFLSIZ > SFLPAG. When would you use or not use this approach? Ans:It is the most desirable method in building a real time applications. We can use at all the times. How can you detect and handle a record lock situation? Ans:If you try to read the locked record, we can get system defined message i. e . , the program will ended abnormally. With the help of File Information Data St ructure we can handle record lock situation. Generally it will happen, when the same file of type " U" used in different programs. How can you detect overflow for a print program that prints multiple lines per c ycle? Ans:You specify the indicators OA through OG and OV in 33 - 34 columns in a prin ter file. This indicator automatically set on whenever overflow occurs on a type of page. Define a shared access path? Ans:To share the open data path by various programs in a same job. What is the difference between array and a multiple occurrence data structure? Ans:The values stored in array don t vary. In the other hand, we can store the Different values in same variables at various stages. What is *INZSR used for? Ans:It is special type of RPG/400 subroutine, which is executed automatically at beginning of the program. It is a good place to code initializes the variable s. How can you execute a command from within an RPG program without calling a CLP p rogram? Ans:By calling QCMDEXC application program interface we can execute a CL command with in an RPG program. What is the purpose of the "N" in the following calculation specification? Ans:C KEY CHAIN FILE N 99.If you specify 'N' in 53rd position, the record will n ot be locked if you try to read the locked record. It is a way of avoiding the record lock. 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 i s 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 fo r? Ans:Data queues provides communication between programs by calling API's QSNDDTA Q 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 t o store the information to be sent. We can send the same data queue to the many programs. What is the purpose of the following? I 'CLOSED' C STAT01 I 'OPEN' C STAT02 Ans:It is a type of initializing the variables in I-spec. and these are further used in C-spec. What is the difference between UDATE and the system date? Ans:UDATE supports two-digit year. The format is *MDY (MMDDYY). *DATE (system date) supports four digit year. The format is *MDYY (MMDDYYYY). 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 d evice file. Define the purpose of the %SST function? Ans:To extract the information from the specified string. Define the purpose of the *CAT function? Ans:To concatenate the two strings into a one string. Define the purpose of the *BCAT function? Ans:To concatenate the two strings by placing a single blank in a resultant. Describe the difference between the DOWxx and DOUxx operations? Ans:DOWxx : If the condition becomes true, then only the group of instructions a llowed executing. DOUxx : Irrespective of condition, it will execute at least one time. Define the purpose of the LEAVE operation? Ans:If you specify LEAVE, the control transfers to the statement below the ENDDO . Define the purpose of the ITER operation? Ans:If you specify the ITER, the groups of statements are allowed to execute rep eatedly. 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 t he 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 What is the purpose of the following?

FORDHDR1 IF E K DISK ORDHDRF KRENAMEORDHDRF1 Ans:In order to rename the record format of a data base file in a program, we can use the above steps. Purpose of renaming is: If the record format name is similar in two files and if both are used in a same program, the program will not compile. Hence we have to rename ei ther of the file. What is the purpose of the following Ans:C/COPY QRPGSRC,ORDERR During the compilation the source code of ORDERR copy book is copied into the ex isting program. Where as /COPY is compiler directive statement. What is the purpose of the following Ans:FORDHDR1 CF E WORKSTN $2SFN SFILE FMT2 The above line indicates that, $2SFN is a relative record number and FMT2 is nam e of the subfile record format.

You might also like