分类:
2011-07-20 10:14:16
1.调用对象
Extproc:main procedure和subprocedure
Extpgm:OPM和ILE *pgm
2.调用性质:
Extproc:静态调用
Extpgm:动态调用
3.传参方式:
Extproc:by reference、by read-only reference、by value
Extpgm:by reference、by read-only reference
4.示例:
Extpro Demo:
pass1.rpgle
HNOMAIN
/INCLUDE QCPYSRC,PASSBY
P BYVALUE B EXPORT
D BYVALUE PI
D PARM1 2P 0
D PARM2
C IF PARM1 = 1
C RETURN PARM2+'LIKE RPG III'
C ELSE
C EVAL PARM2 = 'LIKE RPG'
C RETURN PARM2+'LIKE RPG IV'
C ENDIF
P E
D AAA PR
D A1 2P 0
D A2
D NUM S 2P 0
D STRING S
D RESULT1 S
C EVAL NUM = 1
C EVAL RESULT1 = AAA(NUM:STRING)
C RESULT1 DSPLY
C EVAL *INLR = *ON
C RETURN
Extpgm Demo:
DDS CODE:
A..........T.Name++++++RLen++TDpB......Functions+
A R ABCR
A F1
RPG CODE:
FFilenameIPEAF........L..I........Device+......KExit++Entr
FABC O E DISK
C *ENTRY PLIST
C PARM MLNAME 10
C MOVELMLNAME F1
C WRITEABCR
C SETON LR
C RETRN
RPGLE CODE:
DTESTADD PR EXTPGM('ADD')
D
D PASSSTYLE PR
D P2
D PASSSTYLE PI
D P2
D P1 S
C
C CALLP TESTADD(P2)
C EVAL *INLR = *ON
C RETURN