Anda di halaman 1dari 32

RPG/400

1. What is acronym of RPG?


Report Program Generator

2. What is the native language of AS/400?


RPG/400

3. Why RPG/400 is famous?


* Easy to code and analyze.
* Supports externally described files.

4. How many specifications are there in RPG/400? What are they?


There are seven specifications are exits in RPG/400. They are listed below:
* Control Specification
* File Description specification
* Extension specification
* Line counter specification
* Input specification
* Calculation specification
* Output specification

5. Define each of the following operation codes


a. READ To read the records sequentially.
b. READE To read the equal key records
c. READP To read the previous records
d. READC To read the records from the workstation file (Subfile).
e. REDPE To read the equal key previous records.

6. What is *INZSR used for?


It is special type of RPG/400 subroutine, which is executed automatically at beginning of
the program. It is a good place to code initializes the variables.

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.

8. What is the purpose of the "N" in the following calculation specification?


C KEY CHAIN FILE N 99
If you specify 'N' in 53rd position, the record will not be locked if you try to read the
locked record. It is a way of avoiding the record lock.

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.

Frequently Asked Questions in AS/400


Page 1
10. 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.

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.

13. What is the purpose of the following?


I 'CLOSED' C STAT01
I 'OPEN' C STAT02

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).

15. List some of the commonly used commands for debugging


STRDBG (for batch jobs), STRISDB.

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.

17. Define the purpose of the LEAVE operation?


If you specify LEAVE, the control transfers to the statement below the ENDDO.

18. Define the purpose of the ITER operation?


If you specify the ITER, the groups of statements are allowed to execute repeatedly.

19. What is the purpose of the following?

FORDHDR1 IF E K DISK
ORDHDRF KRENAMEORDHDRF1

In order to rename the record format of a data base file in a program,


Frequently Asked Questions in AS/400
Page 2
we can use the above steps. Purpose of renaming is: If the record format name is similar
in two files and if both are used in a same program, the program will not compile. Hence
we have to rename either of the file.

20. What is the purpose of the following


C/COPY QRPGSRC, ORDERR

During the compilation the source code of ORDERR copy book is copied into the
existing program. Where as /COPY is compiler directive statement.

21. What is the purpose of the following


FORDHDR1 CF E WORKSTN
$2SFN SFILE FMT2

The above line indicates that, $2SFN is a relative record number and FMT2 is name of
the subfile record format.

22. 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.

23. What is the purpose of the following?

A CSRLOC (F1ROW F1COL)

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.

24. 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
lphanumeric variables with characters.

25. Define the purpose/use for SFLRNA?


Using this, we can make specified subfile record format inactive.

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

Frequently Asked Questions in AS/400


Page 3
C ENDDO

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)

MOVE 'Dr. ' FNAME 3


MOVE 'JOHN' MNAME 4
MOVE 'WATSON' LNAME 6
FNAME CAT MNAME: 1 VAR1 8
VAR1 CAT LNAME: 1 VAR2 15
DSPLY VAR2
MOVE *ON *INLR

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.

33. Determine the value of the result field

a. Cost = $110. 00
b. Tax = 20%
c. Markup= 05%
d. Sale = 10%

C Eval Total Cost = ((Cost * Markup) * Tax)) - Sale


= 1. 0$

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.

Frequently Asked Questions in AS/400


Page 4
35. Describe the function of SETLL operation in RPG language?

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.

36. Describe the function of SETGT operation in RPG language?

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.

37. Define Data Structure?


Data structures are specified in the Input specifications of an RPG/400 program to define
an area in storage and layouts of related sub fields.

38. What is the purpose of Data structure?


* Divide a field in to sub fields
* Change the format of a field
* Group non-contiguous data in a contiguous format
* Define an area of storage in more than one format
* Define multiple occurrences of data structures.

39. List and explain the different type of data structures?


* Data area data structure
When the data area is defined in an RPG/400 program as a data area data structure, its
data is implicitly retrieved for processing and written back at the end of the program. In
the data area data structure, letter "U" must be entered to define the data structure as a
data area data structure.

* File information data structure


A file information data structure provides exception/error information that may be
occurred when processing a file during program execution. This type of data structure
contains pre defined sub fields that identify
* The name of the file for which the error occurred
* The record processed when the error occurred
* The operation being processed when the error occurred
* The status code number
* The RPG/400 routine in which the error occurred.
Exception errors may be controlled by testing for an error code in the *STATUS field
which is included in a file information data structure. Specifically, keywords including
*FILE, *RECORD, *OPCODE, *STATUS, *ROUTINE provide the previously named
information.

* Program status data structure


Program status data structure however identity exception/errors that are generated in the
program by RPG/400 operations and not by a file. Note that any code greater than 00099
is flagged as an exception/error. Four keywords - *STATUS, *ROUTINE, *PROGRAM,
*PARMS are supported by a program status data structure.

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.

Frequently Asked Questions in AS/400


Page 5
41. What is purpose of declarative statement DEFN?
Depends on the factor 1 value it will do two things:
* If the factor1is *LIKE then DEFN opcode defines the new field based on the attributes
ld field.
* If the factor 1 is *NAMVAR then DEFN opcodes defines the field as a data area.

