On 17/01/2006, at 8:41 AM, Larry Bolhuis wrote:

Called PGM has three parms 10, 8 and 8 bytes all character.

Calling pgm passes in 10, 8 and 1 byte parms, also all character.

Everything comes across but parm 3 has 7 bytes of crud after byte 1,
which is correct.

Yes, it's correct that there is crud in the final 7 bytes.

This ain't supposed ta happen, correct?

Yes, it is supposed to happen. You are passing one byte to a program expecting 8 bytes. Unless told otherwise the receiving program will see 8 bytes of storage at the address passed by the caller.

We'd fix the one byte parm to 8 bytes but there are hundreds of these in the system and
the crud just appears randomly.

The crud will appear random because it's whatever happens to be in storage after the 1 byte value.

Either:
        o change the caller to pass the correct 8 bytes, or
        o change the receiver to expect 1 byte, or
        o change both caller and callee to pass a length parameter.

If you are calling a module or procedure then you could use operational descriptors to determine the length passed in the callee. This will require a prototyped call with OPDESC specified in RPG, a #pragma descriptor in C, and 'linkage procedure using all described' in COBOL. CLLE always passes operational descriptors.

i5, V5R3, late 2005 CUMes and Groups.

Immaterial--this is a programming defect.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.