7. How can you execute a command from within an RPG program without calling a
CLP program?
By calling QCMDEXC application program interface we can execute a CL command
with in an RPG program.
9. Which of the following operations does NOT zero the field FLDA defined as 4,0?
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.
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.
11. Define what a data area is along with a brief example of what it may be used for?
Data area is a storage area to store limited information.
Example: a new and unique customer number is generated whenever a new customer is
added to customer master file. Data area keeps track of last record added and add 1 to
it. Through program we can access new customer number.
12. Define what a data queue is along with a brief example of what it may be used for?
Data queues provides communication between programs by calling API's QSNDDTAQ and
QRCVDTAQ along with parameters like data queue name, library in which data queue
exists, variable to store the number of characters to be sent, variable to store the
information to be sent. We can send the same data queue to the many programs.
It is a type of initializing the variables in I-spec. and these are further used in C-spec.
14. What is the difference between UDATE and the system date?
UDATE supports two-digit year. The format is *MDY (MMDDYY).
*DATE (system date) supports four digit year. The format is *MDYY (MMDDYYYY).
16. 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.
FORDHDR1 IF E K DISK
ORDHDRF KRENAMEORDHDRF1
During the compilation the source code of ORDERR copy book is copied into the
existing program. Where as /COPY is compiler directive statement.
The above line indicates that, $2SFN is a relative record number and FMT2 is name of
the subfile record format.
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.
Using this record level keyword, you can specify cursor location on an output operation to
the record format you are defining. The program sends output after setting the cursor
location.
26. Define what the operation will do, the purpose of the result field and the purpose
of *IN66?
HI LO EQ
C CALL 'CVTDAT' DTPRM 66
The above statement causes, call the program and pass the parameter.
27. Define the purpose of the following code (If you know, how would this be written
in RPG ILE)
HI LO EQ
C *IN66 DOUEQ *OFF
C KEY1 CHAIN FILEA 90 66
C 66 CALL PGM1 PRM
Whenever the indicator *IN66 becomes *OFF, the control transfers after ENDDO
statement. Otherwise, it reads the records from the data base file based on indicator
specified on HI position. If the specified indicator on LO position becomes *OFF, then
only CALL statement will execute.
28. How do you set the keywords SFLSIZ and SFLPAG if you want the sub file to
dynamically expand?
SFLSIZ > SFLPAG.
29. How can you detect and handle a record lock situation?
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 of
type " U" used in different programs.
30. How can you detect overflow for a print program that prints multiple lines per
cycle?
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.
31. 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)
32. 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.
a. Cost = $110. 00
b. Tax = 20%
c. Markup= 05%
d. Sale = 10%
34. Define the purpose of Factor 1 the Operation Code and *IN15 in following code
HI LO EQ
C *YMD Test (D) yymmddDate 15
If the factor 1 value matches with factor2 value, the indicator specified in EQ comes *ON.
The SETLL operation positions a file at the next record with a key or relative record
number that is greater than or equal to key or relative record number specified in
factor1.
The SETGT operation positions a file at the next record with a key or relative record
number that is greater than key or relative record number specified in factor 1.
40. 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.
47. When will you use OPEN and CLOSE opcodes in RPG program?
If you specify the letter "UC" at columns 71 - 72 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.
48. What is difference between fully procedural file and primary file?
In primary file the records will be read and processed from beginning to end. This order
is not changed.
In fully procedural file the records will be read and processed in any order. The logic
flow is controlled by the opcodes in RPG program.
49. 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.
BL Blinking field
HI High Intensity
RI Reverse Image
CS Column separator
ND Non Display
PC Position cursor
UL Underline
66. Which single RPG opcode performs both SETLL and READE?
CHAIN
73. What is the maximum number of subfiles that can be specified in a display file,
512
74. Maximum number of subfiles that can Defined in a RPG program for one display
file is
24
75. Maximum number of subfiles that can be active for a single file is?
12
76. Can more than one subfile record be displayed on one line?
Yes, by using SFLLIN keyword.
79. 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.
81. How to toggle between single line and Multi - line display of a particular record in
a subfile?
Using SFLDROP keyword.
92. How do you specify page overflow indicator for printer files in RPG?
Specify an indicator in position 33-34 of F specification.
97. Can you specify a display file to be used in the following modes Input, Output, or
Combined modes?
Yes.
101. What opcode could be used to test an alphanumeric field for all numeric values?
TESTN
102. What opcode will be used to test the zone of a character field?
TESTZ
115. 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.
118. What is the maximum number of times Multiple Occurrences DS can occur in a
program?
9999
****************************************************************************
122. What are the different types of specification available in RPG/400 ?
Control Spec. (H)
File Description Spec. (F)
Extension Spec. (E)
Line counter Spec. (L)
Input Spec.( I )
Calculation Spec. (C)
Output Spec. (O)
123. Is it necessary to define all formats? Which are mandatory and which are
Optional?
No, all are Optional.
129. 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.
134. Can you have multiple key lists for a single file?
Yes.
138. During input operation which indicator position is seton if there is a record lock?
LO indicator position is Seton.
140. 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.
141. What is the maximum number of subfiles that can specified in a display file?
512
142. The maximum number of subfiles that can define in a RPG program for one
display file is ___.
24
143. The maximum number of subfiles that can be active for a single file is ____.
12
144. What are the different opcodes used for file operation on a subfile in a RPG pgm?
READ, READC, CHAIN, UPDAT and WRITE
146. Can a single screen format occupy a screen area above and below a subfile
format?
Not possible.
147. 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.
178. How you will find an error which is not in the first page of the subfile without
using ROLLDOWN key?
By using keyword SFLRCDNBR.
180. How you will know whether you are in SFLDROP or SFLFOLD mode?
By using the keyword SFLMODE.
181. How you get the relative record in a subfile in which cursor is located?
By using the keyword SFLCUSRRN (Subfile cursor relative record number).
184. How to translate field values form lower case to Upper case?
By using opcode XLATE.
186. How many maximum arrays can be used in a single RPG program?
200.
187. How many maximum loops can be used in a single RPG program?
100
188. How many maximum printer files can be used in a single RPG program?
8
197. While designing the screen user wants to add file level keywords, then which
function key should be pressed?
F14.
200. How many Specs are there in RPG & Which are they?
There are 7 Specs in RPG they are H, F, E, L, I, C & O.
204. How many printer files maximum can be used in single RPG program?
8 because of the overflow indicators OA-OG & OV.
205. When you are defining a flat file in your program in F Specs which format will you
specify?
Flat File: - F (Fixed Length)
Other File: - E (Externally Described)
224. Which is the subsystem that is always on till the main power switch is off?
QCTL
233. If the data is likely to change over a period of time & Moreover data is large than
which type of table is preferred?
Compile Time Table.
248. Which are the four keywords supported by Program Status Data Structure?
*STATUS, *PARM, *ROUTINE & *PROGRAM
251. What is the values SQLCOD when there is an error in fetching the records specified
in the select statement?
-ve value
253. Which of the following options describes the result of using the USROPN keyword?
This file must be opened with an explicit OPEN operation prior to accessing this file.
256. Which of the following methods will make externally describe file fields available
to a program?
A Data Structure definition specification that names the file on the EXTNAME keyword.
258. What ILE RPG/400 code procedures the same results as the RPG/400 code shown
below?
C A Add B Sum1
Sum1 Mult X Rslt
Rslt Div Tot Answ
C Eval Answ = (A+B)*X/Tot
259. What will happen, if we use STRISDB command for RPGLE program?
Error: Program type not valid
260. If we want to define a new variable $Aprid with same attributes as field Crpid, the
RPGLE code look like this:
D $Aprid S Like (Crprid)
261. The keyword used to define number of entries per record for Tables/Arrays in
RPGLE is?
PerRcd (n)
265. Which is the Built in function to convert numeric field to Alpha field?
%EDITC, %EDITW, %CHAR
266. If user wants to retrieve the time in microseconds, what Would be data type of the
field?
Z
271. For CHAIN, SETLL, SETGT, READE, READPE & READE where indicators are given &
their success?
Opcode Success Indicator
CHAIN OFF HI
READ, READE, READP, READPE OFF EQ
SETLL ON EQ
SETGT ON HI
Single Page/non-elastic – In this case sub file size (SFLSIZ) must be equal to sub file
page (SFLPAG). For example, if SFLSIZ = 10 and SFLPAG = 10, then 10 records from file
are written to subfile. In this case PAG
290. In case of Load all sub-file, if we type options and then PGDN,PGUP , will options
be there on the display / in subfile.
Yes. It will retain all the options entered in the previous page.
291. How will you take care of multiple options in case sub-file?
We will have to handle it within the program using a READC in a loop.
292. If we type some options on screen out of which some are invalid and pressed
enter, what should happen?
It should process all the valid options before invalid options encounter. Once invalid
options is encountered program should stop processing and display error message at the
bottom of the scrreen.
311. If we tried to move year part of *ISO date into a field of length 3, what will
happen ?
Program crashes, as in case of *ISO format it required fields of 4,2,2.
315. What are different types of Arrays and what is the difference between them ?
There are 3 types of arrays Compile time, Pre-Run time and Run time. Compile time
array gets value at the time of compilation of the source of a program. Pre-run time array
gets value from a file at the beginning of a program execution (before any statement of a
program is executed). Run time array gets value during the program execution.
317. Can an indexed file (File with key fields) be accessed in arrival sequence in an
RPG program ?
Yes, don't specify "K" in F specification in the program for this file.
320. How will you display a particular page (or record) in a Sub file?
Move a valid relative record number(RRN) in the field specified using SFLRCDNBR
keyword in DDS
321. What is difference between Command Function and Command Attention key?
326. What's the difference between CHAIN and SETLL? Is there a performance advantage?
There are two important differences between CHAIN and SETLL.
1. The CHAIN operation applies a record lock to files that are open or update. The SETLL
operation does not apply the lock.
2. The CHAIN operation copies the record's data to the input buffer for the program. The
SETLL operation does not.
Syntax: All non-external data definitions can now be specified in a D-specifications that are new
to ILE RPG. In addition you can define "named constants" that greatly simplify coding in the C-
spec's. Also C-spec formats have changed slightly to provide for variable names of up to 10
characters (up from 6 in RPG/400) and longer operation codes.
New Operations: Several have been added. One that I like is EVAL which allows you to evaluate a
mathematical expression similar to Cobol and other mathematical programming languages such
as Basic, FORTRAN, PL/1, etc.
Modularity: This is a big plus. You can now write modules (non-executable) in several languages
and bind them together into a single ILE program. Thus you can use the best language (ILE C, ILE
Cobol, ILE RPG, ILE CLP) for a process or use existing modules to write a program. You can also
write callable procedures or procedures that function like built-in functions.
More: There is of course much more that is new in ILE RPG. For performance reasons, you should
have a good understanding of ILE. Bryan Meyers has written several very good articles in
NEWS/400 that can help you avoid some ILE traps. He is also one of the moderator
You can prompt SBMJOBS just like you would SBMJOB. When the above command
is executed, the following will be displayed.
Report: Submit Job www.5-10.com 8/12/00 08:43:30
Outq.................. STEVE
Copies................ 1
Hold Y/N.............. N (Hold and not print until released)
Save Y/N.............. N (Save after printing)
Print Text............ *NONE
Out Schedule Priority. 5 (1-9)
Job:
Hold on Job Queue y/N. N (Run at night)
Schedule Date......... *CURRENT (*current, *mon...) F4=Calendar
Schedule Time......... *CURRENT (1300 is 1:00pm, *current)
Job Date.............. *SCHEDULE (No slashes, *schedule) F4=Calendar
Job Priority.......... 5 (1-9)
Jobq.................. *JOBD
For user.............. *CURRENT (*current)
Current Library....... *CURRENT
Job Description....... *USRPRF
Job Name.............. TEST
CPI...................
Command............... DSPLIB LIB(MSD04) OUTPUT(*PRINT)
F1=Help F3=Cancel,
OUTQ Output queue to put your report. Available outq's are
COPIES Number of copies all reports will print
1 - 99 are valid entries
HOLD Hold report Y/N
Y - Hold the report on the out queue
N - Print the report
SAVE Save Y/N
Y = Save the report after printing.
N = delete the report from the out queue after printing
Select 8/12/2000
F1=Help F3=Exit Rollup/down
Examples
PCVTSAVPF FROMFILE(TFRLIB/TFRSAV1)
TOFILE(TFRLIB/TFRPF1) MBR(*FIRST)
Command above converts the contents of the save file TFRSAV1
in library TFRLIB to a physical file TFRPF1 in the same library.
Restrictions
1) The physical file must have a record length of exactly 528 bytes if the
corresponding PCVTPFSAV command is to process correctly. In other words,
use the CRTPF command with a RCDLEN(528) parameter to create the TOFILE
physical file for the PCVTSAVPF command.