Thursday, December 16, 2010

All Interview.Com

 
Define Subsystem and types of subsystems?
Subsystem is nothing but it provides specialized environment to complete the execution of jobs. QBATCH, QINTER, QSPL, QCMN, QCTL, QBASE.
 
What is Batch Job?
* 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.
 
What is 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. 
 
Describe about Query/400?
WRKQRY
 
 
 
 
 
 
What is the basic purpose of Overrides / OVERDBF (*YES)?
 
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.
 
What is purpose of Data Structure and types of Data Structures?
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.
 
* 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 purpose of DYNSLT keyword?
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.
 
What is the difference between access path and Dynamic select?
 
Dynamic select occurs whenever the program reads file. But access path occurs before the file is read (but not necessarily). Because access path maintenance performed on the file.
 
Why would you prefer OPNQRYF than logical file?
The main difference is : Logical file creates permanent object on the system. OPNQRYF creates temporary access path.
 
The physical file you are working with very large, creating and using a logical 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 the purpose of the keywords FIFO, LIFO, FCFO?
 
These keywords are used at file level. The purpose of each one is described below: FIFO: The duplicate key records will retrieved in first in first out order. LIFO: The duplicate key records will retrieved in last in first out order. FCFO: The duplicate key records will retrieved in first changed first out order.
 
What is the difference between regular logical file and join logical file?
 
Regular logical file contains more than one record format. Record format name in regular logical file should be same based on the physical file. Join logical file contains only one record format. Record format name in join logical file should be different. Through logical file we can made changes in physical file. Through join logical file we can't made changes in physical file.
 
Distinguish between logical file and physical file?
 
Physical file contains only one record format. Logical file contains more than one record format. Physical file contains actual data. Logical file doesn't contains data but it provides view from the physical file.
 
What is field reference file?
Field reference file is a file, which contains field definitions and descriptions, and it doesn't have member. Physical contains data derived by the field reference file.
 
What is the necessary keyword used in a physical file to refer field definitions from the field reference file?
 
REF which is a file level keyword is necessary to define at file level in a physical file. The syntax is as follows: REF(library name/name of the field reference file)
 
 
 
What is the purpose of CHGPF (Change physical file) command?
CHGPF command is used to change the attributes of a physical file. Attributes like * Maximum number of members * Member size * Level check enforced * Open data path is shared
 
 
What is the purpose of SFLNXTCHG keyword in a subfile?
Which is a subfile record format keyword. If you perform read on the subfile, the internal indicator MDT (modified data tag) is automatically set off by the system. If you again perform read on the same records, records won't be read. Because internal indicator MDT would be off. Hence you should be explicitly set on the MDT by SFLNXTCHG keyword.
 
 
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.
 
 
What are the different types of access paths maintained on the file?
Immediate: All the access paths (open and close) associated with a file will be updated whenever changes made to a file. Rebuild- only open access paths will update whenever changes made to the file. Rebuild takes place whenever remaining access paths will be open. Delay : Rebuild will not takes place.
 
 
What is the difference between production library and test library ?
 
In debug mode, the files exists in production library not allowed to update. In the other hand, the files exists in test library allowed to update.
 
What is message subfile?
Message subfile is special file contains multiple messages taken from program message queue and placed in message sub file for display on the screen.
 
 
What are necessary keywords to code message subfile?
SFLMSGRCD, SFLMSGKEY, SFLPGMQ
 
 
What is the difference between SETON LR and RETRN
If you specify SETON LR, all the files used in program will be closed. If you specify RETRN, all the files used in program will remain open.
 
 
 
When will you use OPEN and CLOSE op codes in RPG program?
If you specify the letter "U" at columns 73 - 74 in a file description specification indicating that user control on a file. Hence we have to explicitly open and close the file in a program.
 
 
What is the difference between externally described file and program described file?
 
The field definitions and descriptions are defined out side of the program in a externally described file. The field definitions and descriptions are defined in side the program in a program described file.
 
What is the difference between externally described file and program described file?
 
The field definitions and descriptions are defined out side of the program in a externally described file. The field definitions and descriptions are defined in side the program in a program described file.
 
 
What is the purpose of SFLFOLD and SFLDROP keywords?
 
SFLFOLD: To fold the second line of multiple line subfile. 
 
SFLDROP: To drop the second line of multiple line subfile.
 
 
 
 
What is the function of DSPATR (display attributes) keyword?
Use this field level keyword in display file to specify one or more display attributes for the field you are defining. You can specify the DSPATR keyword more than once for the same field, and you can specify more than one attribute for the same keyword. The following are valid attributes: For All Fields Display Attribute Meaning BL Blinking field HI High Intensity RI Reverse Image CS Column separator ND Non Display PC Position cursor UL Underline For Input-Capable Fields Only PR Protect contents of field from input keying MDT Set modified data tag when displayed OID Operator identification SP Select by light pen
 
What is the purpose of PUTOVR (Put with explicit override) keyword?
 
Use this record-level keyword to permit the override of either display file attributes or data contents of specific fields within a record displayed on the work station device.
 
What is the purpose of OVRDTA (Override Data) keyword?
Use this field level keyword with PUTOVR keyword to override the existing the data contents of a field already on the display.
 
 
What is the maximum number of record formats in DSPF? 
1024 (One thousand and twenty four) 
 
What is the maximum number of fields under a record format of physical file? 
8000 (eight thousand)
 
What is the maximum number of parameters allowed in RPG? 
255 (Two hundred and fifty five) 
 
What is the maximum number of parameters allowed in CLP? 
43 (Forty three) 
 
What is the maximum number of subroutines allowed in RPG? 
254 (Two hundred and fifty four) 
 
What is the maximum number of files allowed in RPG? 
(Fifty including eight printer file) 
 
What is maximum number of Arrays allowed in RPG? 
250 (Two hundred and Fifty ) 
 
Where can you specify an indicator in LOKUP operation? 
In 'EQ' position. 
 
What is a Member? 
It is a subset of data records of a physical file. 
 
What is a Physical file? 
Physical file nothing but a table contains a only one record format in which we can describe the field definitions and descriptions. 
 
What is a Logical file? 
It is nothing but a logical view provided by the physical file. 
 
What is Join Logical file? Join logical file joins more than one file. 
The maximum of number of files allowed to join is 32 (thirty two).
 
What are the necessary keywords for the Join Logical file? 
JDFTVAL, JFILE, JOIN, JFLD, JREF. 
 
What is a Non-join logical file? 
It only provides logical view based on the physical file. This is also called as regular logical file. 
 
What is the necessary keyword for Non-join logical file? 
PFILE (which is record level keyword) 
 
How many levels are there in a Physical file? 
Four levels. 
They are File level, Record level, Field level, Key field level. 
 
What is the use of UNIQUE keyword and what level it is defined? 
It will avoid to enter duplicate key values. We have to define it in a file level. 
 
At what level S,O are defined and what they will do? 
S, O are to defined at key field level. The purpose Select/Omit logic is depends on the criteria (condition) given at the key field level (At function entry) it selects and omits the records. The S/O is allowed in Logical file only. 
 
What is the difference between Packed decimal and Zoned decimal? 
Packed decimal : One digit occupies 1 byte. 
Zoned decimal : One digit occupies 2 bytes. 
 
What is default data type (if you define decimals '0') in Physical file? 
Packed decimal 
 
What is default data type for the fields(sub fields) defined in data structures in RPG? 
Zoned decimal 
 
What is the use of JDFTVAL in join logical file?
If you specify JDFTVAL at file level, even the primary file record does not match with secondary file record, the join takes place. 
 
Is it possible to create a physical file without DDS?
Yes. With the help of CRTPF we can achieve this. But we have to give record length. 
 
What is a Keyed physical file? 
Defining a field as a key in physical file. Hence we can access records through the key field. 
 
