• Subject: Re: This is friggin' weird...
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Thu, 12 Jul 2001 15:30:32 -0700
  • Organization: Pacer International

This is a common problem and is covered in the FAQ-O-Matic at midrange.com:
http://faq.midrange.com/data/cache/57.html
Best answer on another post:
http://faq.midrange.com/data/cache/73.html
another link to the problem:
http://faq.midrange.com/data/cache/70.html

Those you should definitely read.

The quick answer is CL doesn't know how long the RPG char is supposed to be,
and it defaults characters to 32 bytes.  Your string is shorter than 32 bytes
(the contents get converted to a literal and it ignores the spaces) and so
CL pads the literal with spaces to make the 32 byte string.  The extra stuff
you are seeing are the 7 bytes of memory after your passed parameter.

To fix it, pass 40 bytes and make sure the 40th byte is not blank.  Then CL
will pass 40 bytes since it is longer than the 32 byte default and your RPG
program sees what you expect it to see (the 40th byte being ignored by your
RPG program).

dcl &parms *char 39
dcl &parmstmp *char 40
  display prompt screen, get various parms
  combine parms into var &PARMS
chgvar &parmstemp (&parms *cat 'x')
call WO11JQ0 PARM(&PARMSTEMP)

Regards,

Jim Langston

Me transmitte sursum, Caledoni!


tomh@simas.com wrote:
> 
> I'm having a strange problem, and surely you guys can see what it is that I'm 
>not seeing:
> 
> WO11C (CLP):
> dcl &parms *char 39
> display prompt screen, get various parms
> combine parms into var &PARMS
> call WO11JQ0 PARM(&PARMS)
> 
> WO11JQ0 (CLP):
> dcl &parms *char 39
> call WO11BWFR2 parm(&parms)
> 
> WO11BWFR2 (SQLRPGLE):
> fqsysprt   o    f   80        printer
> c     *entry        plist
> c                   parm                    parms            39
> c                   except    exc01
> c                   eval      *inlr = *on
> oqsysprt   e            exc01
> o                                              '>'
> o                       parms
> o                                              '<'
> 
> Let's suppose that the combined value of &parms in WO11C is 
>"300000YLAAPY0620012                    "   (that's 20 blank trailing spaces)
> 
> Now, here's the weird stuff:
> If I run WO11C like you see, WO11BWFR gets this for variable parms: 
>"300000YLAAPY0620012                    "
> 
> If I change the call to a SBMJOB:
> SMBJOB CMD(CALL PGM(WO11JQ0) PARM(&PARMS))
> BO11BWFR gets this for parms: "300000YLAAPY0620012              CALLf "   
>(that's 14 blanks before CALLf, 1 after)
> 
> If I change the SBMJOB to this:
> SBMJOB CMD(CALL PGM(WO11JQ0) PARM('300000YLAAPY0620012                    '))
> WO11BWFR gets the parm correctly.
> 
> What am I overlooking?

--
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.