RPG/400
Report Program Generator is a structural programming language originated in S/36 and S/38 systems. It was available in two versions, viz., RPG-I and RPG-II. When RPG/400 was introduced in AS/400 it was the third version of the same also known as RPG-III. RPG-III. It was mainly used for report generation as the name suggests but it has become the first choice on AS/400 to build application. It is a fixed format, column based language, i.e, everything in this language is coded based on the columns in a fixed format format of 7 available specifications. That means a specific intruction has to be typed in specific column only. This column arrangement also does not remain the same through out the program. The column arrangement is different declaration or operation. These are called as HFELICO. It is totally indicator oriented, i.e, extensive use of indicators is made in this language. The HFELICO stands for the following : H – Header Specifications used to specify the date format etc. within a given program. There cannot be more more than one H spec. in an RPG program. F – File Specifications used to declare the files used in an RPG program along with their attributes. E – Extension Specifications Specification s used to define arrays or tables. A maximum of 256 arrays can be used in one RPG program. L – Line specifications used to define the no. of lines in a report etc. I – Input Specifications used to define the working data structures. C – Calculation specifications used for the main logic control. The arithmetic calculation and logical data processing is done in this spec. O – Output specifications used to define the format of the program generated reports.
The most important thing to be remembered is that the order of these specifications cannot be altered. They should be present in the same order as they have been mentioned here above. The following are the pages showing the coding sheets for the respective specifications.
Another feature of RPG/400 is it has indicator oriented logic. Indicator is a predefined logical field which can either be OFF or ON. The status is changed system or by developer. Most of the conditioning in programs is done using these indicators. There is a set of pre-defined indicators. In case of indicators changed by system the status of indicator depends on the success or failure of any operation. For example 75 is one of the general purpose indicator. If it assigned by developer to a READ operation. It is set off by system when system could read a record. Thus it helps to decide whether requested record found. It also helps to repeat a loop till the end of file. Or in following chart we have 1P and OA indicator program can instruct system to print heading on the top of first every successive page when 1P or OA is ON. As mentioned earlier, there are many indicators used in this language to control the flow of the program. They can be categorized and tabulated as follows:
SL. NO. 1.
INDICATO R 1P
2.
OA – OG, OV
3.
01 – 99
4.
L1 – L9
5.
LR
6.
M1 – M9
DESCRIPTION
First Page Indicator
‘ON’ STATUS
USAGE
Only when the Print the first page of headings on report is the first page. encountered. Overflow Indicators Page-break Print the headings on the subsequent pages. General Purpose Could be Conditional. Indicators explicitly controlled. Level Break Indicators When a key Report subvalue changes total printing. Last Record Indicator When EOF Print report occurs. summary or terminate the program. Match Field Indicator When a match- To assign and field is read. detect and matching
7.
MR
8.
U1 – U8
9.
KA – KN, KP – KY
Match Record
When a match occurs.
External Indicators
When turned externally.
Function Key Indicators
When a function key is pressed.
field. Print data from multiple files. Conditional file processing. Function Key processing.
Note : A thumb rule with these indicators is that whenever a high level indicator is set on all the the lower levels automatically get on. For example, when LR is on all other indicators (like L1 – L9) are automatically switched on.
There are basically two programming styles with RPG – 1) RPG Logic Cycle 2) User Logic. RPG logic cycle is best suited for report generation as it is totally controlled by the system whereas the user logic is best suited for user application because it is at the sole discretion of the user. 1) RPG Logic Cycle : A logic cycle is a series of steps performed by RPG to process an individual record. In this style of programming, the system takes entire control of the files used and the files are opened, read and closed automatically. In this process, there are two cycles which take place, viz., a) One file is designated as Primary file which is processed (READ) by system implicitly without any READ operation on that file. b) No loop is used to READ successive records of primary file. c) The first cycle is the opening where the files are opened, read and records are processed for the first time. d) The subsequent cycle where the rest of the records are processed, therefore, the file opening is not required here. During the cycle the calculations are done twice: a) Detail Time : The calculations are performed after the read of every individual record. b) Total Time : The calculations are performed for a group of records together. During the cycle the printing operations are performed 4 times: a) Heading Time : The headings, titles, etc. are printed during the heading time for eg. Company Name, Column Headings etc.
b) Detail Time : The printing is done after the processing of every record in the file. c) Total Time : The printing is performed for group totals, i.e., whatever calculations are made for a group of records. d) Exception time : This is exception for some specific conditions which are specified in the type column the O specs.
2) User Logic : This style of programming allows the user to specify all the conditions and the programmer takes the total control of the logic and flow of the program.
As discussed earlier, the user takes the charge of the full programming logic and control. So, the various arithmetic and logical operations to be performed in the program are controlled by the so called OPCODEs. These OPCODEs are five letter words, generally the short forms of the verb describing the action to be performed. For eg., ADD – means arithmetic addition SUB – represents subtraction MULT – implies multiplication MVR – implies moving the remainder IFxx – indicates an IF condition where xx represents any values like EQ (Equals), NE (Not Equals), GE (Greater than Equal to) etc. So, let’s discuss some some of the OPCODES in detail. These OPCODES are used in the OPCODE column provided in the C-Specs and perform the operations generally on the operands that are mentioned in the Factor-1 and Factor-2 columns provided to the left and right of the OPCODE column in the C-specs respectively. To start with some of the arithmetic OPCODES: ADD – Performs an arithmetic addition on the two Operands, and the result can be stored in the Result field. Factor-1 Opcode Factor-2 Result-Field A ADD B C
Means C=A+B Thus the columns in C-Spec are used for operation. Factor-1 Opcode Factor-2 ADD B Means C=C+B
Result-Field C
SUB – Subtracts Factor-2 from Factor-1 and stores the result in the Result field.
DIV – Factor-2 divides Factor-1 and the quotient is stored in the Result Result field. In case, the remainder is to be stored the OPCODE to be used is MVR followed by a DIV.
Some more OPCODES,
Z-ADD – It zeroises, i.e., makes the value to zero of the Result field and then writes the new value (specified in the Factor-2) into it.
Screen related OPCODES, EXFMT – Executes the screen format specified in Factor-2. WRITE – Writes the screen format specified in Factor-2. CLEAR – Clears the record format specified in Factor-2. READC – Used in subfiles to read the changed records.
File related OPCODES, CHAIN – Randomly searches for the record specified in Factor-2 based on the field value specified in Factor-1. READ – Reads the record specified in the Factor-2. READP – Reads the record previous to where the record pointer currently is. REDPE – Reads the prior equal record. READE – Reads the record for which the Factor-1 field value matches. WRITE – Writes to a record. UPDAT – Updates a record. DELET – Deletes a record.
Structured OPCODES, IFxx – For the IF conditions where the xx represent values like above under the same comparision conditions. DO – Performs a loop as many no. of times as specified in Factor-2.
DOWxx – For the Do While loop where xx could be values like EQ – for equal LE – Less than Equal GE – Greater then Equal LT – Less Than GT – Greater than where the comparision is made between Factor-1 and Factor-2. DOU – For the Do UNTIL loop where the loop is executed based on the value in Factor2.
The major difference between DOU and DOW is that DOU is performed atleast once and the condition is checked for only after a single execution of the loop whereas the DOW loop pre-checks the condition and hence will not be executed even once until and unless the condition is satisfied. GOTO – Least advised keyword which will take the control of the program to a point indicated by the TAG OPCODE. ITER – Iterates a loop, i.e., ignores all the statements below it and goes to the beginning of the DO loop. LEAVE – Leaves the loop ignoring all the statements below it and continues execution after the end of the ENDDO statement. CASEQ – For the case operation, ended by ENDCS.
General Opcodes, MOVE – Moves the value specified in Factor-2 into the Result field. MOVEL – Moves the values specified in Factor-2 into the Result field with a left alignment. DSPLY – Displays the value of the variable specified in Factor-1 in the console and not in userdefined screens. COMP – Compares the values in Factor-1 and Factor-2. CAT – It will concatenate the two strings from Factor-1 and Factor-2 and stores in the Result field. SST – The substring operation. Extracts from Factor-2 (specified alongwith the start point) the no. of characters specified in the Factor-1.
SCAN – Searches for the string specified in Factor-1 in the string specified in Factor-2 (alongwith the start point). KLIST – Specifies the list of Key fields – used for creating composite keys in the programs. PLIST – Used to specify the parameter list in a program. PARM – Used to specify the parameter. SETON – Sets On the indicator specified in HI, LO or EQ. SETOF – Sets Off the indicator specified in HI, LO or EQ.
Sub-routine related OPCODES, EXSR – Executes the subroutine mentioned in the Factor-2. BEGSR – Indicates the beginning of Subroutine. ENDSR – Indicates the end of a subroutine. EXCPT – To process exceptional time output in the Printer Files (O Specs also).
Data Areas
A Data Area is an Object on AS/400 of the type *DTAARA. This stores a single value of data in a flat format and can be used by one or many many programs. However, the data area can be locked when in use by one program so as to allow synchronized use of the resource. There are essentially four types of Dataareas, viz., Local Data Area(*LDA), Program Initialized Parameter Data Area (*PDA), Group Data Area(*GDA) and the general data area. a) The Local Data Area is associated with the current job only (it’s a character data area of 1024 bytes length). b) The Program Initialized Parameter Data Area is associated with a pre-start job (max. length 2000 bytes). c) The Group Data Area is associated with the group job (character data area with 512 bytes length). d) General Data Area created by the users (can be of type character, decimal or logical).
Data Structures
It is a storage area with the definition of its sub-fields. Generally, a data structure is defined in a program but it can also be externally defined or a data area data structure. In an externally defined data structure, an external file is defined which is used as a data structure where the fields of the file act as sub-fields of a data structure. In a data area data structure, a data area is defined and is used as a data structure. There is also a File Information data structure (INFDS), which gives error/exception information that may have occurred when processing a file during program execution. The sub-fields are predefined and they identify the name of the file, record processed, operation being processed, the status code number and the RPG/400 routine in which the error occurred. There is yet another category, viz., Program Status data structure (SDS) which gives the status of the program and can be used along with the RPG provided *PSSR (Program Status Sub-Routine) to handle the errors.
Arrays in AS/400
There are basically 3 kinds of arrays in AS/400, viz., 1) Pre-run Time Array 2) Run Time Array 3) Compile Time Array Pre-run Time Array : Such an array is populated with data just before the execution of the program. The data for this array is stored in a table (physical file) and is loaded by the system itself. Run Time Array : Such an array gets loaded during the execution of the program. The data is to be loaded programmatically by the user. Compile Time Array : Such an array gets populated during the compile time. Values to this array are defined at the bottom of the source code. When compiled, they become a permanent part of the program object. Following is a general example to define an array (Compile time array) :
Prompt type . . . From Length Filename of Entry
E
To Filename P/B/L/R
Sequence number . . .
'''''''
Table
- Entries per --
Name
Record
ARY
Table
1
3
40
Decimal Sequence Decimal Positions (A,D) P/B/L/R Positions Sequence
Alternate Name
Length of Entry
Comment
Defining Tables is also possible in RPG/400. The major difference between an Array and a Table is that an array can be processed by the index and its individual elements can be accessed using the index, whereas, in case of a table it is not possible the LOKUP operation has to be performed and the elements can be accessed only sequentially.
Subfiles
Subfiles are an important part of RPG programming. A subfile is a logical group of records which can be used to view/update data. It is used to handle more than one record at a time. They are a part of the files created using SDA, i.e., the display file. It comprises of two record formats, viz., the subfile record format (containing data) and the subfile control record format (controlling the data). There are five essential keywords to make a subfile work. They are, viz., SFLDSP, SFLDSPCTL, SFLCLR, SFLPAG, SFLSIZ.
SFLDSP – enables the subfile to be displayed. SFLDSPCTL – enables the display of subfile control format. SFLCLR – clears the subfile of any records it may previously contain. SFLPAG – specifies the no. of records a subfile page may contain. SFLSIZ – specifies the total no. of records contained in a subfile. There are three types of subfiles, namely, Elastic subfile where SFLPAG
explicitly programmed. The third category is where SFLPAG = SFLSIZ-1, and in this kind of subfile only the roll-down operation has to be taken care of. However, the nonelastic subfile also known as Single Page subfile is the most efficient one. An example has been provide for the same. Subfiles can also be used for updation and deletion of data from the physical files.
Subroutines
They are integral part of the program objects, which are coded at the end of the program source. They can be called from anywhere within the program using the EXSR OPCODE. They increase the readability of the program and make complex programs appear much simple. RPG programs also allow call to external programs using the CALL opcode alongwith which the list of parameters can be specified using the PLIST and individual parameters mentioned using the PARM OPCODE.
Some examples overleaf would exemplify the OPCODES and their usages.
Given below is an example for RPG Logic Cycle program. 0001.00
FSAMEER3 IP
E
K
DISK
0002.00 FMYREPO 0003.00 IEMPREC 0005.00 C 92 0006.00 C 92 0011.00 OMYREPO 0012.00 O 0013.00 O REPORT' 0014.00 O 0015.00 O 0016.00 O -----------------' 0017.00 O -----------------' 0018.00 O -----------------' 0019.00 O 0020.00 O 0021.00 O CODE' 0022.00 O 0023.00 O 0024.00 O 0025.00 O 0026.00 O 0027.00 O -----------------' 0028.00 O -----------------' 0029.00 O -----------------' 0030.00 O 0031.00 O 0032.00 O 0033.00 O 0034.00 O 0035.00 O 0036.00 O -----------------' 0037.00 O 0038.00 O TOTAL' 0039.00 O 0040.00 O 0041.00 O
O
F 60
H 22 OR
80
OA
PRINTER
ADD
BASIC
TBAS
ADD
DA
TDA
1P OA 47 'SALARY
H 02 OR
1P OA 23 '-----46 '-----69 '------
H 02 OR
1P OA 15 'EMP 30 'NAME' 52 'BASIC' 66 'DA'
H 01 OR
1P OA 23 '-----46 '-----69 '------
D 11
60 EMPCD EMPNM BASIC J DA J
T 20
15 45 56 70
L1 70 '------
T 20
L1 30 'DEPT DTBAS JB 56 DTDA JB 70
T 20
L1
0042.00 O -----------------' 0043.00 O T 10 LR 0044.00 O '***********************' 0045.00 O T 20 LR 0046.00 O TOTAL' 0047.00 O TBAS 0048.00 O TDA ****************** End of data ****************************************
70 '------
70
30 'GRAND J J
56 70
Given below is an example illustrating the a screen file used to toggle between the records of a Physical file. It also illustrates the use of constants as array messages (I SPECS).
Columns . . . : 1 71 Edit STDLIB/SAMMAN SEU==> RPGDEPT FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++ Entry+A....U *************** Beginning of data ************************************* 0001.00 FDEPART IF E K DISK A 0002.00 FSCREEN2 CF E WORKSTN 0003.00 I 'ALREADY AT TOP' C M1 0004.00 I 'ALREADY AT BOTTOM' C M2 0005.00 I 'RECORD SAVED' C M3
0006.00 50 0007.00 0008.00 0009.00 IS 0010.00 0011.00 0012.00 50 0013.00 0014.00 0015.00 0016.00 50 0017.00 0018.00 0019.00 50 0020.00 0021.00 0022.00
0023.00 0024.00 0025.00 0026.00 50 0027.00 0028.00 0029.00
0030.00 0031.00 0032.00 0033.00 0034.00 0035.00 0036.00 0037.00
C
READ DEPTREC
C *IN03 C C * TO REMOVE THE MESSAGE PRESSED .* C *IN04 C *LOVAL C C C C C C C C
DOWEQ*OFF EXFMTDEPTSCR MOVE BLANKS MSG WHEN NEXT FUNCTION KEY IFEQ *ON SETLLDEPTREC READ DEPTREC
*IN05 *HIVAL
ENDIF IFEQ *ON SETLLDEPTREC READPDEPTREC
*IN06
ENDIF IFEQ *ON READ DEPTREC
C *IN50 IFEQ *ON C MOVELM2 MSG C *HIVAL SETLLDEPTREC * WHEN POINTER REACHES EOF THEN IT GOES IN THE NO RECORD AREA HENCE TO GET IT WORKING PROPERLY THE POINTER HAS TO BE FORCE POSITIONED AT THE EOF RECORD HENCE THIS . * C ENDIF C ENDIF C *IN07 IFEQ *ON C READPDEPTREC C *IN50 IFEQ *ON C MOVELM1 MSG C *LOVAL SETLLDEPTREC * WHEN POINTER REACHES BOF THEN IT GOES IN THE NO RECORD AREA HENCE TO GET IT WORKING PROPERLY THE POINTER HAS TO BE FORCE POSITIONED AT THE BOF RECORD HENCE THIS . * C ENDIF C ENDIF C *IN08 IFEQ *ON C CLEARDEPTSCR C ENDIF C *IN09 IFEQ *ON C WRITEDEPTREC C MOVELM3 MSG
0038.00 0039.00 0040.00 LR
* TO GET THE MSG ‘ RECORD SAVED ’ C ENDIF C ENDDO C SETON
****************** End of data ****************************************
Given below is an example to demonstrate the use of an array: SEU==> RPGARY FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++ Entry+A....U *************** Beginning of data ************************************* 0001.00 FDEPART IF E K DISK A 0002.00 FSCREEN2 CF E WORKSTN 0003.00
E
0007.00 50 0008.00 0009.00 0010.00 0011.00 0012.00 0013.00 50 0014.00 0015.00 0016.00 0017.00 50 0018.00 0019.00 0020.00 50 0022.00 0023.00 0025.00 0026.00
C
ARY
3 40
READ DEPTREC
C C C C C C
*IN03
*IN04 *LOVAL
C C C C C C C C C C C
1
50 50
DOWEQ*OFF EXFMTDEPTSCR MOVE *BLANKS IFEQ *ON SETLLDEPTREC READ DEPTREC
*IN05 *HIVAL
ENDIF IFEQ *ON SETLLDEPTREC READPDEPTREC
*IN06
ENDIF IFEQ *ON READ DEPTREC
*HIVAL *IN07
MOVEL ARY,2 ARY,2 SETLLDEPTREC ENDIF IFEQ *ON
MSG
MSG
0027.00 50 0029.00 0030.00 0032.00 0033.00 0034.00 0035.00 0036.00 0037.00 0038.00 0039.00 0040.00 0041.00 LR 0042.00 0043.00 0044.00 0045.00
C C C C C C C C C C C C C
READPDEPTREC 50 50
*LOVAL *IN08
*IN09
ARY,1 ARY,1 MOVEL SETLLDEPTREC ENDIF IFEQ *ON CLEARDEPTSCR ENDIF IFEQ *ON WRITEDEPTREC MOVEL ARY,3 ARY,3 ENDIF ENDDO SETON
MSG
MSG
** 'ALREADY AT TOP' 'ALREADY AT BOTTOM' 'RECORD SAVE' ****************** End of data ****************************************
The following is an example to illustrate the use of subfile: Columns . . . : 1 71 Edit STDLIB/SAMMAN SEU==> RPGSUB FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++ Entry+A....U *************** Beginning of data ************************************* 0001.00 FSYNTEL1 IF E K DISK A
0002.00 0003.00 KSFILE MYSFL 0004.00 30 0005.00 60 0006.00 0007.00 60 0008.00 0009.00 55 0010.00 0011.00 0012.00 0013.00 55 0014.00 0015.00 0016.00 LR
FSCREEN4 CF F
E
WORKSTN REC
C
MOVE 0
C
SETON
C C
WRITEMYCTL SETOF
C C
*LOVAL
SETLLEMPREC READ EMPREC
C C C C
*IN55
DOWEQ*OFF ADD 1 WRITEMYSFL READ EMPREC
C C C
REC
REC
ENDDO EXFMTMYCTL SETON
Given below is an example demonstrating a Data area: Columns . . . : 1 71 Edit STDLIB/SAMMAN SEU==> DATAPGM FMT C .....CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEq Comments++++ *************** Beginning of data ************************************* 0001.00 C *NAMVAR DEFN DATR00 TEMP 50 0002.00 C *LOCK IN TEMP 0003.00 C ADD 200 TEMP 0004.00 C OUT TEMP 0005.00 C UNLCKTEMP 0006.00 C TEMP DSPLY 0007.00 C SETON LR ****************** End of data ****************************************
Given below is an example demonstrating a Local Data area: *************** Beginning of data ************************************* E COM 1 1 80 ILDADS DS 1024 I 1 50 FLD01 * Calling CL command from RPG C Z-ADD62 LENGTH 155 C CALL 'QCMDEXC' C PARM COM,1 C PARM LENGTH C *NAMVAR DEFN *LDA LDADS * Using *LDA from RPG C IN LDADS C FLD01 DSPLY C SETON LR ** CHGDTAARA DTAARA(*LDA (1 50)) VALUE('VENKATRAMAN AKKINEPALLY') ****************** End of data ****************************************
Given below is an example for single page subfile : The following is the database file on which the screen is built.
*************** Beginning of data ************************************* A R PREC A PCODE 3 0 A PDSC 10 A RATE 3 0 A K PCODE ****************** End of data ****************************************
The following is the example for display file with page equal subfile: *************** Beginning of data ************************************* A*%%TS SD 20011022 151748 KIRAN 5769-PW1 A*%%EC
REL-V4R4M0
A *DS3) A R MYSFL A*%%TS SD 20011022 151748 KIRAN 5769-PW1 A PCODE R O 13 21REFFLD(PREC/PCODE TRNGLIB/PRODPF@) A PDSC R O 13 34REFFLD(PREC/PDSC TRNGLIB/PRODPF@) A RATE R O 13 51REFFLD(PREC/RATE TRNGLIB/PRODPF@) A R MYCTL A*%%TS SD 20011022 151748 KIRAN 5769-PW1 A A A A N31 A N31 A 31 A 32 A A A 6 SUBFILE' A A A 8 Page down for other re A EXIT)' A 11 A A 11 A A 11 A ****************** End of data ****************************************
DSPSIZ(24 80 SFL REL-V4R4M0
SFLCTL(MYSFL) REL-V4R4M0 PAGEUP(33) PAGEDOWN(34) CA03(03) SFLDSP SFLDSPCTL SFLCLR SFLEND(*MORE) SFLSIZ(0005) SFLPAG(0005) 31'SINGLE PAGE DSPATR(RI) DSPATR(UL) 15'(Page up or cords, F3 17'Product Code' DSPATR(UL) 34'Description' DSPATR(UL) 50'Rate' DSPATR(UL)
The following is the code for the RPG program using a page equal subfile : *************** Beginning of data ************************************* FPRODPF@ IF E K FSUBSDA@ CF E
DISK WORKSTN
F MYSFL
RECNO KSFILE
*********************************************************** ****** * 31 - SFLCLR, 32 - SFLEND, 33 - ROLLUP, 34 ROLLDOWN, 35 - READ *********************************************************** ****** C *IN03 DOWEQ*OFF C *IN33 CASEQ*ON PAGEUP C *IN34 CASEQ*ON PAGEDN C ENDCS C EXFMTMYCTL C ENDDO C SETON LR *********************************************************** ****** * THIS SUBROUTINE IS CALLED AT THE START-UP *********************************************************** ****** C *INZSR BEGSR C Z-ADD0 RECNO 30 C EXSR LOAD C ENDSR *********************************************************** ****** * SUBROUTINE FOR CLEARING THE SUBFILE *********************************************************** ****** C SUBCLR BEGSR C SETON 31 C WRITEMYCTL C SETOF 31 C ENDSR *********************************************************** ****** * SUBROUTINE FOR LOADING THE SUBFILE *********************************************************** ******
C C C C C C C C C C C C C C
LOAD
N35 *IN35
BEGSR SETOF Z-ADD0 DO 5 READ PREC ADD 1 IFEQ *OFF WRITEMYSFL ELSE SETON LEAVE ENDIF ENDDO ENDSR
32 RECNO 35 RECNO
32
*********************************************************** ****** * SUBROUTINE FOR HANDLING PAGE UP *********************************************************** ****** C PAGEUP BEGSR C SETOF 33 C RECNO IFLT 5 C PCODE SETLLPREC C ENDIF C RECNO ADD 5 TEMP 30 C DO TEMP C READPPREC 66 C ENDDO C *IN66 IFEQ *ON C *LOVAL SETLLPREC C ELSE C PCODE SETGTPREC C ENDIF C EXSR SUBCLR C EXSR LOAD C ENDSR *********************************************************** ****** * SUBROUTINE FOR HANDLING PAGE DOWN *********************************************************** ****** C PAGEDN BEGSR C SETOF 34
C C C C C
*IN35
DOWEQ*OFF EXSR SUBCLR EXSR LOAD ENDDO ENDSR
****************** End of data ****************************************
The following is the code to call an external RPG program using CALL & PLIST: Columns . . . : 1 71 Edit TRNGLIB/SUB SEU==> RPGMN FMT C .....CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEq Comments++++ *************** Beginning of data ************************************* 0001.00 C PNAME PLIST 0002.00 C PARM A 30 0003.00 C PARM B 30 0004.00 C PARM C 40 0005.00 C Z-ADD10 A 0006.00 C Z-ADD20 B 0007.00 C Z-ADD0 C 0008.00 C CALL 'RPGCL' PNAME 0009.00 C C DSPLY 0010.00 C SETON LR 0011.00 *CALLING PROGRAM ****************** End of data **************************************** Columns . . . : 1 71 Edit TRNGLIB/SUB SEU==> RPGCL FMT C .....CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEq Comments++++ *************** Beginning of data *************************************
0001.00 0002.00 30 0003.00 30 0004.00 40 0005.00 0006.00 0007.00 0008.00
C C
PLIST PARM
P1
C
PARM
P2
C
PARM
P3
ADD P2 DSPLY RETRN
P3
C C C
*ENTRY
P1 P3
*CALLED PROGRAM ****************** End of data ****************************************