What is a composite key? 
Defining more than one key as a key field in physical file. 
 
What is arrival sequence? 
The records will be accessed the way in which records are added to physical file. 
 
What is the maximum number of key fields allowed defining in a physical file? 
120 
 
What is acronym of RPG? 
Report Program Generator 
 
What is the native language of AS/400? 
RPG/400 
 
Why RPG/400 is famous? 
* Easy to code and analyze. 
* Supports externally described files. 
 
 
 
 
How many specifications are there in RPG/400? What are they? 
 
There are seven specifications are exits in RPG/400. They are listed below: 
* Header Specification 
* File Description specification 
* Extension specification 
* Line counter specification 
* Input specification 
* Calculation specification 
* Output specification 
 
When do you use F-spec. continuation line ? 
* In order to refer the named record format as a subfile record format in the program. 
* In order to rename the record format of a database file in a program. * In order to define a named data structure as a file information data structure. 
 
What are the various types of device files? 
Display files, printer files, discket files, tape files etc.
 
When do you explicitly open files and close files in an RPG program? 
If you specify the letter ' U ' at column 73-74, you need to be open and close files explicitly in a RPG program. 
 
How do you know that records are locked? 
By using a command WRKOBJLCK. 
 
What is the purpose of Indicators in RPG? 
In order to control the logic flow, we can use indicators in RPG. 
 
How do you read data area in an RPG program? 
With the help of 'IN' opcode, we can access the data area record in to the program. 
 
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 are various techniques to pass parameters from one program to another? 
PLIST, CALL, TFRCTL 
 
Which single RPG opcode performs both SETLL and READE? 
CHAIN 
 
What is term CUA , SAA? 
Common User Access System Application Architecture 
 
Why is AS/400 called Object Oriented Machine? 
Everything on the AS/400 System that can be stored and retrieved is contained in the object. 
 
What is the version of OS/400 that we have? 
V4R2 (Version 4. 0 Release 2. 0) 
 
What is DDM ? 
Distribution Data Management is a function of the OS/400 that allows an application program or user on one system to use database files stored on remote system. 
 
What is an Object? 
An object is any thing that exists in and occupies space in storage and on which operation can be performed. 
 
How are the objects stored on AS/400? 
All objects are stored on AS/400 in a single level storage. In this method all objects are referenced by one virtual address which is translated in to a physical address whether it is an auxiliary storage or main memory. 
 
What is a Library in AS/400?
A library in AS/400 is an object that serve(acts) as a repository for other objects. 
 
Name few IBM supplied libraries? 
QGPL, QTEMP, QSYS, QUSRTOOL, QCBL, QRPG 139. 
 
What is library list ?
A list that indicates libraries used for the process and the order in which it has to be searched System identifies it in *LIBL. 
 
How many libraries can be there in library list ? 
Total 40 (15 system and 25 application) 
 
What is Folder? 
A Folder is a named object that is used as a directory for documents and other folders. Folders can be filed with in another folder. 
 
What is Spool file, Why is it required? 
A file that holds output data to be processed, such as information waiting to be printed. 
 
What is Job, What are the attributes of a Job? 
A Job is a basic unit of work on AS/400. 
The attributes are: Job Number Unique system generated sequential number Job Name Any user defined name (Max 10 char) User Name Who initiated the job. 
 
What is Job description? 
A Job description defines an environment in which a batch job or an interactive job to be executed. 
 
What is the difference between Interactive & Batch Job? 
Interactive Job: A Job started for a person who signon to a workstation. 
Batch Job : A predefined group of processing actions submitted to the system to be performed. 
 
What is Group Job? 
A Group Job is attached to one workstation and a user. There should be an initial group job and it can be branched to many other group jobs. The group jobs can have different library lists and different output, message queues. Group Job is useful in enhancing the programmers productivity. It is as though logging into the same user-id many times. 
 
What are the two main attributes, which govern the execution of a job? Run time priority and Time slice 
 
What is Sub-System? 
Sub-Systems are specific user defined partitions of the CPU where various jobs may be executed. One subsystem can have more than one active job at a time.
 
What is a Device file? 
A device file contains the description of how data is to be presented to a program from a device or vice versa. Device file can be Printer, Disk, Tape and Remote system. 
 
What is an ICF file? 
A device file that allows a program on the system to communicate with program in other system.
 
What is a message file? 
It is a file which contains the messages of an application. For example all RPG/400 messages are stored in a file, all COBOL/400 messages are stored in a file. 
 
What is a job log? 
A record of request submitted to system be a job. The message related to the requests, and action performed by the system on the log. The system program maintains it. 
 
What is the purpose of OPNQRYF (Open Query File)? OPNQRYF is used to select certain records of the database file based on the QRYSLT (Query select ) condition. 
 
How to create files dynamically without DDS?
Through OPNQRYF 
 
What command must be executed before executing OPNQRYF command? 
OVRDBF (Override Data base file) 
 
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.
 
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. 
 
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. 
 
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. 
 
How to create a user defined (general) data area? 
Using CRTDTAARA command 
 
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 
 
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. 
 
 
 
How to create a data queues? 
Using CRTDTAQ command. 
 
What are the valid data types in Data Queue? 
Char, Numeric, and Logical 
 
What are the two types of read performed on data queues? 
Read with lock, and read without lock. 
 
How do you use DEBUG utility? 
STRDBG program-name UPDPROD(*YES) 
 
What is an authorization list? 
A lists of two or more user Ids & their authorities for system resources. The system identifies it an object type *AUTL 
 
How do you grant authority? 
Using GRTOBJAUT command 
 
What are the types of object authorities? 
*USE, *CHANGE, *ADD, *DLT, *READ, *UPD, *ALL, *EXCLUDE, *OBJEXIST, *OBJMGT, *OBJOPR 
 
How do you put jobs in batch mode? 
SBMJOB 
 
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. 
 
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.
 
How to change file attributes such as size, file wait time, record wait time etc. , permanently? 
Using CHGPF command 
 
What is the use purpose of CRTCMD? 
To create user defined command. 
 
What is class of service ? 
A set of link and node characteristics associated with a session. 
 
How to see active jobs of the system. 
Using WRKACTJOB command 
 
How do you detect unused spool storage? 
Using Reclaim Spool Storage. 
 
What are the functions of Remote Job Entry (RJE) ? 
Allows user of AS/400 system to submit jobs and receive jobs from a host system. 
 
What is the function of RJE Conversion Utility? 
It converts compressed data written to an AS/400 database file to decompressed data written to another AS/400 database, diskette, or device file. 
 
What process the command SBMRJEJOB does? 
Sends RJE input stream to host system 
 
What is journaling & Commitment Control? 
Journaling is a function which records the changes in a file in a journal. These record images are used to recover the changes in the file should the system ends abnormally. Commitment control is a function that allows you to define and process a number of changes to database files as a single unit (transaction). 
 
What is the purpose of STRCMTCTL command? 
Starts commitment control for files that are being journalled. 
 
What are the system objects required for journalling? Journal receiver, journal and PFs to be journalled. 
 
What are the different definition levels in Data Description Specifications? File level, Record level, Field level, Join level, Keyfield level, Select/Omit level. 
 
What the difference between Source Physical File and Physical File? 
A Source Physical File contains the source for the various objects created this file has specific structure. A Physical File contains data, and the record format can be different for different physical files. 
 
What is an access path? 
The order in which the database fields are organized for processing in the program. 
 
What are all the different types of access path? 
Arrival sequence access path. Keyed sequence access path. 
 
What is the default value for the number of increment for the physical file? Three 
 
When does the DFT keyword in PF be used? 
To specify the default value it a field. 
 
What is Multi-format logical file? 
Logical which uses fields from two or more physical files. 
 
What is the Select and Omit criteria in logical file? 
This is used to specify rules for the Selection/Omission of records from a Physical File. 
 
