SUB PROCEDURE
SUB PROCEDURE WHEN RETURNING
ANY VALUE ( since this subprocedure is returning a
value so procedure interface should be used , callp should not be used, and the
length of the subprocedure should be defined)
PRA1/QRPGLESRC
SUBPROC
0001.00
da s 3
0
0001.01
db s 3
0
0002.00
Dsubpr1 pr 12
0
0003.00
Da 3 0
0004.00
Db 3 0
0005.00
Dc s 12
0
0007.00
C eval a=10
0008.00
C eval b=20
0008.03
c eval c=subpr1(a:b)
0010.00
c c dsply
0011.00
c eval *inlr=*on
0012.00
c return
0013.00
0014.00
0015.00
psubpr1 b
0016.00
dsubpr1 pi 12
0
0017.00
da 3
0
0018.00
db 3 0
0019.00
dx s 12
0
0020.00
c eval x=a+b
0021.00
c return
x
0022.00
psubpr1 e
output is :-
DSPLY 30
How to see
output:-
1) Here in subprocedures we should not compile directly I
mean 14 option should not be used.
First use crtrpgmod then press <f4> and enter module
name if u write crtrpgmod and press enter then default module will be created
in qgpl library with the module name as proof.
2) then crtpgm <f4> and write the programs name (any
name) .
3) to see output type
on the command line as call <program name> . [ here call proc1 ].
No comments