42. What is the purpose of SFLNXTCHG keyword in a su70bfile?


This is a subfile record format keyword. If you perform read on the sub file, 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.

43. 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 beginning 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.

44. What is message sub file?


Message sub file is special file contains multiple messages taken from program message
queue and placed in message sub file for display on the screen.

45. What are necessary keywords to code message sub file?


SFLMSGRCD, SFLMSGKEY, SFLPGMQ

46. 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.

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.

50. How many primary files allowed in a program?


Only one primary file is allowed in program.

51. How many secondary files allowed in a program?


More than one secondary files are allowed in a program.

Frequently Asked Questions in AS/400


Page 6
52. What is the purpose of FRCDTA (Force Data) keyword?
Use this record-level keyword to immediately display a record format, without waiting for
the next input or output/input operation.

53. 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.

54. 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

55. What is the maximum number of parameters allowed in RPG?


255 (Two hundred and fifty five)

56. What is the maximum number of parameters allowed in CLP?


40 (Forty)

57. What is the maximum number of subroutines allowed in RPG?


254 (Two hundred and fifty four)

58. What is the maximum number of files allowed in RPG?


50 (Fifty including eight printer file)

59. What is maximum number of Arrays allowed in RPG?


250 (Two hundred and Fifty)

60. Where can you specify an indicator in LOKUP operation?


In ‘EQ’ INDICATOR.

61. When do you use F-spec. Continuation line?


* In order to refer the named record format as a subfile record format in the program.

Frequently Asked Questions in AS/400


Page 7
* 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.

62. What are the various types of device files?


Display files, printer files, discket files, tape files etc.

63. How do you know that records are locked?


By using a command WRKOBJLCK.

64. What is the purpose of Indicators in RPG?


In order to control the logic flow, we can use indicators in RPG.

65. 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.

66. Which single RPG opcode performs both SETLL and READE?
CHAIN

67. What is term CUA, SAA?


Common User Access
System Application Architecture

68. How do you use DEBUG utility?


STRDBG program-name UPDPROD (*YES)

69. 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.

70. What are all the contents of subfile?


Subfile Record Format, Subfile Control Record Format, Relative Record Number, Subfile
Record Number, Associated Subfile Keywords.

71. What are the two record formats a subfile contains?


Subfile record forma (SFL), and subfile control record forma (SFLCTL).

72. 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.

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.

77. How do you specify the number of records to roll in a subfile?

Frequently Asked Questions in AS/400


Page 8
Use SFLROLVAL keyword in DDS along with number, which specifies the number of
records to scroll at a time.

78. 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.

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.

80. What is the use of SFLEND keyword?


By specifying this keyword, the Bottom/More message could be displayed at end of
screen.

81. How to toggle between single line and Multi - line display of a particular record in
a subfile?
Using SFLDROP keyword.

82. 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.

83. What is the use of Header Specification in RPG/400?


It identifies by H in column 6, provides information about generating and running
programs.

84. When will DUMP and DEBUG opcodes be ignored?


If blank is specified in position 15 of H specs.

85. Specify different indicators used in RPG?


Overflow indicators
Record Identifying Indicators
Field Indicators
Resulting Indicators
Control Level Indicators

86. 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.

87. What is the use of E specification in RPG?


Extension Specs describes all record address files, arrays and tables.

88. 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.

89. In which specification the report layout can be defined?


O Specification.

90. How many printer files can be defined in F specs?


8

Frequently Asked Questions in AS/400


Page 9
91. Give three main purposes of File specification?
To define files, to describe the files, to assign the files to specified devices.

92. How do you specify page overflow indicator for printer files in RPG?
Specify an indicator in position 33-34 of F specification.

93. What is a Primary File?


It is used in RPG Program Cycle to automatically read records in a cycle.

94. Can a indexed file be accessed in arrival sequence in RPG program?


Yes.

95. What is a Program Described file in RPG?


The field name and length of the fields are defined with in the RPG program.

96. 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.

97. Can you specify a display file to be used in the following modes Input, Output, or
Combined modes?
Yes.

98. 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.

99. What is the length of a variable in RPG?


6 Characters.

100. When is a TAG statement used in RPG?


It is used as Label.

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

103. How to read database records without locking them?


Put 'N' in position 53 of C specs.

104. 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).

105. What does 'SR' in columns 7-8 of C specs mean?


Calculation operation is a part of RPG subroutine.

106. 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.

Frequently Asked Questions in AS/400


Page 10
107. 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 beginning of operations under commitment
control(if there has been no previous COMIT or ROLBK operation).

108. How do you use exceptional write in C specs?


Using EXCPT opcode.

109. 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.

110. What does opcode POST do?


Puts information in INFDS.

111. What is the maximum number of elements in an array?


9999

112. Can we define Multi-dimensional arrays in RPG?


No.

113. What is XFOOT opcode?


Adds all the elements in a numeric array, and places the sum in the result field.

114. How can we sort an array?


