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



When a parameter is passed to a program no actual data is passed - just the address (i.e.a pointer) to the data back in the caller's storage.

So what is happening here is that we are grabbing that address ( e.g. %addr(parmname) ) and using it to set the basing pointer of a clone of the DS ( e.g. pointerToDS = %addr(parmname); )

Using the old *Entry Plist approach what actually happened was that the DS declared as the parm was (under the covers) declared as BASED by the compiler and the pointer passed for the parm just assigned as its basing pointer. All that the pointerToDS = %addr(parmname); code is doing is the same thing that used to happen under the covers.

Quite why the compiler made this change is a mystery to me - I don't recall any discussions on the topic - and it may be something that can be changed in the future.

If you want to understand more about parameter passing and what actually happens (and this is stuff you should know) then try reading these articles.

https://www.itjungle.com/2016/11/29/fhg112916-story01/ <https://www.itjungle.com/2016/11/29/fhg112916-story01/>

https://www.itjungle.com/2017/02/20/guru-parameter-passing-fundamentals-programs-versus-procedures/ <https://www.itjungle.com/2017/02/20/guru-parameter-passing-fundamentals-programs-versus-procedures/>

https://www.itjungle.com/2017/07/24/guru-fundamentals-prototyping-part-1/ <https://www.itjungle.com/2017/07/24/guru-fundamentals-prototyping-part-1/>

That should help.



On Mar 11, 2020, at 12:55 PM, Mónica Anastácio <monicaanastacio@xxxxxxxxx> wrote:

You're right, I don't understand



Why are u doing this?
* per5005ds = %addr(i_er5005ds); *

On Wed, Mar 11, 2020 at 4:03 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

Monica - what do you mean "forcing information to pass".

The only thing that passes anywhere is the pointer to the original DS
passed on the call.

From there on copy of the definition is BASED on that pointer to allow
access to the _original_ data. No data is moved - it stays in the original
calling program as it does with the fixed form method.

I think you may be misunderstanding how parameters work.



On Mar 11, 2020, at 11:11 AM, Mónica Anastácio <
monicaanastacio@xxxxxxxxx> wrote:

The solution with pointer from Joe end up being exactly the same ,
forcing
information to pass from one side to another, and that’s what I want to
avoid
Maybe theres no other way of using a external DS like parm entry in FREE.

DCL-DS waapids_orig extname('FR5005DS') inz;

-----------------------------
--------------------------------------------------------

DCL-PI *N;

p_waapids like(waapids_orig);

END-PI;

----------- --------------------------------------------------------
begsr $pcpgm;

* waapids_orig = p_waapids; *
endsr
--------------------------------------------------------------------
begsr $ucpgm;

* p_waapids = waapids_orig; *
return;
endsr;



Barbara Morris <bmorris@xxxxxxxxxx> escreveu em qua, 11/03/2020 às
12:54 :

On 2020-03-10 9:38 a.m., Mónica Anastácio wrote:
Well after this morning meeting, im allowed to find a new solution not
based in what we used to do i fexed format. But the new solution has
work
with “Pointers” if anyone can help me. I really appreciate it 😉


Mónica,

Joe Pluta already showed an example of how to do this using pointers.
Here is the code that Joe posted.

dcl-ds er5005ds extname('ER5005DS') based(per5005ds) end-ds;

dcl-pi *n;
i_er5005ds like(er5005ds);
end-pi;

per5005ds = %addr(i_er5005ds);

That method allows you to use the subfields of er5005ds with just the
subfield names (addr, id_no) instead of coding er5005ds.addr,
er5005ds.id_no).

Did you mean that you want a new solution to work _without_ pointers?

If that is what you meant, then I think the best way is to code like
this. (I believe other people have already recommended this method ...)

dcl-ds er5005ds_t extname('ER5005DS') qualified template end-ds;

dcl-pi *n;
er5005ds likeds(er5005ds_t);
end-pi;

But now, you have to code the subfields of the parameter as qualified
names.

if er5005ds.addr = *blanks;
...

--
Barbara

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.