Can fields be concatenated INa logical file level? 
Yes. by using CONCAT keyword 
 
When would the ALL keyword be used? Use with Select or Omit, to select/omit records. 
 
What are the different types of keywords in display files? 
File level, Record format level, Field level 
 
What is the maximum number of records you can specify in a display file? 
1024 
 
How can a screen field that has changed since the last output operation be detected ? 
Attach the MDT (modified data tag) attribute to the field, to detect whether field has been changed as a result of user input. 
 
What would be the effect on the field where reverse image, underline and highlight display attributes were active? 
The result is same as if you had specified ND. 
 
What is the use of DSPATR(MDT) keyword? 
Sets on the modified Data Tag of the field. The Data Tag detect whether the field has been changed as a result of user input. 
 
If DSPATR(PC) and CSRLOC were specified for a format, which keyword would have priority? 
CSRLOC gains priority. 
 
Can error messages as a result of a COMP, RANGE or VALUES keyword be overridden? 
Yes, through CHKMSGID keyword. 
 
What the purpose of OVRDTA, OVRATA keywords?

OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display. OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display.
 
How can a message from a message file appear as a constant on the screen? 
By using MSGCON (message constant) keyword. 
 
In conjunction with what other keyword must OVRDTA and OVRATA be used? PUTOVR keyword must used. 
 
What is the purpose of the INDARA keyword? 
This File-level keyword is used to remove option and response indicators from the buffer and places them in 99- byte separate indicator area. 
 
Explain the purpose of KEEP and ASSUME keywords? 
KEEP: Keep the display from being deleted when the display file is closed. 
ASSUME: It is used to specify that the OS/400 program is to assume that this record is already shown on the display when this file is opened. 
 
Explain the use of DFTWRT display keyword? 
No records will be displayed until there is any I/O operation. 
 
 
 
What is the purpose of FRCDTA keyword ? 
Immediately display a record format without waiting for the next I/O operation. 
 
What keyword must be used with PROTECT keyword? 
OVERLAY 
 
What is Subfile? 
Subfile is group of records of same record format and can be read from or write to the display in a single operation. 
 
What are all the contents of subfile? 
Subfile Record Format, Subfile Control Record Format, Relative Record Number, Subfile Record Number, Associated Subfile Keywords. 
 
What are the two record formats a subfile contain ? 
Subfile record forma (SFL), and subfile control record forma (SFLCTL). 
 
What is SFLPAG and SFLSIZ ? 
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen. 
SFLSIZ : it is an attribute which specifies the number of records can be stored in subfile. 
 
 
What is the maximum number of subfiles that can be specified in a display file?
512 
 
Maximum number of subfiles that can Defined in a RPG program for one display file is: 24 
 
Maximum number of subfiles that can be active for a single file is? 
12 
 
Can more than one subfile record be displayed on one line? 
Yes, by using SFLLIN keyword. 
 
How do you specify the number of records to roll in a subfile? 
Use SFLROLVAL keyword in DDS along with number, which specifies the number of records to scroll at a time. 
 
How will you display a particular page in subfile? 
Move a valid relative record number (RRN) in the field specified using SFLRCDNBR keyword in DDS. 
 
How to pick up the changed records every time in a subfile after the first change made? 
Seton SFLNXTCHG keyword indicator and update the subfile record. 
 
What is the use of SFLEND keyword? By specifying this keyword, the Bottom/More message could be displayed at end of screen. 
 
How to toggle between single line and Multi - line display of a particular record in a subfile? Using SFLDROP keyword. 
 
Explain the difference between defining Subfile and Message-subfile? Subfile record is defined by SFL keyword, where as Message subfile is defined by SFLMSG keyword. 
 
What are the different types of variables available in CL? 
DEC, CHAR, LGL 
 
How do you pass parameters in CL? 
Using PARM keyword. 
 
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. 
 
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) 
 
What is the maximum length of a variable name in CL? 
Maximum 11 characters (including '&') 
 
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. 
 
What is the use of Header Specification in RPG/400?

It identifies by H in column 6, provides informaion about generating and running programs.
 
When will DUMP and DEBUG opcodes be ignored? 
If blank is specified in position 15 of H specs. 
 
Specify different indicators used in RPG? Overflow indicators Record Identifying Indicators Field Indicators Resulting Indicators Control Level Indicators 
 
What are Control level indicators? 
L1 to L9 used to identify certain fields on control fields and then used to condition which operations are to be processed at detail or total calculation or output time. 
 
What is the use of E specification in RPG? 
Extension Specs describes all record address files, arrays and tables. 
 
What is the use of L specs in RPG? 
Line counter specification can be used to describe printer file to indicate the length of the form and number of lines per page. 240. In which specification the report layout can be defined? O Specification. 
 
 
How many files can be defined in F specs? 
50 
 
How many printer files can be defined in F specs ? 
8 
 
Give three main purposes of File specification ? 
To define files, to describe the files, to assign the files to specified devices. 
 
How do you specify page overflow indicator for printer files in RPG? Specify an indicator in position 33-34 of F specification. 
 
What is a Primary File? 
It is used in RPG Program Cycle to automatically read records in a cycle.
 
Can a indexed file be accessed in arrival sequence in RPG program? 
Yes. 
 
What is a Program Described file in RPG?
The field name and length of the fields are defined with in the RPG program. 
 
What is externally described file ? 
All information about the fields is specified in DDS and the RPG program can use them with in the program. 
 
Can you specify a display file to be used in the following modes Input, Output, or Combined modes ? Yes. 
 
What is match field indicator? 
Matching record indicator is seton when all the matching fields in the record of a secondary file matches with all the matching fields of a record in a primary file. 
 
What is the length of a variable in RPG? 
6 Characters. 
 
When is a TAG statement used in RPG? 
It is used as Label. 
 
What opcode could be used to test an alphanumeric field for all numeric values? 
TESTN 
 
What opcode will be used to test the zone of a character field? 
TESTZ 
 
How to read database records without locking them? 
Put 'N' in position 53 of C specs. 
 
What does CHECK opcode is used? 
The check operation verifies that each character in the base string (factor 2) is among the character indicated in the comparator string (factor 1). 
 
What does 'SR' in columns 7-8 of C specs mean? Calculation operation is a part of RPG subroutine. 
 
What is SCAN and XLATE? 
SCAN operation scans a character string (base string) contained in factor 2 for a substring (compare string ) contained in factor 1. XLATE operation translates characters in source string (factor 2 ) to the from and to strings (factor 1 ) and put into the result field. 
 
How do you use commitment control in RPG program ? 
Using COMIT operation. Makes all changes to the files that have been specified in output operation since the previous COMIT or the begining of operations under commitment control(if there has been no previous COMIT or ROLBK operation). 
 
How do you use exceptional write in C specs? 
Using EXCPT opcode. 
 
What does the opcode FREE do? 
The FREE operation removes a program from the list of activated programs, frees static storage and ensures program initialization (first cycle processing) the next time program is called. It does not close file or unlock data area. 
 
What does opcode POST do? 
Puts information in INFDS. 
 
What is the maximum number of elements in an array? 
9999 
 
Can we define Multi-dimensional arrays in RPG? 
No. 
 
What is XFOOT opcode? 
Adds all the elements in a numeric array, and places the sum in the result field. 
 
How can we sort an array? 
By using SORTA opcode. 
 
How can the user implicitly open and close the files in RPG program ? Enter UC in position 71-72 of F specs. Use OPEN and CLOSE opcodes in RPG program to open and close files. 
 
How many parameters can be defined in a RPG program. ? 
255 269. 
 
What is File Information Data Structure? 
File Information Data structure (INFDS) can be defined for each file to make file exception/error information available to the program. A file information data structure contains predefined subfields that identify: the name of the file for which the exception/error occurred. the record being processed when the exception/error occurred or the record that caused the exception/error. The last operation being processed when the exception/error occurred. The status code. The RPG routine in which the exception/error occurred. 
 