By using SORTA opcode.

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.

116. 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.

117. What is Program Status Data Structure?


A Program status DS can define 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 curred
*PARMS :contains the number parameters passed to this program from the
Calling program.

118. What is the maximum number of times Multiple Occurrences DS can occur in a
program?
9999

Frequently Asked Questions in AS/400


Page 11
119. What are all the compiler directive statements?
/TITLE, /SPACE, /EJECT, /COPY

120. 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.

121. 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)

****************************************************************************
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.

124. What is the use of E specification in RPG?


Extension Specs describes all record address files, arrays and tables.

125. In which specification can a report layout be defined?


O Specification.

126. Can an indexed file be accessed in arrival sequence in RPG program?


Yes.

127. In which specification Data Structures can be defined?


I - Spec.

128. When is a TAG statement used in RPG?


It is used as a Label.

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.

130. How can database records be read without lock?


Put 'N' in position 53 of C specs.

131. 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).

Frequently Asked Questions in AS/400


Page 12
132. In conjunction with which statements can ORxx and ANDxx conditions be used ?
DOUxx, DOWxx, IFxx, and WHxx.

133. What does opcode POST do?


Puts information in INFDS.

134. Can you have multiple key lists for a single file?
Yes.

135. What are the different types of arrays available in RPG?


Pre-execution time array.
Compile time array.
Execution time array.
136. Can we define Multi-dimensional arrays in RPG ?
No.

137. What is XFOOT opcode?


Adds all the elements in a numeric array, and places the sum in the result field.

138. During input operation which indicator position is seton if there is a record lock?
LO indicator position is Seton.

139. What is the difference between *LIKE and *NAMVAR?


*LIKE defines the variables as in database.
*NAMVAR is used to define variables as data area.

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

145. 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.

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.

Frequently Asked Questions in AS/400


Page 13
148. 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.

149. Mandatory keywords of sub file


SFL, SFLCTL, SFLDSP, SFLSIZ, SFLPAG are the mandatory key words

150. Difference between SFLRCDNBR and SFLNXTCHG


SFLRCDNBR will give the RRN of the First record displayed on the screen at a given time.
Whenever a record is changed on display file. An MDT is set ON. If an indicator is
associated with SLFNXTCHG and it is SETON then READC will read only the changed
record. And if the indicator is not associated and it is seton it READC reads all the records
from sub-file

151. How do u compile RPGLE program


Either thru 15 or crtrpgmod

152. Is module executable


No You need to create an RPG prog to run the module

153. What is procedure?


A procedure is the set of self-contained high level language statements that can perform
a particular task and then returns to a caller

154. What is service program?


A Service Program is a collection of run able procedures and available data items easily
accessible by other ILE programs. In many respects it is similar to a subroutine library
and procedure library.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call a service
program using the CALL operation.
A service program is bound into a program or other service programs using binding by
reference

155. What is LOKUP opcode?


Look’s for a particular element of an array

156. How do handle file exception/error


*INFDS ,*PSSR defining it in F spec

164. How do you set pointers to values 55 or next higher or greater?


SETGT.

165. Distinguish between terminating a program through SETON LR and RETURN?


LR closes all the files used in the program and RETURN is used to return the control to
the parent program.

166. How will you search an array?


LOKUP

167. What are the different types of arrays?


Preruntime gets populated at the time input.
Runtime gets populated at the time execution.

Frequently Asked Questions in AS/400


Page 14
Compile time gets populated at the time of compilation.

168. What is message file?


It is file which contain messages created by the user through which a user can display
own message while validating.

169. What does DEFN do?


It is used to define a field based on the value specified in FACTOR 1.

171. What are two types of record are used in subfile?


SUBFILE RECORD FORMAT and SUBFILE CONTROL RECORD FORMAT.

172. What is ELASTIC and NON ELASTIC SUBRILE?


When subfile size is greater then subfile page size it is called elastic subfile and when
subfile size is equal to subfile page size it is called non-elastic subfile.

173. What is SFLINZ and SFLRNA?


SFLINZ stands for subfile initialize. It initialized all the character field as blanks and
numeric fields as zeros. SFLRNA stands for subfile record not active (It means records
are there in the subfile but active).

175. Can you display a empty subfile?


Yes by using the keyword SFLINZ and SFLRNA.

176. Why do we use READC? What is SFLNXTCHG?


READC is to read those records which have changed in the subfile. If you validate a
record in subfile on some condition all the invalid records can display in reverse image. The
first which have changed and made valid and released still displaying in reverse image. The
records have read even it has not been changed due to SFLNXTCHG.

177. How do you read changed records backward in subfile?


NOT POSSIBLE.

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.

179. What is SFLROLVAL?


By using this keyword you can tell system to roll on of records when the user presses
ROLLDOWN key (For this you define a hidden of 4 byte).

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).

182. What is QCMDEXC?


It is used to execute a single CL command within the RPG program.

183. What is maximum size of data area?


9999.

184. How to translate field values form lower case to Upper case?
By using opcode XLATE.

Frequently Asked Questions in AS/400


