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

5- 21
Figure 5-18 shows how to execute the C procedure shown in Figure 5-16.
The RPG program passes two fields to the C procedure, PNAME and STATUS.
The C procedure may alter the value in STATUS, indicating that an error
occurred in the external subroutine.
Figure 5-18. Using PARM to Pass Information to an External Subroutine
Comments
1 This line moves a program name, RPT10, to the first parameter
field, PNAME. This field is passed to the external subroutine.
2 This line sets the field, STATUS, to zeros. This field is
passed to the external subroutine. The subroutine returns an
error code in this field.
3 This line executes the external subroutine, SUB01. SUB01 is the
C procedure shown in Figure 5-17.
4 This line passes the field, PNAME, to the external subroutine.
(You enter PARM operations immediately after the EXIT
operation.)
5 This line passes the field, STATUS, to the external subroutine.
6 This line tests the value in STATUS. The external subroutine can
modify this field.