RPG Call Operations - PARM (Identify Parameters)

RPG Call Operations: PARM

The PARM operation is part of the classic fixed‑format RPG call interface. It defines the parameters that a program receives when it is called by another program. Even though modern RPG uses prototypes and procedure interfaces, PARM still appears in legacy code and is important for anyone maintaining IBM i applications.

PARM is used in fixed‑format RPG to identify the parameters passed into a program. It works together with the PLIST operation to define a parameter list. When a program is called using CALL, the parameters passed by the caller are matched to the PARM entries in the PLIST.

Fixed‑Format RPG

PLIST NameOfList
PARM Variable1
PARM Variable2
PARM Variable3

Key Concepts

1. PARM is Positional

The order of PARM entries determines how parameters map to the caller. If the caller sends three parameters, the first PARM receives the first value, the second PARM receives the second value, and so on.

2. PARM Works Only with PLIST

PARM cannot exist on its own. It must follow a PLIST operation. PLIST defines the list. PARM defines the items in the list.

3. PARM Variables Must Match the Caller

The data types and lengths of the PARM variables must match the parameters sent by the caller. Mismatch can cause:

  • Data corruption
  • Truncation
  • Program exceptions

4. PARM is for Programs, Not Procedures

PARM is part of the old CALL interface. Modern procedures use prototypes and parameter interfaces instead.

Examples

Example 1: Simple Parameter List

PLIST *ENTRY
PARM          CustNumber
PARM          CustName
PARM          CustBalance

This program expects three parameters in this exact order.

Example 2: Named Parameter List

PLIST GetOrderInfo
PARM                 OrderNumber
PARM                 OrderDate
PARM                 OrderAmount

A named PLIST can be reused in multiple CALL operations.

Example 3: Calling a Program That Uses PARM

Caller program:

CALL 'GETORDER'
PARM MyOrder
PARM MyDate
PARM MyAmount

Called program:

PLIST *ENTRY
PARM OrderNumber
PARM OrderDate
PARM OrderAmount

The variables map positionally.

When to Use PARM

Use PARM when:

  • Maintaining legacy RPG programs

  • Working with fixed‑format CALL interfaces

  • Interfacing with older third‑party applications

  • Migrating old code to modern prototypes

Avoid PARM when:

  • Writing new code

  • Building modular ILE applications

  • Using procedures or service programs

  • Working in free‑form RPG

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>