Page 15
185. How many maximum parameters can be passed from on RPG program to another
CL program?
40

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

189. What is the maximum length of an OCCUR?


9999.

190. What is a subfile?


Subfile is a group of records which can be used for (Displaying, Adding new record,
modifying the existing record, and Deleting the existing records)

191. What is maximum size of a subfile?


9999.

192. Except report design what else can be done by O spec?


We can write a Physical File from O spec.

193. What is the full for of CA and CF?


Command Attention and Command Function.

194. What is *PSSR?


It is a system subroutine which is executed by default when any error occurs in a
program.

195. Why do we define MOVE *ON *INLR?


It frees the memory. All the fields and parameters in the memory will become blank.

196. How do you shutdown your IBM server?


PWRDWNSYS.

197. While designing the screen user wants to add file level keywords, then which
function key should be pressed?
F14.

198. SFLRCDNBR is a FIELD LEVEL keyword

199. In which Specs Arrays, Tables & Constants are defined?


In I Specs.

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.

201. Difference between GOTO & EXSR?


EXSR is a conditional branching while a GOTO is an unconditional branching.

Frequently Asked Questions in AS/400


Page 16
202. Difference between CA & CF?
CA: - It does not retains the value into the buffer memory.
CF: - It retains the value into the buffer memory.

203. What does EXFMT does?


Write & Read.

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)

206. Which indicator is used for Read?


EQ (Equal to)

207. Which are the figurative constants used in RPG?


*ZERO,*BLANK, *ZEROS, *BLANKS, *HIVAL, *LOVAL, *OFF, *ON & *ALL.

208. What is the syntax for PLIST?


*ENTRY PLIST
PARM

209. What are indicators?


Indicators are inbuilt class of variables for RPG.

210. What is CAB?


It compares Factor1 with Factor2 & if condition is true, control is transferred to label
designated in the result field. The label specified must appear as the Factor1 of a TAG
operation somewhere in the program.

211. Which are the Relational Operators in RPG?


GT, GE, LT, LE & EQ.

212. In ‘O’ Specs what is the opcode for write?


EXCPT.

213. What is Subroutine in RPG?


A subroutine is a group of statements in a program that can be processed several times
in that program.

214. Do we have to Execute the *INZSR compulsory?


No, it is a system-defined subroutine it is executed automatically.

215. What is the use of *PSSR in the program?


Whenever there is any type error in the program the control straight away passes onto
this subroutine.

216. Types of Tables in RPG?


There are 2 types of tables in RPG they are: - Compile Time Tables
Pre-Runtime Tables

Frequently Asked Questions in AS/400


Page 17
217. What does LOKUP does in Tables & Arrays?
The LOKUP opcode searches the Factor1 entry in table or array.

218. File Access Opcodes?


READ, SETLL, SETGT, READE, READP, READPE CHAIN, KLIST, KFLD, EXCPT & WRITE.

219. What is RPG Fixed Logic Cycle?


A logic the compiler supplies is called RPG Fixed Logic Cycle.

220. Difference between Interactive & Batch Job?


Batch job begins, runs & continues to execute instructions without human intervention or
control while
Interactive job are user driven.

221. How can we run a Batch Job?


SBMJOB Command.

222. Difference between CALL & SBMJOB?


CALL performs interactively job while SBMJOB performs batch job.

223. What is Subfile?


A Subfile is a temporary area in memory which records may written to & read from a display
file device.

224. Which is the subsystem that is always on till the main power switch is off?
QCTL

225. Give an example of DEFN opcode?


*LIKE DEFN ENAME$ENAME
(Now the $ENAME has all the attributes same like ENAME)

226. What are the 2 types of lines on O Specs?


Record Identification Line & Field Identification Line.

227. Can a Subroutine contain another Subroutine?


Yes.

228. Does the SETLL & SETGT retrieve the record?


No, they simply position to the record.

229. What is a table?


A table is collection of data elements in one column, data elements Must be of same type
and same
length.

230. What is a Compile Time Table?


We can hard code data within the program is said to be Compile Time Table.

231. What is a Run Time Table?


Data from a separate disk file is loaded into a table each time the Program runs.

232. Give the Table definition?


TABMT 1 12 2 A
Where 1 = Number of entries per record
12 = Total number of entries
2 = Length of each entry
Frequently Asked Questions in AS/400
Page 18
A = Ascending Sequene

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.

234. What is Alternate Table?


RPG tables stores information in 1 column. To store information in multiple columns, it uses
the
concept of Alternate Table.

235. What is an Array?


Array is a collection of data, the data elements must be of same Length and same type.

236. What if RPG, when & who invented it?


Report Program Generator is IBM introduced a High Level Language in 1960.

237. For, which purpose is H Specs used?


Writing header information, date separator, currency symbol etc.

238. What is the size of the filename in RPG?


8 Characters (Max.)

239. Which are the different File Types in RPG?


I (Input), O (Output), U (Update) & C (Combine).

240. What are the different File Designation Types in RPG?


P (Primary) & F (Fully Procedural)

241. What’s the use of File Designation in RPG?


