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.

RANGE. Commands are ADDPFCST for Physical file and ADDLFCST for Logical file. 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. Type of *REFCST *UNQCST *PRIKEY *CHKCST constraints . It is defined using DECLARE PROCEDURE statement. e tc.What is OVERLAY? Ans:It allows a record format to be displayed on screen retaining the previous d isplayed record formats. Constraints like PRIMARY KEY. MYLIB/PROC1 this PROC1 is a program written and compiled separately and it is of language which you are specifying in section LANGUAGE. FOREGIN KEY. UPDATE RULE.A check constraint is being added Type of Delete rule (DLTRULE) *NOACTION 1. ETC. C. Language can be RPGLE. How to validate input values in Display file ? Ans:With the help of Validity check key words VALUE.A primary key constraint is being added . Deleting a record in a parent file is restricted (does not occur) if data for a non-null parent key matches data for a . INOUT type.FLD1 EQ (SELECT FILE2. .A unique constraint is being added. 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. CL. COMP What is the stored procedure and how do you define a stored procedure. While command function key passes indicator status as well as a data from scree n to program.A referential constraint is being added . Using Nested Select statement SELECT * FROM FILE1 WHERE FILE1.. Procedures in SQL provide the same benefits as procedures in a hot language. 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. syntax is as below EXEC SQL DELCARE P1 PROCEDURE (:PARM1 INOUT CHAR(10)) (EXTERNAL NAME MYLIB/PROC1 LANGUAGE RPGLE SIMPLE CALL WITH NULLS). OUT . What key word is used when screen is re-display? Ans:RSTDSP is a parameter to be specified at compile time for display file. DELETE RULE. END-SQL We can have parameters as IN .FLD1 FROM FILE2) How do you achieve referential integrity? Ans:By adding Referential Integrity Constraints to a Physical file or Logical fi le. 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. That is.

FILE2 WHERE FILE1. 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. NEXT. (FIRST. Ans: Using Single statement. record in a parent file is restricted if data for a non-null parent k data for a foreign key. we can have record from multiple file with join condition and we also c an have nested query or subquery like . Ans:If we want to have a look where the stored procedure. *CASCADE The cascade delete rule is used. 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. SELECT * FROM FILE1. *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. 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. 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. Deleting a record in a parent file is restricted if data for a non-null parent k ey matches data for a foreign key.. 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. To use serial cursor we have to re-issue OPEN Scrollable Cursor which is defined with SCROLL key word. RELATIVE) Writing an SQL statement from selecting records from TWO files using single stat ement and Nested select statement. the cursor is positioned to the row of the table that is specified by the POSITION option.FLD1 Difference between View and Index ? Ans:View will not any data. we can have a look thr ough SQL. LAST.foreign key. When the FETCH is issued . Where Stored procedure lies in the system. PREV.FLD1 = FILE2.

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.Processing . OVRDBF with SHARE (*YES) 2. 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. How would you design the process for a nightly.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.Open Cursor . CALL the program 4. 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) .FLD1 FROM FILE2) What is the sequence when using CURSOR? Ans: Define Cursor . PGMB uses the RETRN operation to return to PGMA. ' 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. 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. DLTOVR 5. a first name.Close Cursor Which of the following operations does NOT zero the field FLDA defined as 4. When PGMA call PGMB the second time is the *INZSR executed? Ans:If you specify RETRN in called program. OPNQRYF 3.Declare Cursor . we can select the records from the da ta base file.FLD1 IN (SELECT FILE2.SELECT * FROM FILE1 WHERE FILE1. the *INZSR will not execute again.Fetch record . The process involves following steps: Steps: 1. CLOF How would you join 3 separate fields.

