PDA

View Full Version : Packed Fields



dacust
01-14-2004, 05:29 AM
To pass it directly you have to pass the parm in hex. Define *CHAR 5 DCL &DATE *CHAR 5 VALUE(x'020040109') or chgvar &DATE x'020040109' Notice the leading zero, it must be odd number of digits. The better way is to add a command fromt end to the HLL and declare the variable as *DEC and avoid the hex altogether.

buck.calabro@commsoft.net
01-14-2004, 11:13 AM
> Is it possible to pass a packed fields from CL to RPG. Packed is the only sort of number that CL understands. dcl &date *dec (8 0) call rpgpgm &date should work just fine. If you are doing it from the command line, take Daniel's advice and create a command to do it. --buck

dacust
01-14-2004, 11:16 AM
starbuck, thanks for correcting me. Brain freeze on my part. I was actually thinking of a call from a sbmjob. When hard coded in a call in CL your method is obviously better - replace the hard code with a CL variable. (or a command) The hex method works best when passing using sbmjob cmd(call ...) (but here, still, a command is even better)

buck.calabro@commsoft.net
01-14-2004, 11:59 AM
> starbuck, thanks for correcting me. Not a correction. The original problem description could certainly be interpreted either way. If I need to call any program (CL or RPG) from a command line/sbmjob I create a command, just as you recommend. The hex technique is good for one-off's, but not much fun if you have to do a lot of CALLs. I just thought I'd add my two cents in just in case Rod is trying to call an RPG program from a CL program, and not from a command line. --buck

Guest.Visitor
01-14-2004, 12:35 PM
What I am trying to accomplished here was to filled up a 256 parameters with chars and packed filled in CL before calling the RPG which uses the parm as Data Structure. I think this wont worked. I am using BPCS and wanted to run an interactive program in Batch Mode supplying all default parm. I think the position of the fields will fall off when pass to RPG programs. I will probably do it in RPG. Thanks anyway. Rod

Guest.Visitor
01-14-2004, 12:50 PM
Is it possible to pass a packed fields from CL to RPG. The RPG program accept date parm which is 8.0 and its in position on DS was 1 to 5. Thanks Rod

dacust
01-14-2004, 12:50 PM
This could certainly be done in CL, and you could *cat it all together and keep it aligned, but I think it'd be nasty. RPG sounds like the best bet by far.

buck.calabro@commsoft.net
01-14-2004, 01:37 PM
> I think the position of the fields will fall off > when pass to RPG programs. I have not worked with BPCS, but I have called RPG programs which use a DS as an input parameter from CL. That should not be a problem. But you already know that it will not be simple to construct a character version of a packed field using CL alone. But it is possible to do by deliberately mis-matching the parameters between two programs: PACK001 pgm dcl &date *dec (8 0) dcl &time *dec (6 0) dcl &amt *dec (15 5) dcl &char4 *char 4 dcl &char5 *char 5 dcl &char8 *char 8 chgvar &date 12312003 call pack002 (&date &char5) chgvar &time 173655 call pack002 (&time &char4) chgvar &amt 96322.153 call pack002 (&amt &char8) dmpclpgm endpgm PACK002 pgm (&charIn &charOut) dcl &charIn *char 5 dcl &charOut *char 5 chgvar &charOut &charIn endpgm Call PACK001 and look at the hex values of the various character fields. I suppose you could do the same thing if you used a single field and substring. >I will probably do it in RPG. Thanks anyway. RPG will be a better choice for this sort of string manipulation. Good luck! --buck