Subprocedures in RPGLE

Mukund G K

Junior Member
May 30, 2013
1
0
0
I have created 1 pgm which is having a Subprocedure in it and is returning a variable as Output. There is another Program in which I am trying to call this subprocedure using the EXTPGM keyword. But its not working. Somehow it is not returning any value.

Here is the Code snippet of both the pgms.

0001.00 HDFTACTGRP(*NO) 130530
0002.00 Dtest pr 3 0 130530
0003.00 Dvar3 s 3 0 130530
0004.00 Dvar1 s 3 0 INZ(4) 130530
0005.00 Dvar2 s 3 0 INZ(4) 130530
0006.00 130530
0007.00 /free 130530
0008.00 var3=test(); 130530
0009.00 dsply var3; 130530
0010.00 *inlr=*On; 130530
0011.00 /end-free 130530
0012.00 *** 130530
0013.00 130530
0014.00 Ptest b export 130530
0015.00 130530
0016.00 Dtest pr 3 0 130530
0017.00 130530
0018.00 Dtest pi 3 0 130530
0019.00 130530
0020.00 /free 130530
0021.00 var3=0; 130530
0022.00 var3=var1+var2; 130530
0023.00 return var3; 130530
0024.00 /end-free 130530
0025.00 Ptest e 130530



0001.00 Dtest1 pr extpgm('pgm1_mk') 130530
0002.00 Dnum1 s 3 0 inz 130530
0003.00 Dnum2 s 3 0 inz 130530
0004.00 Dnum3 s 3 0 inz 130530
0005.00 D*num4 s 3 0 inz 130530
0006.00 130530
0007.00 /free 130530
0008.00 130530
0009.00 callp(e) test1();
0010.00 dsply num3; 130530
0011.00 *inlr=*on; 130530
0012.00 /end-free 130530


Can anybody please help me out finding what is the error in my Code.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Unfortunately I have to agree with KentState. This is the first time I can recall seeing any variant of RPG brought up for discussion. There's always a chance someone will know the answer, but you might be better served trying to find an RPG-specific community.