Define a Job Queue? Ans:Job queues are queues of batch jobs waiting to be processed. the indicator specified in EQ comes *ON. QCTL. 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. 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. * The job is created (job name is assigned. QINTER. Define Subsystem? Ans:Subsystem is nothing but it provides specialized environment to complete the execution of jobs. What is the function of CRTDUPOBJ command? Ans:To create the replica from the original object. QCMN. Define a Batch Job? Ans: * A user request the job. What is the function of CPYSPLF command? Ans:It copies the spooled file to the data base file. 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 are different types of Substems? Ans:QBATCH.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. * Output generated by the batch job is placed on an output queue. . Define a Output Queue? Ans:Output queues are queues of jobs waiting to be printed. 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. QBASE. What is the function of CPYF command? Ans:To copy the data from the one file to another. QSPL. * The spool sub system prints the output on the output queue.

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. 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. In the data area dat a structure. So you don't have to create permanent files for every combination of attributes your application might need. letter "U" must be entered to define the data structure as a data area data structure. 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. * Program status data structure Program status data structure however identity exception/errors that are generat . its data is implicitly retrieved for processing and written back at the end of the program. *RECORD. 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.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. 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. *OP CODE. Overrides gives you the flexibility to use existing model files and dynamically change their attributes. *STATUS. 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. * File information data structure A file information data structure provides exception/error information that may be occurred when processing a file during program execution. *ROUTINE provide the previously named information.

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

the program will ended abnormally. What is the purpose of the "N" in the following calculation specification? Ans:C KEY CHAIN FILE N 99. the record will n ot be locked if you try to read the locked record. . Data area keeps track of last record added and add 1 to it. When would you use or not use this approach? Ans:It is the most desirable method in building a real time applications.34 columns in a prin ter file. It is a way of avoiding the record lock. How can you detect and handle a record lock situation? Ans:If you try to read the locked record. If the specified indicator on LO position becom es *OFF. Generally it will happen. 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 . we can store the Different values in same variables at various stages. 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. It is a good place to code initializes the variable s.If you specify 'N' in 53rd position. What is the difference between array and a multiple occurrence data structure? Ans:The values stored in array don t vary. which is executed automatically at beginning of the program. With the help of File Information Data St ructure we can handle record lock situation.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. What is *INZSR used for? Ans:It is special type of RPG/400 subroutine. We can use at all the times. we can get system defined message i. it reads the records from the data base file based on ind icator specified on HI position. then only CALL statement will execute. Example: a new and unique customer number is generated whenever a new customer i s added to customer master file. 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. In the other hand. . when the same file of type " U" used in different programs. Through program we can access new customer number. 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. the control transfers after ENDDO statement. Otherwise. e . How do you set the keywords SFLSIZ and SFLPAG if you want the subfile to dynamic ally expand? Ans:SFLSIZ > SFLPAG.

List some of the commonly used commands for debugging Ans:STRDBG(for batch jobs). If the file ORDHDR does exist. it may or may not contain data d. variable to store the number of characters to be sent. DOUxx : Irrespective of condition. Define the RCVF command? Ans:RCVF command used to receive the records either from the data base file or d evice file. The file ORDHIST may or may not exist c. Define the purpose of the LEAVE operation? Ans:If you specify LEAVE. The format is *MDYY (MMDDYYYY). it will execute at least one time. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *ADD d. The format is *MDY (MMDDYY). Copy data from the file ORDHDR into file ORDHIST b. CPYF FILE(ORDHDR) TOFILE(ORDHIST) b. library in which data queue exists. STRISDB.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. then only the group of instructions a llowed executing. and these are further used in C-spec. Describe the difference between the DOWxx and DOUxx operations? Ans:DOWxx : If the condition becomes true. What is the difference between UDATE and the system date? Ans:UDATE supports two-digit year. Define the purpose of the ITER operation? Ans:If you specify the ITER. CPYF FILE (ORDHDR) TOFILE (ORDHIST) CRTFILE (*YES) c. We can send the same data queue to the many programs. variable t o store the information to be sent. *DATE (system date) supports four digit year. The file ORDHIST may or may not contain data. Define the purpose of the *BCAT function? Ans:To concatenate the two strings by placing a single blank in a resultant. CPYF FILE (ORDHDR) TOFILE (ORDHIST) *REPLACE What is the purpose of the following? . Define the purpose of the %SST function? Ans:To extract the information from the specified string. the control transfers to the statement below the ENDDO . if the file does contain data t he old data should be erased Ans:Commands are as follows a. the groups of statements are allowed to execute rep eatedly. 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. List the steps/commands necessary to accomplish the following: a. Define the purpose of the *CAT function? Ans:To concatenate the two strings into a one string.

the program will not compile. $2SFN is a relative record number and FMT2 is nam e of the subfile record format. Purpose of renaming is: If the record format name is similar in two files and if both are used in a same program. What is the purpose of the following Ans:C/COPY QRPGSRC. we can use the above steps.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.FORDHDR1 IF E K DISK ORDHDRF KRENAMEORDHDRF1 Ans:In order to rename the record format of a data base file in a program. What is the purpose of the following Ans:FORDHDR1 CF E WORKSTN $2SFN SFILE FMT2 The above line indicates that. Hence we have to rename ei ther of the file. .

Sign up to vote on this title
UsefulNot useful