I'm confused about a parameter passing technique I'm trying to use and would appreciate some insight please:
I've written a command to FTP a list of objects via a savefile.
The command accepts a list of objects that need to be packaged into the savefile, and then somewhere in the CPP it does a SAVOBJ and afterwards it does an FTP via a script.
I allow up to 50 object names (of 10 bytes each) to be passed in to the command, so I have a parameter declaration of -
DCL VAR(&OBJECT) TYPE(*CHAR) LEN(502)
When I do a test shot with debug, I can see the value of &OBJECT as:
0002C3C3 F8F6F6C3 D3404040 C3C3F8F6 - ..CC866CL CC86
F7C3D340 4040D9C9 E2C3F5F0 F0404040 - 7CL RISC500
I can see the list count of 2 and the names of the 2 objects in the list.
I thought I'd be clever and pass the list of object names to the SAVOBJ command by extracting bytes 3 to 22 from &OBJECT into &OBJLST and using that value as -
SAVOBJ OBJ(&OBJLST) LIB(&FRMLIB) DEV(*SAVF) ...................
This works when I have only one object in the parameter list, but when I have more than one parameter it doesn't.
When I look at the value through debug immediately before the SAVOBJ command is executed I see:
1 'CC866CL CC867CL '
61 ' '
121 ' '
The error message I get is:
VALUE 'CC866CL ' FOR OBJ NOT A NAME OR GENERIC NAME.
ERROR FOUND ON SAVOBJ COMMAND.
Both objects exist in the library I'm trying to save from.
Should I be extracting the program names individually from the input list and then declaring them as individual parameters in the SAVOBJ? This would be a little more difficult.
I'm at a bit of a loss to work out how to string the object names to pass to the SAVOBJ.
Thank In Advance