HP RPG/XL Programmer's Guide (30318-90001)

5- 20
Figure 5-16. Using RLABL to Pass Information to an External Subroutine
Comments
1 This line makes indicator 20 available to an external
subroutine.
Columns 43-48 specifies that indicator 20 is passed to the
external subroutine. (Prefix indicator names by IN.)
2 This line makes the field, PNAME, available to an external
subroutine.
3 This line executes the external subroutine, SUB01.
Using PARM. PARM passes field names, tables and arrays to external
subroutines. PARM does not pass indicators. Also, you must code PARM
operations for each external subroutine called. PARM values are not
globally available to other external subroutines in a program. (See
Figure 8-4 for a complete program that uses external subroutines and
PARM.)
RPG variables used with PARM are passed to external subroutines as byte
values by reference. The corresponding external subroutine variables
must be declared accordingly. (All RPG numeric fields have packed
decimal formats.)
Figure 5-17 shows part of a C procedure that is executed as an external
subroutine. Only the statements defining the data that is passed to the
procedure are shown. Figure 5-18 shows how this C procedure is executed
from an RPG program.
_____________________________________
| |
| VOID SUB01 (PNAME, STATUS) |
| CHAR *PNAME; |
| CHAR *STATUS; |
| { |
| . |
| . |
| . |
| } |
| |
_____________________________________
Figure 5-17. An External Subroutine Written in C