Submitted by Niklas Håkansson on Fri, 09/21/2012 - 00:00
Forums

Hi Niels,

If I call an IceBreak program from within another IceBreak program, is there a way to get a “return value” from the second program called to the first one?

Best Regards,
Niklas

Niels Liisberg

Fri, 09/21/2012 - 00:00

Hi Niklas;

There are several ways to accomplish that:

1. Using %PARMS:
Basically you can just call your second IceBreak program like you would do in normal 5250. However the JIT compiler will not kick in in subsequent level – only the first you hit from the URL.
So you can refer to the second in the URL and use the %PARMS to return if none is provided just to let you use the JIT compiler:

C         *entry     plist
C                    parm         companyno
C                    parm         custno

/free
// --------------------------------------------------------------------------------------
// Main Linie in second program:
// --------------------------------------------------------------------------------------

  If %parms = 0;
     %> This program need to be called from an other ASPX program with parameters<%
     Return;
  Endif;

 

2. Using CRTICPGM:
You can also invoke the IceBreak compiler like a "normal" IBMi compiler from within RDi / rational / eclipse or even from PDM or command line:

You Enter:

GO ICEBREAK

Then;

CRTICEPGM 

You need to provide the server id where the application library exists and the source path to your ASPX program and ensure to have the library list like the server set up before:
 

3. Using Session variables:
Yet another approach is to set session variables in the top level program, and then "getsessionvar" in the sub program…

Best regards,
Niels Liisberg