It refers to the way program will access or retrieve the data from the file.

242. What are the different File Format Types in RPG?


F (Fixed Length) & E (Externally Described)

243. What is the use of File Format in RPG?


It tells to the program that the records are within the program (F) or outside the program
(E).

244. What is L Specs for?


To tell length of page & number of lines to be printed on a page.

245. What is I Specs for?


To describe the records within Program described file, fields, constants, divide fields into sub
fields & to form a group of fields.

246. How many maximum spaces could be given in O Specs?


3

247. Which are Control Break Logic indicators?


L1 – L9.

248. Which are the four keywords supported by Program Status Data Structure?
*STATUS, *PARM, *ROUTINE & *PROGRAM

Frequently Asked Questions in AS/400


Page 19
249. Which are the String Manipulation Opcodes?
TESTN, SCAN, CHECK, CHECKR, SUBST & CAT

250. What do we can do with the Embedded SQL statements?


We can Insert/Update/Delete records, fetch records, fetch values from records into
variables.

251. What is the values SQLCOD when there is an error in fetching the records specified
in the select statement?
-ve value

252. Can you debug RPG III program with STRDBG?


YES & Vice versa NO

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.

254. What is the type of the Array in the following code?


D Arr S 30A Dim (30) PerRcd (1) CTADTA
Compile Time Array

255. Given the following code segment.


D PGMNAME S 20A Inz (‘THX1138’)
C CALL PGMNAME
C PARM P1 5
The CALL to the program name stored in the PGMNAME field ends in an error, the program is
not found.

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.

257. In the following code %SUBST is a


Eval Result = %SUBST (Flda: Str: Len)
Built in function

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)

262. What will be the output of the following ILE code?


D Loandate S D DATFMT (*USA) Inz (D’12 31 92’)

Frequently Asked Questions in AS/400


Page 20
UBDUR -30: *D Loandate

263. Which will be the output of the following ILE Code?


D Answer S T
C T’12:00PM’ ADDDUR 12: *Hours Answer
00.00 AM

264. Which of the following Specs. Is not used in ILE?


E Specs.

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

267. Subprocedures can use RPG cycle?


False

268. RPGLE supports which calls?


Static & Bound

269. State whether the following code is correct?


@Arr is an array. No of elements = 5, & Length of each element = 3A.
C Movel ‘ABC’ @Arr, X
False

270. How many files can be opened in RPG IV program?


No Limit

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

272. What does XFOOT, MOVEA & SORTA does?


