I have a number of CL programs which are currently FTP'ing files to a Production server.
we have introduced a new iSeries test server for testing purposes and these programs need to be run from this new server. However, the target FTP address when running from the test server should be different. The files need to be sent to corresponding test servers.
A simple program call has been added for this as below:
PGM PARM(&FTPERR)
DCL VAR(&SUCCES) TYPE(*CHAR) LEN(1)
DCL VAR(&FTPERR) TYPE(*CHAR) LEN(1)
DCL VAR(&TARGIP) TYPE(*CHAR) LEN(20) VALUE(' ')
DCL VAR(&ATTEMP) TYPE(*DEC) LEN(2 0) VALUE(0)
CALL PGM(GETFTPRPG) PARM('FTPMRCL' &TARGIP)
As can be seen above, the GETFTPRPG program is the newly introduced program call that retrieves the IP address based on the program name and the server where the program is running.
This is working fine however the issue is that the other variables declared in the program (to be specific, the first Decimal variable declared in the program) is getting changed. In the example above, the value of &ATTEMP variable gets changed to 04. Can anyone suggest possible causes?
CL passes variables by reference. Make sure &TARGIP
and it's corresponding parameter are defined the same. It appears that the GETFTPRPG
is defining the second parameter differently (maybe longer) than your CL program. When the value for &TARGIP
is changed, past 20 characters, then it is overwriting the value of &ATTEMP
in memory.