Kbase 18304: How to Call an AS/400 RPG Program from Native 4GL using EPI
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/15/2008 |
|
Status: Verified
GOAL:
How to call an AS/400 RPG program from native 4GL using EPI.
FACT(s) (Environment):
Progress/400 DataServer
FIX:
This solution applies to Progress/400 Native 4GL. Starting in release 8.0C10, Progress/400 allows the Progress 4GL programs running natively on the AS/400 (using the Progress/400 Native Client) to call OS/400 HLL (High Level Language) programs.
For details about this, see the Progress/400 DataServer Guide paragraph 2.11.9 EPI CALL Command.
Following there is an example of an RPG program called from a Native 4GL program:
Progress 4GL program:
/* testcall.p */
DEF NEW SHARED VAR param1 AS CHAR FORMAT "X(50)".
DEF NEW SHARED VAR param2 AS DEC FORMAT "999.9999".
DEF NEW SHARED VAR stat AS INT.
DEF NEW SHARED VAR msg AS CHAR EXTENT 50 FORMAT "X(50)".
DEF VAR i AS INT FORMAT ">9".
ASSIGN param1 = "Test"
param2 = 3.14156.
OUTPUT TO PRINTER.
DISPLAY param1 param2 WITH FRAME framea.
OS400 EPI STATUS(stat) MESSAGES(msg)
CALL PGM(*LIBL/TESTRPG)
PARM(param1 AS CHARACTER(50) USE INPUT-OUTPUT)
PARM(param2 AS PACKED(8, 4) USE OUTPUT).
DISPLAY param1 param2 WITH FRAME frameb.
DISPLAY "Error: " OS-ERROR " Status " stat WITH FRAME framec.
DO i = 1 TO stat WITH DOWN:
DISPLAY "Msg" i msg[i].
END.
OUTPUT CLOSE.
RPG program:
/* TESTCLP */
H
*
C *ENTRY PLIST
C PARM PARM1 5
C PARM PARM2 84
C MOVE 'WORKS' PARM1
C MOVE 1234567 PARM2
C RETRN
To test the example you have to:
1. You need to add PROGRESS and IFSTOOLS library to your library list.
2. Use EDTF to edit the Progress 4GL program.
3. Use STRPDM to edit and compile the RPG program.
4. Run the program: STRPROCLI testcall.p