RPG/400 Help

PLIST (Identify a Parameter List)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| PLIST   | PLIST name    |                 |                |               |
*---------*---------------*-----------------*----------------*---------------*

The declarative PLIST operation defines a unique symbolic name for a parameter list to be specified in a CALL operation.

You can specify a PLIST operation anywhere within calculations, including within total calculations and between subroutines. The control level entry (positions 7 and 8) can be blank or can contain an L1 through L9 indicator, an LR indicator, or an L0 entry to group the statement in the appropriate section of the program. The PLIST operation must be immediately followed by at least one PARM operation. Conditioning indicator entries (positions 9 through 17) are not allowed.

Factor 1 must contain the name of the parameter list. If the parameter list is the entry parameter list of a called program, factor 1 must contain *ENTRY. Only one *ENTRY parameter list can occur in a program. A parameter list is ended when an operation other than PARM is encountered.

Figure "PLIST/PARM Operations" illustrates the PLIST operation.

PLIST Example

Figure 44. PLIST/PARM Operations

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*
C*  In the calling program, the CALL operation calls PROG2 and
C*  allows PROG2 to access the data in the parameter list fields.
C                     CALL 'PROG2'   PLIST1
C*
C*  In the second PARM statement, when CALL is processed, the
C*  contents of factor 2, *IN27, are placed in the result field,
C*  BYTE.  When PROG2 returns control, the contents of the result
C*  field, BYTE, are placed in the factor 1 field, *IN30.  Note
C*  that factor 1 and factor 2 entries on a PARM are optional.
C*
C           PLIST1    PLIST
C                     PARM           AMT     52
C           *IN30     PARM *IN27     BYTE    1
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C                     CALL 'PROG2'
C*  In this example, the PARM operations immediately follow a
C*  CALL operation instead of a PLIST operation.
C                     PARM           AMT     52
C           *IN30     PARM *IN27     BYTE    1
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*  In the called program, PROG2,  *ENTRY in factor 1 of the
C*  PLIST statement identifies it as the entry parameter list.
C*  When control transfers to PROG2, the contents of the result
C*  fields (FLDC and FLDG) of the parameter list are placed in
C*  the factor 1 fields (FLDA and FLDD).  When the called program
C*  returns, the contents of the factor 2 fields of the parameter
C*  list (FLDB and FLDE) are placed in the result fields (FLDC
C*  and FLDG).  All of the fields are defined elsewhere in the
C*  program.
C           *ENTRY    PLIST
C           FLDA      PARM FLDB      FLDC
C           FLDD      PARM FLDE      FLDG


[ Top of Page | Previous Page | Next Page | Table of Contents ]