Progress/400
Product Guide


The PROCALL Program

The PROCALL program allows the OS/400 HLL to call and pass parameters to a Progress 4GL program. PROCALL accepts up to 32 parameters. The first is the name of the called program, and the remaining parameters are used to pass input to and output from the Progress 4GL program.

The following CL and RPG programs demonstrate how to use the PROCALL program. The Progress 4GL program demonstrates how the 4GL handles entry parameters:

CL Program That Calls a Progress Program
PGM
DCL    VAR(&DOTP) TYPE(*CHAR) LEN(128)
DCL    VAR(&PARM1) TYPE(*CHAR) LEN(50)
DCL    VAR(&PARM2) TYPE(*DEC) LEN(15 5)
CHGVAR VAR(&DOTP) VALUE(‘/anydir/sample.p’)
CHGVAR VAR(&PARM1) VALUE(’OLD VALUE’)
CHGVAR VAR(&PARM2) VALUE(12.345678)
CALL   PGM(PROCALL) PARM(&DOTP &PARM1 &PARM2)
ENDPGM 

RPG IV Program That Calls a Progress Program
I   ’/anydir/sample.p’     C     DOTP
C*
C            CALL   ’PROCALL’
C            PARM   DOTP     PROC  128
C            PARM   ’HELLO’   PARM1 50
C            PARM   16.654    PARM2 150
C* 

Progress Program sample.p
DEFINE NEW SHARED VARIABLE sts AS INTEGER.
DEFINE NEW SHARED VARIABLE msgarr AS CHARACTER EXTENT 1.
DEFINE NEW SHARED VARIABLE parm1 AS CHARACTER.
DEFINE NEW SHARED VARIABLE parm2 AS DECIMAL.
OS400 EPI STATUS(sts) MESSAGES(msgarr)
      ENTRY PARM(parm1 AS CHARACTER(50) USE INPUT-OUTPUT)
            PARM(parm2 AS DECIMAL(15, 5) USE INPUT-OUTPUT).
OUTPUT TO PRINTER.
DISPLAY parm1 parm2 WITH DOWN.
DOWN.
parm1 = "NEW VALUE".
parm2 = 87.65432.
DISPLAY parm1 parm2.
OUTPUT CLOSE.
OS400 EPI STATUS(sts) MESSAGES(msgarr) EXIT. 

PROCALL Parameters

PROCALL can accept up to 32 parameters. The first parameter must be the name of the Progress 4GL program name that you want to call. You must pass a name that conforms to IFS naming conventions. If the stream file does not exist, Progress/400 displays an error and the call to PROCALL does not complete normally. PROCALL is designed primarily for RPG and CL, hence the first parameter must be defined as a 128-byte character field and must be space padded on the right. It cannot be NULL terminated.

Progress/400 considers any other parameters passed to the PROCALL program to be parameters to the 4GL program. These parameters must also be passed using the RPG or CL standards. The following rules apply:

If you pass more than 32 parameters to PROCALL, it returns an error.

For a table of rules to follow when defining the mapping between Progress and OS/400 data types, see the "DB2/400-to-Progress Data Type Mapping" section in Common Product Information."

EPI ENTRY Command

When you call a Progress 4GL program, the external parameters passed to the 4GL are defined using the EPI ENTRY command. Progress uses the same syntax for the EPI ENTRY command and for the EPI CALL command, except that with EPI ENTRY you need not specify the PGM parameter.

Once you run the EPI ENTRY command, the shared variables set up in the PARM parameters are assigned the values passed from the PROCALL program. You define parameters for EPI ENTRY using the PARM parameter. The USE parameter of the PARM keyword has the following meaning:

Here is an example of the EPI ENTRY command:

OS400 EPI STATUS(sts) MESSAGES(msg)
ENTRY
PARM(prog-var[extent] AS TYPE(len, decimals) USE use)  

EPI EXIT Command

Use the EPI EXIT command to send parameters back to the caller. The command does not have parameters; its only purpose is to save the shared variable values declared in the EPI ENTRY command so that the calling HLL program can retrieve them.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095