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



As Daniel mentioned, it's the file's global bbnumber field that is changing. Which shares the same address as @_billback# since you used CONST instead of VALUE.


Another good way to fix this type of issue is to read into a local data structure within the subprocedure.
If you don't want the subprocedure's read to overwrite all the global fields for the file, then this is probably the best option.


Dcl-ds InData EXTNAME('BBHDRP':*input) Qualified End-ds;


chain (@_key01) bbhdrp InData;

if %found(bbhdrp);

s4number = %trim(InData.bbnumber);
...


--
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of DEnglander--- via RPG400-L
Sent: Wednesday, February 14, 2024 11:35 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Cc: DEnglander@xxxxxxxxxxxxxxx
Subject: Re: Subprocedure use of a Global file

Thank you Scott and Charles.



I agree that my assumption was wrong, I was just "thinking out loud". I

have never had this happen before.





Here is the source:



The single call:



prc_items(key01 : bbnumber);





PI



dcl-pi prc_items;

@_key01 like(bbkey01) const; [packed 9]

@_billback# like(bbnumber) const; [char 15]

end-pi prc_items;





The code in the subprocedure:



chain (@_key01) bbhdrp;



if %found(bbhdrp);

s4number = %trim(bbnumber);



if s4number = *blanks;

s4number = @_billback#;

endif;



After the Chain, bbnumber is blank, which it should be. After the chain

@_billback# is blank too, but not before the chain. I did a small test

where I saved the @_billback# before the Chain, and that variable did not

change, so I must be overwriting something, but I don't see what it is.

This is the only occurrence of @_billback# in the whole program. I just

did a small test where I made @_billback char(15) to satisfy my curiosity

but @_billback# was still blank after the chain.

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.