XFOOT: - Sums the elements of an array
SORTA: - Sorts the array in ascending order but if while declaring the array Sequence
is defined as D
it arranges in descending order.
MOVEA: - Transfers valued from Factor2 to the Result field of the Operation but one of
them must be
an array
273. Advantages of ILE or RPG?
1) In RPG it is one step compilation (we will get *PGM object) while in ILE-RPG it is two
step compilation (we have to create a *MODULE and then bind that module to a program.
In RPG we cannot call a program i.e. recursive call is not supported. While in ILE RPG it is
supported.
Extended Factor 2
Length of Factor 1 & 2 is increased to 14 as well as Length of OP-CODE is 10
Free format is allowed
Built-in-functions are available.
Frequently Asked Questions in AS/400
Page 21
In case of ILE we have the concept of ACTIVATION GROUP.
In ILE EPM (Extended Program Model) is implemented while in RPG OPM (original
program model)

274. What is sub-file?


It is group of records read from or written to display file in a column format. It is always
a subset of records from physical file hence the name subfile.

275. SFL and SFLCTL ?


There are the two mandatory key words for subfile program /design. While SFL is used to
define Subfile record format while SFLCTL is used to define Subfile Control Record format.
And this two are the different parts of sub-file.

276. What are the Sub file Types?


There are three types of sub file
Load All - In which all the records from the Physical file or at max. 9999 records are
written to subfile. Here sub file size should 9999 or the number of records form PF which
ever is less. In this case PAGEUP AND PAGEDOWN is taken care by system. SFLPAG
should be less than SFLSIZ

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

Expandable/elastic/growing – In this case SFLSIZ should be grater at least by 1


than SFLPAG.(this is applicable to Load all type also). For example, SFLSIZ = 10 and
SFLPAG=9, then 10 records from written the sub file from physical file but only 9 are
displayed on screen.

277. what is SFLDROP and SFLFOLD


These are the two key-words used in sub-file for displaying additional information which
cannot fit one line. SFLFOLD will give view in folded form and SFLDROP will give view in
truncated form.

278. What is SFLCSRRRN and SFLRCDNBR ?


SFLCSRRRN will give the RRN of the record where the cursor is positioned.
SFLRCDNBR will give the RRN of the First record displayed on the screen at a given time.

279. What is SFLNXTCHG?


Whenever a record is changed on display file. An MDT is set ON. If an indicator is
associated with SLFNXTCHG and it is SETON then READC will read only the changed
record. And if the indicator is not associated and it is seton it READC reads all the records
from sub-file

280. Reading records from a subfile using READC


With the help of READC op-code we can read only changed records from subfile.

281. Required key words for subfile.


SFL, SFLCTL, SFLDSP, SFLSIZ, SFLPAG are the mandatory key words. SFLDSPCTL,
SFLCLR, SFLINZ, SFLEND are the optional key words used in subfile.

282. PLIST and KLIST


PLIST is a list of parameter and KLIST is the list of KEY fields.

Frequently Asked Questions in AS/400


Page 22
283. Position to particular record?
With help of op-code SETLL from RPG/RPGLE, it will position the record pointer just
before the required record. Next READ will read that particular record.

284. LR indicator and RETURN operation?


LR indicator – It close all the open files, Frees the space and release ODP.
RETURN – It dose not close files and dose not release the ODP and passes the control to
the calling program / command prompt if the program is called from command prompt.

285. Different operations on indicator?


There are only two operations on indicator those are SETON and SETOFF.

286. What is the operation / op-code to change in file?


In RPG/RPGLE with the help of UPDAT / UPDATE op-code.

287. How do I insert a record into a database file?


In RPG / RPGLE with the help of WRITE op-code.
In CL/CLLE we can not insert a record into database file.

288. Two way of deleting records from file?


one is DELETE and other with the help of O-Specs ADD/DEL specify DEL.

289. How to define a subroutine ?


with help of two op-code BEGSR(Begin subroutine) ENDSR (End subroutine) and
between these two op-codes write the instruction. The whole construct is defined as
subroutine.

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.

293. How will you achieve POSITION TO in Load all subfile?


While loading subfile move RRN, KEYVALUE in to a two dimensional array. When a key
value is entered
into POSITION TO field, having a LOOKUP into a array we can get a corresponding RRN.
Assigning RRN
value to SFLRCDNBR and then displaying the sub-file.

294. Types of Data Structures?

a. File Information Data Structure.


b. Program Status Data Structure.
c. User Defined Data Structure.
d. Multiple Occurrence Data Structure.
e. Date Area Data Structure.

Frequently Asked Questions in AS/400


Page 23
---------------------------------------------------------------------------------------------------

295. What are the built in function in RPGLE ?


%SIZE - Gives the size of the variable or literal
%PARM – Gives the number of parameter passed to parameter
%PADDR - Gives the address of the procedure
%ADDR - Gives address of the variable
%TRIM - Trims the right & left blanks of the string
%TRIMR - Trims the right blanks of the string
%TRIML - Trims the Left blanks of the string
%REPLACE - Replaces the specified number of characters from the specified position.
%SUBST - gives a sub string from a variable (%SUBST(X:Y:Z)
%ELEM - Gives number of elements or occurrences
%INDEX - Change the index of a table or multiple-occurrence data structure.
%LEN – Returns the length of value from a field.
%CHAR – Converts a Numeric filed to character.
%EOF – End of File.
%FOUND – If record is Found.

296. How to print HEADER if O-specs are used in program ?


With the help of op-code EXCEPT.

297. How to define array in D spec.


D ARR2 S 5 DIM(5) CTDATA PERRCD(1) It is a
Compile time array.
D ARR1 S 1 0 DIM(5) It is a Run time
array
D ARR1 S 40 DIM(7) FROMFILE(File name) PERRCD(1) It is
Pre Run time array

298. What is *PSSR and INFSR?


It is an exception/error handling routine which is specified in F-Sepcs for a file.
INFSR(*PSSR), INFSR is an information subroutine to specify the routine name in F-
specs.

299. How to go to *PSSR ?


Whenever an exception/error occurs and *PSSR is declared in F-specs, it is automatically
goes to *PSSR

300. Can we call *PSSR if no exception occurs? What happen it is called ?


Yes, Whether the statements specified are executed.

301. What is INFDS?


INFDS is a File Information Data Structure.

1 - 8 Character *FILE The first 8 characters of the file


9 - 9 Character Open indication (1 = open).
10 - 10 Character End of file (1 = end of file)
11 - 15 Zoned dec *STATUS Status code.
16 - 21 Character *OPCODE Operation code The first five posi
22 - 29 Character *ROUTINE First 8 characters of the procedure
30 - 37 Character RPG IV source listing line number

302. How to determine if the record is in used by another user ?

Frequently Asked Questions in AS/400


Page 24
We can determine weather a record is in use bye another user with the help of status
code (*STATUS). If
*STATUS = 01218 i.e. record already locked.

303. How to write *PSSR ?


It just similar to any other subroutine.
*PSSR BEGSR
………………
………………
…………….
ENDSR

304. What is Procedure ?


A procedure is the set of self contained high level language statements that can perform
a particular task and then returns to a caller.

305. How to define a procedure ?


First we have define Procedure Prototype along with all parameter. And PR.
D PROC1 PR
Then define Procedure with Begin/End
Procedure Name Begin/End
P PROC1 B Export
Then define Procedure Interface along with parameter and PI
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0
Define all the parameters as a variable to the procedure
D PARMA S 5 0
D PARMB S 5 0
In not returnable procedure, the procedure should end with
C PROC1 E
In returnable procedure, it should end with
C RETURN PARMA + PARMB

306. What is Procedure Prototype and Procedure Interface.


Procedure Prototype
In this section we specify the name of the procedure along with PR.
D PROC1 PR
Procedure Interface
It is section where we define all the parameter which are receiving or returning some
values.
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0

307. How to define Global Parameter in ILE ?


Declare a variable with key word EXPORT and while using this variable in anther program
declare with
IMPORT keyword.

308. What is the disadvantage of using Global variable?


We can not trace out at which point the value of variable is changed.

309. What is Service Program?

Frequently Asked Questions in AS/400


Page 25
A Service Program is a collection of runnable procedures and available data items easily
accessible by other ILE programs. In many respects it is similar to a subroutine library
and procedure library.

A service program differs from a program in two ways:


It does not contain a program entry procedure. This means that you cannot call a
service program using the CALL operation.
A service program is bound into a program or other service programs using binding by
reference.

310. What is *ISO date format?


YYYY-MM-DD for other formats refer to IBM manual or ERIS document.

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.

312. How to avoid using indicators in ILE ?


By using the standard Built In Expressions like %FOUND,%EOF, NOT %EOF, %BOF, NOT
%BOF…etc.

313. What is difference between module and program ?


Module is a non-runnable object where as program is runnable.

314. What is difference between ILE RPG and RPG/400 ?


Difference is in program development (specification), program creation (create module,
bind module to create program), program running (activation group, resource sharing).

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.

316. What is Multi occurence data structure ?


It is an array of a Data structure.

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.

318. What is the difference between *LIKE and *NAMVAR opcode?


*LIKE defines program variable same as that of another pre defined variable. *NAMVAR
is used to define variable as Data area.

319. How to handle run time error in RPG Program ?


by using indicator on statement, subroutine *PSSR

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?

Frequently Asked Questions in AS/400


Page 26
Command function key returns variable value along with response indicator (associated
with CF key) where as Command attention returns only the response indicator value.

322. What are different type of Sub files ?


There are three types of Subfile (1) Load all Subfile (Page Size = 9999) (2) Extendable
Sub file (Sub file size > Sub file page), (3) Load by Page (Sub file size = Sub file page)

323. What is SFLNXTCHG keyword used for ?


To read the change records for 2nd, 3rd,...times from sub file after reading them once.

324. What is SFLROLVAL keyword used for ?


It specify the number of records to roll in a subfile.

325. What is difference between keyword SFLCSRRRN & RTNCSRLOC ?


RTNCSRLOC returns the location of cursor into the variable (associated with this
keyword) and SFLCSRRRN returns the relative record number where the cursor is
positioned.

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.

AN/OR lines (positions 7 and 8 of | Maximum of 7 per operation.


calculation specifications)
Arrays and tables | Maximum of 200 per program.
| Array/table input record length | Maximum length is 80.
for compile time
Character field length | Maximum length is 256.
Control fields (position 59 and 60 | Maximum length is 256.
of input specifications) length |
Data structure length | Maximum of 9999.
Data structure occurrences (number | Maximum of 9999 per data
of) | structure.
Edit Word | Maximum length of 24 for literals
| or 115 for named constants.

Elements in an array/table | Maximum of 9999 per array/table.


(positions 36 through 39 of |
extension specifications) |
File | Maximum of 50 per program.
Levels of nesting in structured | Maximum of 100.
groups |
Look-ahead | Can be specified only once for a
file. Can be specified only for
primary and secondary files.
Named Constant | Maximum length of 256 for
character named constant, 512 for
hexadecimal named constant, and
|
| | 30 digits with 9 decimal
|
Frequently Asked Questions in AS/400
Page 27
| | positions for numeric named
|
| | constant.
| Overflow indicator | Only 1 unique overflow indicator
| | can be specified per printer
| | file.
| Parameters | Maximum of 255
| Primary file (P in position 16 of | Maximum of 1 per program.
|
| file description specifications) |
| Printer file (PRINTER in positions | Maximum of 8 per program.
|
| 40 through 46 of file description |
|
| specifications) |
| Printing lines per page | Minimum of 2; maximum of 112.
| Program status data structure | Only 1 allowed per program.
| Record address file (R in position | Only 1 allowed per program.
|
| 16 of file description |
|
| specifications) |
| Record length for program | Maximum length is 9999. (1)
|
| described file (positions 24 |
Some ILE RPG Features:

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

| through 27 of file description |


|
| specifications) |
| Structured groups (see levels of |
|
| nesting) |
| Subroutines | Maximum of 254 per program.
| Tables (see arrays) |
| (1)Any device record size restraints override this value.

Download - Program Source


Submit Jobs - right click save as msdsbmjob.cl

Frequently Asked Questions in AS/400


Page 28
Helps you manage your applications. It allows the user to control which printer
the reports will be printed on and how many copies will be printed. Just before a
job is submitted, a prompt will ask the user "outq" & "Copies". The benefit, it
allows the user to control their jobs. If you do not give the end user control, they
will buy a PC and get the control required. The data processing department does
not own the computer, they just provide a service to the rest of the company.
Lighten up, quit hiding the power of the AS400, and share it.

After installing you should execute


UPDDTA AMUS00
and add users authority to programmers so they can run interactive & control
the jobq and priority.

SBMJOBS Submit Job Example


The command to submit a job is SBMJOBS. Put this command in you CLP
programs instead of IBM's SBMJOB.
SBMJOBS JOBNAM(MSD04) COMMAND('DSPLIB LIB(MSD04) OUTPUT(*PRINT)')

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

Frequently Asked Questions in AS/400


Page 29
OUTPTY Report outq schedule priority
1 - 9, 1 will schedule before 9
JOBHLD Run at night
N = Submits to normal jobq.
Y = Submits to NITES jobq.
This allows users to run jobs after the nightly billing has finished. The NITES
queue will be on hold during the day. It is released by your billing job. Then it is
reholds after all jobs in the NITES queue is complete. You will need to create the
NITES Queue, and put the following commands at the end of your nightly billing
job.
RLSJOBQ JOBQ(NITES)
SBMJOB CMD(HLDJOBQ JOBQ(NITES)) JOB(HLDJOBQ) JOBQ(NITES) JOBPTY(9)
SCHMDY Schedule Date
Use this field to specify when a job is to run. Example, you want to run
something on Sunday when the system is not busy.
*Current - eligible to run on today
010194 - eligible to run on 01/01/94
*mon *tue *wed *thu *fri *sat *sun -
Becomes eligible to run next Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday or Sunday.
F4 will not work unless you have down loaded the calendar program. Use it to
Popup a calendar and select the date you wish the job to run on.
Saturday August 12, 2000
Sun Mon Tue Wed Thr Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

Select 8/12/2000
F1=Help F3=Exit Rollup/down

SCHTIM Schedule time


The time of the day the job becomes eligible to run. The time is military, hour,
minute, second.
*current - Immediately eligible to run.
062993 - Eligible June 29th, 1993 to run.
JOBDATE Job Date
Most reports print the job date in the report heading Change this date if you
want a specific date to print.
*SCHEDULE The date the job started running.
*CURRENT The date the job was submitted. RPG uses the job date as the UDATE
& *DATE.
F4 will not work unless you have down loaded the calendar program. Use it to
Popup a calendar and select the date you wish the job to run on.
JOBPTY Job schedule Priority
Valid range from 1 to 9, 1=high, 5=normal, 9=low priority.
Only authorized users can change this field. If you have the menu system, go to
user update and change the "Submit Job Change Priority" field. If you do not
Frequently Asked Questions in AS/400
Page 30
have the menu system, you can UPDDTA AMUS00 and add users that you want
to have this authority,
JOBQ Job Queue
Key in the job queue name.
Only authorized users can change this field. If you have the menu system, go to
user update and change the "Submit Job Change Priority" field. If you do not
have the menu system, you can UPDDTA AMUS00 and add users that you want
to have this authority,
CURLIB Current Library
The current library is always at the top of your library list. The current library is
restored when the job terminates. Programmers are the only users would need
to change this field.
Only authorized users can change this field. If you have the menu system, go to
user update and change the "Submit Job Change Priority" field. If you do not
have the menu system, you can UPDDTA AMUS00 and add users that you want
to have this authority.
CPI Character per inch
No longer used
F24 Run Interactive
Only authorized users see this message. It allows programmers to debug batch
jobs interactively. If you have the menu system, go to user update and change
the "Submit Job Run ICnteractive" field. If you do not have the menu system, you
can UPDDTA AMUS00 and add users that you want to have this authority.
How it works
The submitted job is ran under a shell (control program). The shell overrides the
printer file & calls then executes your command.
Limitations
Overides in to printer files in your commands must say SECURE(*YES).
Parameters are not passed well. Information that needs passed should be put in
the local data area. Example:
Cl prompting program.
chgvar %sst(*lda 101 6) &date
RPG print program.
I UDS
I 101 1060DATE

PCVTSAVPF AS/400 Command


Introduction
The PCVTSAVPF and PCVTPFSAV commands together provide
a simple low-level way of transferring all types of objects between
two ISeries (AS/400, AS400) systems using intermediate save
files and physical files. This is one of the commands in our
ISeries utilities library (click this URL for full contact and pricing
details).
This assumes the following steps:

Frequently Asked Questions in AS/400


Page 31
1) Save object(s) on 1st ISeries to save file using SAVOBJ
command
2) Convert save file to physical file also on 1st ISeries using
PCVTSAVPF command
3) Transmit the physical file to a 2nd ISeries e.g. via DDM or FTP
4) Convert the physical file on the 2nd ISeries back to a save file
using the PCVTPFSAV command
5) Restore the object(s) from the save file onto the 2nd ISeries
using the RSTOBJ command

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.

IBM rebranded the AS/400 - some users called it AS400 - to


ISeries several years ago. All 3 names - ISeries, AS/400, AS400 -
refer to exactly the same system.

Frequently Asked Questions in AS/400


Page 32

Anda mungkin juga menyukai