What is Program Status Data Structure? 
A Program status DS can defined to make program exception/error information available to an RPG program. DS is defined as program status DS by an S in position 18 of the DS statement. *STATUS contains status code. *ROUTINE : contains name of routine in which the exception/error occurred *PARMS : contains the number parameters passed to this program from the calling program. 
 
What is the maximum number of times Multiple Occurrences DS can occur in a program? 9999 
 
What are all the compiler directive statements? 
/TITLE, /SPACE, /EJECT, /COPY 
 
What is SAA? 
Systems Application Architecture (SAA) is a collection of selected software interfaces, conventions, and protocols that will provide a consistent framework across the System/370, AS/400 and PS/2. 
 
During execution, an RPG/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps. 1. reading input (READ) 2. processing calculations (PROCESS) 3. writing output (WRITE) **********************************************************************
 
What is the Function of PDM? 
Productivity tool for copying, deleting, scanning, changing & creating source files. 
 
What is the function of SEU ? 
A utility for editing programming language source code. 
 
What is the use of SDA ? 
Screen Design Aid is used to create display files interactively. 
 
What is a library in AS/400 ? 
Library in AS/400 is an object that serves as a repository for other objects. 
 
Name few IBM supplied libraries ? 
GPL, QTEMP, QUSRTOOL, QSYS, QRPG & QCBL. 
 
What is a library list ? 
Library list that indicates libraries used for the process and the order in which it has to be searched. System identifies it in *LIBL. 
 
How many libraries can be there in a library list ? 
Total 40 (15 system and 25 application). DDS - Data Description Specification. Source Physical File contains the source for the various objects created. This file has a specific structure. RPG, CLP, DSPF, PRTF, etc. A-spec UNIQUE, PFILE, REFFLD 
 
What is the difference between Physical and Logical files ? 
Physical file contains data, where as Logical file serves as a access path to database. 
 
 
 
What does the keyword UNIQUE mean ? 
Records with duplicate key values are not allowed. 
 
What is FCFO, FIFO, LIFO in Database environment ? 
These are file level keywords which are used to access the records in the order FCFO : First Changed First Out FIFO : First In First Out LIFO : Last In Fist Out 
 
How many record formats can you have in a Physical file and in a Logical file ? 
Physical file can contain only one record format, Logical file can contain more than one record format. 
 
What is Multi-format logical file ? 
Logical which uses fields from two or more physical files. 
 
What is keyword PFILE specifies ? 
PFILE is used define the Physical file being referenced. 
 
What is a Join Logical File, Can it be used for Update ? 
Logical file that combines more than one physical file. Update is not possible through JLF. 
 
Is it possible to join the same file to itself ? 
Yes. 
 
What does SDA stands for ? 
Screen Design Aid. 
 
What is the symbol used for defining a new field in SDA? 
'+'. 
 
What is the symbol used for shifting fields in SDA? 
'<' , '>'. 
 
What is the symbol used for copying & moving new field in SDA? 
Copying : '-' & '=='. Moving : '-' & '='. 294. 
 
What is the symbol used to get name & length of a field in SDA? 
'?' . *DATE, *TIME. 
 
How can a screen field that has changed since the last output operation be detected ? 
 
Attach the MDT attribute to the field, to detect whether field has been changed as a result of user input. 
 
What would be the effect on the field where reverse image, underline and highlight display attributes are active ? 
The result is same as if you had specified ND. 
 
What is the purpose of OVRDTA and OVRATA keywords ? 
OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display. OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display. 
 
What keyword must be used with PROTECT keyword ? OVERLAY 
 
What is RPG ? 
Report Program Generator. 
 
What are the different types of specification available in RPG/400 ? Control Spec.( H ) 
File Spec.( F ) 
Extension Spec.( E ) 
Line counter Spec.( L ) 
Input Spec.( I ) 
Calculation Spec.( C ) 
Output Spec.( O ) 
 
Is it necessary to define all formats ? Which are mandatory and which are Optional ? 
No, all are Optional. 
 
What is the use of E specification in RPG ? 
Extension Specs describes all record address files, arrays and tables. 
 
In which specification can a report layout be defined ? 
O Specification. 
 
How many files can be defined in F specs ? 
A maximum of 50 files. 
 
Can an indexed file be accessed in arrival seQuence in RPG program ? Yes. 
 
In which specification Data Structures can be defined? 
I - Spec. 
 
When is a TAG statement used in RPG ? 
It is used as a Label. 
 
What are the different Opcodes available in RPG for Database access ? 
READ, CHAIN, WRITE, UPDAT, DELET, SETLL, SETGT, READE, READP, REDPE, OPEN, CLOSE, FORCE, NEXT, UNLCK. 
 
How can database records be read without lock ? 
Put 'N' in position 53 of C specs. 
 
