Progress/400
Product Guide
EPI CALL Command
The EPI CALL command allows the Progress 4GL to call programs written in languages supported by OS/400. A called program can receive data in parameters and can return data to a Progress 4GL program in the same parameters.
The following restrictions apply to any OS/400 program called from a Progress 4GL program:
- The called program must expect parameters passed by reference. Specifically, the called program must accept an address that points to memory that contains the value of the parameter. For example, CL, RPG, and C programs all expect parameters passed by reference. MI programs can handle parameters passed by value and by reference. Any program that expects parameters passed by value cannot be called by the Progress 4GL.
- A maximum of 32 parameters can be passed to any called program.
- Parameters of the following OS/400 data types are supported:
- The following Progress data types are supported:
For details on data type support, see the "PARM Parameter" section.
Syntax
The syntax for the EPI CALL command is designed for use by both the Progress programmer and the OS/400 programmer. The EPI CALL syntax mixes both Progress and CL constructs, making it familiar to both types of programmers:
PGM Parameter
The CALL statement uses the PGM parameter to specify the name of the program the 4GL program is calling. The value and use of this parameter match those of the PGM parameter on the CL CALL command. You can explicitly specify the library or use the *LIBL. The PGM parameter is required. If you do not specify a library, the Progress 4GL assumes *LIBL. If the program or library is not found, the Progress 4GL places an error message into the MESSAGES variable.
PARM Parameter
The PARM parameter defines what parameters, if any, Progress passes to the called program and how Progress passes them. Any Progress variable used as a parameter for an HLL program must be defined as a SHARED VARIABLE. Defining variables in this fashion allows the value of the variable to be retrieved and changed efficiently. Progress shared variables are passed to an HLL program as a particular data type. The value prog-var contains the name of a Progress variable. The variable must be defined as a shared variable. A single element of a 4GL array (EXTENT field) can also be used as prog-var.
The Progress variable must be one of the following Progress data types:
Progress requires the AS keyword. This states that the Progress variable will be passed to the called program as TYPE, where type indicates an OS/400 data type. The following OS/400 data types are supported:
Each parameter must have an OS/400 data type and a length. When you define the OS/400 data type, also define its length. To do this, use TYPE(len, decimals), where len indicates the length of the program parameter; and decimals, when required, specifies the number of decimal digits. Packed and Zoned parameters must have the number of decimals defined.
Table 11–2 indicates the rules to follow when defining the mapping between Progress and OS/400 data types.
The USE parameter indicates how the Progress 4GL program treats the value of the variable. Table 11–3 describes the USE values.
The following code shows how to construct the EPI command for a call to a CL program:
Example Progress 4GL programs and OS/400 programs are provided with your release. Sample HLL programs are available in the Examples Source File in the Progress-supplied product library.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |