× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: RPGIV MoveA issue.
  • From: bmorris@xxxxxxxxxx
  • Date: Mon, 22 Jan 2001 17:51:38 -0500
  • Importance: Normal


>Date: Mon, 22 Jan 2001 13:25:45 -0800
>From: JohnJ@pacinfosys.com
>
>0103.00 C     *ENTRY        PLIST
>0103.01 C                   PARM                    PA              128
>0103.02 C                   PARM                    PRM1            256
>0103.03 C                   PARM                    PRM2            256
>
>0326.00 C                   CALL      CALD
>0326.01 C                   PARM                    PA
>0326.02 C                   PARM                    PRM1
>0326.03 C                   PARM                    PRM2

John, what's critical here, and for every parameter passing issue,
is the _lengths_ of the parameters as they are defined in calling
program.  If any of those parameters are shorter than the definitions
in the *ENTRY PLIST of the called program, you can get strange storage
corruption problems like you're seeing.  In general, you should always
pass parameters that are at least as long as the called program
expects.

The reason is that the parameters are passed by reference; that is, a
pointer to the parameter is passed to the called program.

Here's a simpler example:

--------- PGM1 ---------
D ds         DS
D   sub1              5a
D   sub2              5a

C          CALL 'PGM2'
C          PARM            sub1
C          PARM            sub2

--------- PGM2 ---------

C  *ENTRY  PLIST
C          PARM            p1         10
C          PARM            p2          5

Entry parm p1 refers to subfield sub1.

Any change to p1 will immediately update subfield sub1.
But p1 is defined longer than sub1, so if p1 is changed
to say 'abcdefghij', then not only sub1 will get changed,
but also the 5 bytes following sub1, which is sub2.

Since entry parm p2 refers to subfield sub2, changing p1
to 'abcdefghij' will change sub2 and p2 to be 'fghij'.

Barbara Morris


+---
| 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 ...


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.