What does CHECK opcode do ? 
The check operation verifies that each character in the base string (factor 2) is among the ` character indicated in the comparator string(factor 1). 
 
In conjunction with which statements can ORxx and ANDxx conditions be used ? 
DOUxx, DOWxx, IFxx, and WHxx. 
 
What does opcode POST do ? 
Puts information in INFDS. 
 
Can you have multiple key lists for a single file ? Yes.
 
What are the different types of arrays available in RPG ? 
Pre-execution time array. 
Compile time array. 
Execution time array. 
 
Can we define Multi-dimensional arrays in RPG ? 
No. 



What is XFOOT opcode ? 
Adds all the elements in a numeric array, and places the sum in the result field. 
 
During input operation which indicator position is seton if there is a record lock? LO indicator position is seton. 
 
What is the difference between *LIKE and *NAMVAR ? 
*LIKE defines the variables as in database. *NAMVAR is used to define variables as data area. 
 
Where will control be passed after the execution of the *PSSR subroutine if the factor2 of the ENDSR is blank ? 
Control will return to the next sequential instruction. 
 
What is the maximum number of subfiles that can specified in a display file ? 
512 The maximum number of subfiles that can defined in a RPG program for one display file is ___
 
The maximum number of subfiles that can be active for a single file is ____ . 12 
 
 
 
What are the different opcodes used for file operation on a subfile in a RPG pgm? 
READ, READC, CHAIN,UPDAT and WRITE 
 
How will you display a particular page in subfile ? 
Move a valid relative record number(RRN) in the field specified using SFLRCDNBR keyword in DDS. 
 
Can a single screen format occupy a screen area above and below a subfile format ? 
Not possible. 
 
What is SFLPAG and SFLSIZ ? 
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen. SFLSIZ : it is an attribute which specifies the number of records can be stored in the subfile. 
 
How to pick up the changed records every time in a subfile after the first change made ? 
Seton SFLNXTCHG keyword indicator and update the subfile record. 
 
How do you specify the number of records to roll in a subfile ? 
Use SFLROLVAL keyword in DDS along with the number, which specifies the number of records to scroll at a time. 
 
What are the three line types in RLU ? 
Report line, Filler line & Sample line. 
 
What is the function of RLU ? 
To design & prototype a report. 
 
What are the three types of keywords associated with printer file ? File level, Record level & Field level.
 
How do you combine two record formats in RLU ? 
Using CLC. 
 
What are the different commands used in RLU ? 
DR - Define Record, 
CLC - Change Line for Continuation, 
CLR - Change Line for Record, 
SD - Create Sample Data, 
VF - View Fields, 
NP - New Page, 
DC - Define Constants, 
DF - Define Fields, 
CF - Centre Fields 
SP - Space Fields evenly. 
 
What is the command used to invoke RLU ? 
STRRLU. 
 
What are different record spacing keywords in RLU ? 
SKIP and SPACE

How to add 10 days in current date in CL program...?

PGM        
DCL      VAR(&DATE) TYPE(*Char) Len(6) 
RTVSYSVAL  SYSVAL(QDATE) RTNVAR(&DATE)                      
ADDDATE    DAYS(10) TOVAR(&DATE) TOVARFMT(*SYSVAL) + 
              DATEFMT(*SYSVAL)  
ENDPGM

How to define more than One File in CL and READ a file in CL ?
In V5R4M0 , we can declare 5 files in CL-ILE pgm
 
DCLF  (FILE1) OPENID(OP1_)
DCLF  (FILE2) OPENID(OP2_)
DCLF  (FILE3) OPENID(OP3_)
DCLF  (FILE4) OPENID(OP4_)
DCLF  (FILE5) OPENID(OP5_)
 
DCL &LGL *LGL VALUE('1')
 
DOWHILE (&LGL = '1')
 
RCVF  (RCDFMT_FILE1) 
 
MONMSG     MSGID(CPF0864) EXEC(LEAVE)
 
OPERATIONS
 
ENDDO
 
SIMILAR TO ALL 4 FILES....
 
Specify two DCLF for the same file  with 2 different 
openID's sayID1 and ID2
Tjen do RCVF on the file with open ID ID1 do the 
processing, upon EOF then issue a 2nd RCVF for open ID2
 
the 1st record will be available.
Here's an example
 
DCLF       FILE(FILE1) OPNID(ID1) 
DCLF       FILE(FILE2) OPNID(ID2)
  
RCVF:       RCVF       RCDFMT(FILE1) OPNID(ID1) 
MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(XYZ))
 
 
 
  GOTO RCVF
 
XYZ:
            RCVF       RCDFMT(FILE2) OPNID(ID2) 
MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
 
  GOTO XYZ
 
END:
ENDPGM
 
 
POSDBF and OVRDBF can only position the file at the desired 
location if the file hasn't reached EOF yet. If the file is 
already at EOF, then thesekeywords won't help you in 
positioning the cursor.
However, there is one keyword recently added to the CL 
commands and that is 'CLOSE'. After the file is at EOF 
mark, you can close it by using this keyword and the next 
RCVF keyword will retrieve the first record again, or u can 
position the cursor anywhere using POSDBF or OVRDBF.
 
 
How to UPDATE a PF in CL?
Use of RUNSQLSTM helps in updating the physical file within 
a CL program.
 
Syntax:
 
RUNSQLSTM SRCFILE(LIB/QSRCPF)SRCMBR(SQLPGM)COMMIT(*NONE)
 
SQLPGM should contain
 
UPDATE PF set DATA='Value' where DATA'='Value1' and it will 
update the PF
 
We can not update a database file through CL in a normal 
way but if we use QSH then we can update or insert. Here I 
am showing a example of insert. 
 
QSH        CMD('db2 "INSERT INTO KATIYAR1.TESTPF + 
             VALUES(13,''Urvashi'')" ')            
 
Where KATIYAR1 is library and TESTPF is file. 
 
 

How can I check the object existence in RPG program without using QCMDEXC command?
 
In RPG, QUSRTVOBJD API can be used which has procedures like ChkObj and ChkMbr. A CL program can be called that checks the existence of object and returns some indicator to for found/not found.
 
Without using QCMDEXC , Go for RPG Free format
 
 /Free                     
    MONITOR;               
    Open emp1;             
    ON-ERROR 1217;    
     Dsply ' File not found'
    return;                
    ENDMON;                
 /END-FREE
 
 
What are activation group and what are its types?
 
Provides run time environment to support execution of the program. 
 
Activation group can be *New, *Caller, Name.
 
ACTGRP(*NEW) -  When the program gets called, a new 
activation group is created.  This called program is then 
associated with the newly created activation 
group.              
 
ACTGRP(*Caller)- When the program gets called, the program 
is activated into the caller's activation group.
 
ACTGRP(Name)- Specify the name of the activation group to 
be used when this program is called.
 
 
Note: *New and *Caller will be deleted automatically once the job 
is over. To delete the *Name you have to perform RCLACTGRP cmd.
 
How can we read PF in reverse order (end to start) in CL pgm?
 
First needs to do OVRDBF on the file. Then read a physical file in DESENDING ORDER. You can first sort the physical file in descending order through OPNQRYF using KEYFLD. This will sort your PF in descending order based on your key field and then do the RCVF on this 
file.
 
Why did we give STRSRVJOB and what use of the same while debugging batch program?
 
The Start Service Job (STRSRVJOB) command starts the remote 
Service operation for a specified job
 
Any dump, debug, and trace commands can be run in that job until service operation ends.  Service operation continues until the End Service Job (ENDSRVJOB).
 
 
What would be the result on writing a data record to a PF file using the "WRITE" opcode after the SETON *ON *INLR statement?
 
Write statement will get executed successfully and record 
will get added in the file. Program execution continues til 
the last line of C specs.
 
Therefore it is good practice to use RETURN after SETON LR.
 
 
 
I have a PF(ABC)with no key fields. PF(ABC)have 2 fields (cusno and cusname).Please let me know how can i read the cusno = 1150 directly 
from PF in CL and RPG program(Without creating the LF and without reading the complete file and then compare 1150).
 
 
In CL program:
Ovrdbf and opnqryf
 
In RPG Program:
SQLRPGLE
 
 
How to define keyed file in CL pgm and How can i read particular records in CL pgm from database file.
 
1. Using DCLF command 
2. OVRDBF with Position parameter
DCLF FILE(&FILENAME)
 
OVRDBF FILE(&FILENAME) POSITION(*KEY 1 FMT2 X'123F')
 
The system searches for a record from the record format 
FMT2. 
A single key field is used in the search (even though the 
key value may have more key fields). 
The record contains the hexadecimal value 123F (the 
hexadecimal equivalent of packed decimal value 123.0). You 
get this record when it is found.
 
How we create binder member for updating service program and where we type this code on command line or in program?
   
   strpgmexp pgmlvl(*current)
   export    symbol (xyz0
   endpgmexp.
 
Please explain me this step by step.
We write a program Of Source Type BND and write the code 
inside it like..
 
strpgmexp pgmlvl(*current)
   export    symbol (xyz0)
endpgmexp.
 
 
Suppose later date you want to add another procedure say
(xyz1),you can do by 
strpgmexp pgmlvl(*current)
   export    symbol (xyz0)
   export    symbol (xyz1)
endpgmexp.
 
strpgmexp pgmlvl(*Pre)
   export    symbol (xyz0)
endpgmexp.
 
In this way, we don't need to compile the other programs 
which are using this service program cause this binder 
contains both types of Signature Current as well as 
Previous.
 
 
 
 
In a particular program one file is used where override command is applied to a file, now this program calls another program where we want to use the same file but without override. How it can be done?
 
Suppose File Name(MyFile) is overriding to File(MyFile1) in 
one Cl program (i.e ClPGM1) by
 
Ovrdbf File(MyFile) ToFile(MyLib/MyFile1)
 
Now You are calling the program(i.e RPG1)in Cl Pgm(CLPGM1)
and want to use same file(MyFile1). So just delete the overrides first.
 
And then just Declare the File in F- spec and use the same file without overrides.
 
F MyFile1  IE F     Disk
.
.
.
In this way we can use the file 
 
Hope you got your answer!
 
      
Depends on the coding. If that is an interactive JOB and OVERSCOPE os on *JOB level, you have delete the overrides first.
 
DLTOVR *ALL LVL(*JOB)
 
If that is a batch job , no impact on other jobs.
 
 
What is IFS, ICF, RAPE and DISKET files? 
 
 
 
 
 
What is default printer file command and object type? What is the difference between SKIP and SPACE OPCODES? When use POST opcode?
 
You can create your own printer files by using the Create Printer File (CRTPRTF), Or you can use System-provided/Default printer files.
 
If another printer file is not specified, the printer uses the default printer file. The default printer file for the system is QSYSPRT.
 
 
SKIPA (Skip After) keyword in printer files

Use this file-, record-, or field-level keyword to specify that the printer device is to skip to a specific line number after it prints one or more lines. The format of the keyword is: SKIPA(skip-after-line-number)



SPACEA (Space After) keyword in printer files

Use this record- or field-level keyword to specify that the printer device is to space some number of lines after it prints one or more lines. The format of the keyword is: SPACEA (space-after-value)



SKIPB (Skip Before) keyword in printer files

Use this file-, record-, or field-level keyword to specify that the printer device is to skip to a specific line number before it prints the next line(s). The format of the keyword is: SKIPB(skip-before-line-number)



SPACEB (Space Before) keyword in printer files

Use this record- or field-level keyword to specify that the printer device is to space some number of lines before it prints the next line or lines. The format of the keyword is: SPACEB (space-before-value)
 

How a procedure will be added in to a Service Program?
 
Using a Binder Language, 
 
UPDSRVPGM add the procedure/module then use the binder
language command as below.
 
STRPGMEXP  PGMLVL(*CURRENT)         
         EXPORT     SYMBOL(NewProc)
         EXPORT     SYMBOL(pgm1)
         EXPORT     SYMBOL(pgm2) 
STRPGMEXP  PGMLVL(*PRV)         
         EXPORT     SYMBOL(pgm1)
         EXPORT     SYMBOL(pgm2) 
ENDPGMEXP
 
 
 
WHAT IS THE DISPLAY CMD FOR DATAQ, HOW IT CAN BE USED?
 
Unlike DSPDTAARA, There is no iSeries/AS400 defined command
for display data queue. 
The following commands are among the few CL commands that
IBM ships with OS/400 for data queues:
 
    * CRTDTAQ--Create Data Queue
    * DLTDTAQ--Delete Data Queue
    * WRKDTAQ--Work with Data Queues
 
But No DISPLAY CMD FOR DATAQ is defined for DATAQ. Some one
can created his/her own command to display data queue
contents using APIs. Use Google and give a try.  
========================================================
Instead of that TAATOOL (A Third Party Command Utility
Provider) has created a command.
A typical command would be:
 
        DSPDTAQD   DTAQ(xxx)
 
Command parameters
-----------------
DTAQ          The  qualified name  of the  data queue.   The
library value  defaults  to  *LIBL.    *CURLIB  may   also 
specified.
 
OUTPUT  Whether to  display or  print the  output.   * is 
the default.   *PRINT may  be entered.   These values have
the same  meaning as  on system  commands.
==========================================================
 
 
How to convert date format from one format to another I think in CL/400 its CVTDAT, Please tell in RPG/400 sir not in RPGILE?
 
A simple method, if you are good user of MOVE and MOVEL. Use
the below code to change date format of one type to another.
 
movel *date date1 4 0
move *date date2 4 0
 
move date1 datex 
movel date2 datex
 
Where *date system defined date with mmddyyyy format. Hope
it will help.
 
===========================================================
Second method, You need to define Data Structure, as below.
Variable starts with 'F' is actually used for first type of
date.
 
And variable starts with 'S' actually used for second date
format.
 
I DS
I 1 80FDATE
I 1 40FYEAR
I 1 20FCC
I 3 40FYY
I 5 120SDATE
I 5 60SMO
I 7 80SDA
I 9 120SYEAR
I 9 100SCC
I 11 120SYY 
 
 
FDATE is 8-digit date as YYYY/MM/DD format and SDATE is an
8-digit date as MM/DD/YYYY format. 
   
Just convert by moving on to other. For MDY to ISO , use
below syntax.
 
Z-ADD MDYC  SDATE
Z-ADD SYEAR FYEAR
Z-ADD FDATE CYMD
 
To go from ISO to MDY, you first z-add to fdate, then z-add
fyear to syear, and then z-add sdate into your MDY date.
==========================================================
 
How to find whether a date format is valid or not in RPG400 
not in RPGILE.Can you please write the coding for this sir, I’m 
new to AS400.Please help ?
 
Use TEST (D)
 
 
 
Debug in real scenario.
 

1 HLD JOB Q

2 SBM JOB

3 STRSRVJOB

4 STRDBG PGM

5 F12(WITHOUT BRK POINT)

6 RLSJOBQ JOBQ(QS36EVOKE)

7 F10

8 DSPMODSRC

9 ADD BREAK POINT

10 F12

11 F12

12 ENTER

13 ENDDBG

14 ENDSRVJOB

What is referential Integrity? What is Foreign Key? 
Referential integrity maintains the integrity of a
database using key fields. Referential integrity is defined
as "the state of a database in which all values of all
foreign keys are valid". 
 
A foreign key is a column or a set of columns in a table
whose values must match at least one primary key or unique
key value of a row in its parent table.
 
For e.g. a EMPMASTER table (Keys EMPNO and EMPNM) has employee’s
job details and another EMPSECONDRY(Key EMPNM) table has employee’s personal detail. But both are connected with EMPNM key field.
 
So here there is referential integrity between two database files (EMPMASTER and EMPSECONDRY) and there is a foreign key (EMPNM) used in secondary file to connect.
 
What is the Logic Cycle? What you know about primary, secondary and full procedural file?
 
Primary (P): “P” at position 16 in F spec.
When several files are processed by cycle processing, one must be designated as the primary file. In multifile processing, processing of the primary file takes precedence. Only one primary file is allowed per program.
 
The RPG program automatically reads from the file one record at a time and your code is applied for each record. Certain indicators (LR, L1, L2, etc.) allow you to condition code for Level breaks (subtotals) and last record (totals). This is also known as LOGIC CYCLE programming.
 
The RPG logic cycle works roughly like this:
1.    Read a record in the primary file.
2.    Perform level-break calculation specs
3.    Move the data from the file area to fields in your RPG program
4.    Perform detail level calculation specs
5.    Go back to the beginning.
After the last record is read, the LR indicator gets set and level break calculations are executed and then the program ends.
 
 
Secondary(S): “S” at position 16 in F spec.
When more than one file is used during cycle-controlled programming, secondary files are input files. The processing of secondary files is determined by the order in which they are specified in the file-description specifications and on the rules of multifile logic.
 
Full Procedural (F): “F” at position 16 in F spec.
This entry is used when the input is controlled by calculation operations. File operation codes such as CHAIN or READ are used to do input functions.
 
A primary file uses the RPG logic cycle for reading through your data. A full procedural file is one where your logic controls access to your data records. Full procedural files are by far the most common usage.
 
 
Record Address File(R): 
A record-address file is a sequentially organized file used to select records from another file. Only one file in a program can be specified as a record-address file. This file is described on the file-description and extension specifications and not on the input specifications. The file processed by the record-address file must also be specified on the extension specifications and must be a primary, secondary, or full procedural file. 
You cannot specify a record-address file for the device SPECIAL. You cannot specify an externally described file as a record-address file; however, you can use a record-address file to process a program described file or an externally described file. 
 
A record-address file that contains relative-record numbers must also have a T specified in position 32 and an F in position 19.
 
Array or Table File (T)
Array and table files specified by a T in position 16 are loaded at program initialization time. The array or table file can be input or combined. Leave this entry blank for array or table output files. You cannot specify SPECIAL as the device for array and table input files. You cannot specify an externally described file as an array or table file. 
 
If T is specified in position 16, you can specify C in position 15 for a DISK or SEQ file. This C allows an array or table file to be read from or written to the same file (an array or table replacement file). The To and From file names on the extension specifications must specify this file name. 
 
 
 
What is Transfer Control?
TFRCTL (Transfer Control) is a control language command 
which 'hands off' execution to the program listed as the 
receiving program. 
Once this happens, the original program drops from the call 
stack and can not be returned to. 
Hence, ANY code following a TFRCTL is wholly skipped, 
unless some type of flow control is designed in the program 
which could possible skip the TFRCTL.
 
 
This is my Physical file 'EMPS' existing in library "TAMIL1" 
and its record format is 'EMPRCD"
a)its source is
 
R EMPRCD              
     ENO            4  0 
     ENAME         10    
     EADD          10  
 
b)The records present in EMPS are as follows
 
ENO   ENAME       EADD 
      
0001  tamil       coimbatore 
0002  kumar       bangalore  
0003  sunder      bangalore  
0004  arunkumar   chennai    
0005  pandi       hyderabad  
0006  santhosh    hyderabad  
0007  sasi        salem      
0008  kalai       chennai    
0009  suresh      hyderabad  
0010  vijay       bangalore  
0011  Arul        chennai    
0012  velu        chennai    
0013  khan        bangalore  
0014  praba       chennai    
0015  praba.p     coimbatore 
0016  anand       ooty       
0017  raja        erode      
0018  sankar      erode      
0019  vadivel     namakkal   
0020  anbu        chennai
0021  Ajith       mumabi  
 
c)now i want to select the 'ENAME' field  records starting with 'S' ?
 
Looks like your answer is correct, Just little modification 
as per my understanding and as per your requirement.
--------------------------------------------------------
PGM                                           
DCLF  FILE(TAMIL1/EMPS)                                 
OVRDBF FILE(TAMIL1/EMPS) SHAR(*YES)                     
OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ + %WLDCRD
("S*")')                            
 
/*--To See the result in file, Use following commands--*/
 
CPYFRMQRYF FROMOPNID(TAMIL1/EMPS) TOFILE(TAMIL1/TESTPF1) + 
             MBROPT(*REPLACE) CRTFILE(*YES)            
                   
RUNQRY QRYFILE((TAMIL1/TESTPF1))
 
 
READ:       RCVF       RCDFMT(EMPRCD) 
MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
 
/*---To See the result, Use following commands----*/
 
SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&ENAME) +
              TOPGMQ(*EXT) 
SNDUSRMSG  MSG(&ENAME) TOUSR(&USERNAME) 
 
****Provide your User Profile Name in TOUSR = &USERNAME 
/*-------------------------------------------------*/
SNDUSRMSG  MSG(&ENAME)
GOTO READ
END:        CLOF       OPNID(EMPS) 
DLTOVR     FILE(EMPS)
ENDPGM                                   
                
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 

What are the differences between CPF0000 and CPF9999? How these can be used effectively?
 
The CPF0000 and CPF9999 are used as an global MONMSGs, used for all errors and exceptions.
 
The process of Error handling using MONMSGs is as below.
 
First, you can monitor for a specific message, e.g.:
    MONMSG    MSGID(CPF9801)
 
Or you can monitor for a list of specific messages, e.g.:
    MONMSG    MSGID(CPF9801 CPF9802 CPF9810)
 
Next, you can monitor for a whole group of related messages, using a
"generic" designation such as:
    MONMSG    MSGID(CPF9800)
 
-- this will trap any message that begins with CPF98xx.
 
Next, you can monitor for a truly generic message, such as:
    MONMSG    MSGID(CPF0000)
 
-- this will trap any message that begins with CPFxxxx.
-- typically this is used in a "global message monitor" statement at the
start of the program, e.g.:
    MONMSG    MSGID(CPF0000 MCH0000) EXEC(GOTO ERROR)
 
For these message IDs to be considered a "generic pattern" it must end in "00" or "0000".
 
Finally, it is my understanding that, if a CPF message occurs and is not "handled" in the CL program, in other words, there was no active MONMSG that matched the message ID either exactly or as a generic pattern, then it is converted into a CPF9999 and that exception is raised ... so you can also monitor for CPF9999. But, due to this extra processing that occurs before it is converted to CPF9999, you may get additional messages, such as the one that tells you there was an unhandled exception and asks if you want a "dump" etc.
 
 

CPF9999
there are advantages to using CPF9999: If an unmonitored exception message arrives on the program message queue, the function check message, CPF9999, is sent. The message contains the statement number of the failing statment, which is very useful information to have when diagnosing a problem. Also, there are error messages other than CPFxxxx messages that can cause a CL program to terminate (MCHxxxx, etc.) By allowing the function check to occur, the problematic code is easier to locate, and you never have to worry about additional error message groups.

Can we perform CHAIN operation on Subfile record format....?
 
WE can chain subfile by Relative record number RRN. Declare RRN field in F spec. Then move valid RRN into this field and apply Chain on SFL record format having RRN field specified in factor1 of chain. Specified RRN record from subfile will be read by system.

Which keyword is used both in subfile and subfile control record format of a DSPF?
 
SFLPGMQ in the keyword
 
XXXCTL Ex:                                     
 Keyword   Indicators/+ Resp Text   
 CA03                    03  Exit   
 CA12                    12  Cancel 
 
XXXSFL Ex:                              
 Keyword  Indicator  Text     
 CA03        03      'Exit'   
 CA12        12      'Cancel'
 
 
What is the use of SFLMSG, SFLMSGID file and keyword SFLPGMQ?
 
The SFLMSG is a field-level keyword on the second (and last) field in the subfile record format for a message subfile. This field contains the name of the program message queue used by the OS/400 program to build a message subfile. In addition, SFLPGMQ can be specified on the subfile control record format when the SFLINZ keyword is specified on the subfile control record format.
 
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RCDMSGILE                 SFL SFLMSGRCD(3)
00020A            FLDKEY                    SFLMSGKEY
00030A            FLDPGM                    SFLPGMQ(276)
00040A          R SFLCTLILE                 SFLCTL(RCDMSG)
00050A  01                                  SFLINZ
00060A                                      SFLPAG(17)
00070A                                      SFLSIZ(17)
00080A                                      SFLDSP SFLDSPCTL
     A            :
     A            :
00110A            FLDPGM                    SFLPGMQ(276)
     A          R RCDMSGOPM                 SFL SFLMSGRCD(3)
     A            FLDKEY                    SFLMSGKEY
     A            FLDPGM                    SFLPGMQ
     A          R SFLCTLOPM                 SFLCTL(RCDMSG)
     A  02                                  SFLINZ
     A                                      SFLPAG(17)
     A                                      SFLSIZ(17)
     A                                      SFLDSP SFLDSPCTL
     A              :
     A              :
     A            FLDPGM                    SFLPGMQ(10)
     A
 
 
The SFLMSG and SFLMSGID are record-level keywords on the subfile control record format to identify a message to be displayed on the message line when your program does an output operation to the subfile control record format. Your program has the responsibility to reverse the images of any fields and to position the cursor appropriately in the subfile being displayed. 
 

The following example shows how to specify the SFLMSG and SFLMSGID keywords.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R SFLR                      SFL
00020A*
00030A*           (at least one displayable field)
00040A*
00050A          R SFLCTLR                   SFLCTL(SFLR)
00060A                                      SFLPAG(17)
00070A                                      SFLSIZ(17)
00080A                                      SFLDSP SFLDSPCTL
00090A  11                                  SFLMSGID(USR0006 PAYROLL/UMSGF1 +
00100A                                      11 &RPLTXT);
00110A  12                                  SFLMSGID(USR0007 PAYROLL/UMSGEF1 +
00120A                                      12 &RPLTXT);
00130A            RPLTXT        78A  P
     A
 
Describe the KEEP and OVERLAY Keywords?
 
In single page subfile,if I select the mutiple options in 1 
page and without pressing enter,I press rollup key 
(pagedown).In such case how I can handle it in rpg becasue 
in single page we have to handle it in pgm. It would be 
helpful if any one answer with coding ?
 
System will take care of it . You do not need to specify
anything for that. Until user does not press Enter  key
ReadC won't detect any change record.
 
First build the file according to the Size/Page. On Page up
load it again  . u do not need to worry about the option u
have entered on first page.
 
 
We can handle this using physical file RRN value.When user 
enters some options in the first page and takes a pagedown 
 
Read the changes on the subfile using ReadC ie; read the 
option entered for that record and save the physical file 
RRN value for that record in a temporary file along with 
option (You can get RRN value by declaring File information 
data structure for that physical file)
 
When you load the records in the subroutine bfore writing 
the values to subfile ,Chain the temporary file with RRN 
value and if the RRn is present in the temporary file move 
the corresponding option to the Subfile options.
 
Check this temporary file evrytime you load the records on 
subfile and update this temporary file evry time there is a 
chnage on the subfile options.
 
Clear the temporary file when the user confirms delete or 
when user doesnt want to delete.
 
 
 
We can handle this using arrays. When user 
enters some options in the first page and takes a pagedown 
then read the changes on the sub-file using READC. first 
validate the option, if entered options are valid then in 
first array store the fields value (through which we can 
identify record as unique in sub-file) and in second array 
store the option.
 
Whenever load the sub-file, then first check if subfile 
record is in array (with lookup), then write option equal 
to second array value and clear the array element. else 
display blank option.
 
Whenever user press enter (suppose user choose one option 
in page one and another option on page 3) then process 
option through array.
 
RPG/400 number of Records present in a physical file using file information data structure
 FPF001   IP  E                    DISK                       
 
F                                              KINFDS INFDS1 
 
IINFDS1      DS                                              
 
I                                     *RECORD  RECORD        
 
 
Is this coding correct sir,i have given I P E that is I-input,P-primary file,E-externally described.
 
Primary to use RPG logic cycle,is this the correct method because we have to find number of records present using file information data structure in RPG/400 without doing any input/output operations on the file and also without using DSPFD,SQL.
 
 
FAAPPOLM   IP   E           K DISK     INFDS
(FILE)                      
DFILE             
DS                                                    
DREC                    156    159I 
0                                   
C                   DSPLY                   
REC                         
C                   EVAL      *INLR = *ON    
 
I have declared file information data structure in position 
156 to 159 it will hold the number of records in the 
file.
 
 
What is the use of Panel Group?
 
It is used to create a Help Panel for the application.
Panel Groups is an Object on AS/400 (*PNLGRP)
CRTPNLGRP = to create a panel group program
For Help screen using Panel Group
On AS/400 all help screens used Panel Group objects
A panel is a visual presentation of data on the screen. A 
panel group is an object that contains a collection of 
display formats, print formats, or help information.
 
Panel groups are a part of IBM's UIM facility - User 
Interface Manager. 
 
So a panel group is a lot like a display file - a 
collection of 'windows' or screens to display and interact 
with data.
 
The difference is that instead of explicitly specifying 
locations, indentation, colorization, etc - IBM's UIM 
handles the majority of that. 
The idea is to create a common user interface without all 
the manual work involved in ensuring the same 'look and 
feel'.You can get explicit, yes. 
And most people see PNLGRP's as help windows, yes. But you can use them to create subfiles and other display 
items as well.
 
How can we read a PF in reverse order in CL?
you can read a physical file in DESENDING ORDER. You can 
first sort the physical file in decending order through 
OPNQRYF using KEYFLD. This will sort your PF in decending 
order based on your key field and then do the RCVF on this 
file. But for this you first need to do OVRDBF on the file. Like below…
 
Use OVRDBF Share(*yes)
Use the Openqry file by specified the values on opnqry file
 
Key field  . . . . . . . . . .   *NONE     
Key field order  . . . . . . .   *DESCEND
 
now read file using RCVF command.
 
 
 
 What are Cursors and its type used in SQL/SQLRPGLE?
 
Cursors defined in following formats.
 
1.    Declare cursor
2.    Open cursor
3.    Fetch cursor
4.    Close cursor
 
 
 
 
What is the purpose of the chain and SETLL and SETGT?
 
 
 
What is the interactive job? What is the batch job? How to change the batch job to interactive job?
 
 
Have a join logical file with more than one member with different record formats. So how can we read the different members from this file and also how we can read the different record format from the join logical?
 
 
 
What are Fillers? What is the actual use of Fillers? With small/simple Example?
 
 
 
Suppose i am having 3 programs PgmA,pgmB,pgmC and using source debugger. At debugging time i found that pgmC having some code error..then in debug mode directly how can i debug pgmC?
 
 
what is open data path? and what is the diff b/w access path and open data path? . Define a shared access path? 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? The values stored in array don’t vary. In the other hand, we can store the Different values in same variables at various 
stages.
 
 
How can you check for a records existence without causing and I/O (CHAIN/READ)?
With the help of File Information Data Structure, we can check existence of records in a physical file. The code is described below: 
 
In File description continuation line (IPFK), KINFDS RCDS IRCDS DS I *RECORD #RCDS with the above code we can check the existence of records in a file without causing I/O operation.
 
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 adds 1 to it. Through program we can access new customer number.
 
What is the difference between UDATE and the system date i.e. *DATE?
 
UDATE supports two-digit year. The format is *MDY (MMDDYY). *DATE (system date) supports four digit year. The format is *MDYY (MMDDYYYY).
 
 
Define the purpose of the %SST function? Define the purpose of the *CAT, *BCAT, *TCAT function?
To extract the information from the specified string. 
To concatenate the two strings into a one string. 
To concatenate the two strings by placing a single blank in a resultant. 
To concatenate the two strings by truncate a blank in a resultant.
 
 
Describe the difference between the DOWxx and DOUxx operations?
DOWxx : If the condition becomes true, then only the group of instructions allowed executing. DOUxx : Irrespective of condition, it will execute at least one time.
 
Define the purpose of the LEAVE and ITER operations?
 
If you specify LEAVE, the control transfers to the statement below the ENDDO. Complete the Loop and Leave out.
 
If you specify the ITER, the groups of statements are allowed to execute repeatedly. Control goes to Do statement. Start Over.
 
What is the purpose of the following I UDS I 1 60ORDER# I 7 90LINE# 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 to 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 difference between SFLCLR and SFLINZ?
 
SFLCLR : It clears the subfile. SFLINZ : First it clears the subfile and initiliazing the numeric variables with zeros and alphanumeric variables with characters.
 
What is the use of SFLRNA?
Using this, we can make specified subfile record format inactive.
 
What is the difference between SFLNXTCHG and SFLCSRRRN?
 
How to handle RECORD LOCK situation in a file?
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 Structure we can handle record lock situation. Generally it will happen, when the same file in update mode used in different programs.
 
How can you detect overflow for a print program that prints multiple lines per cycle? How you handle same in ILE?
You specify the indicators OA through OG and OV in 33 - 34 columns in a printer file. This indicator automatically set on whenever overflow occurs on a type of page.
 
 
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)
 
MOVE 'Dr. ' FNAME 
MOVE 'JOHN' MNAME 
MOVE 'WATSON' LNAME
FNAME CAT MNAME
MNAME CAT LNAME
 
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?
If you specify RETRN in called program, the *INZSR will not execute again.
 
 
 
 
How to convert one date format to another?
 
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
 
What is the purpose of Level Check parameter in a Physical file?
 
Specifies whether the level identifiers of the record formats in the physical file are checked when the file is opened by the program.
 
Define a Job Queue and OUTQ?
Job queues are queues of batch jobs waiting to be processed.
Output queues are queues of jobs waiting to be printed.
 
How to copy spool file/ printer file in data file?
Using CPYSPLF
 
What is the difference between CPYF and CRTDUPOBJ?
CRTDUPOBJ duplicates associated stuff (triggers etc.), whereas CPYF simply copies the data.