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



You might want to have a single internal data structure that is used for your calculations, and just before writing, do an eval-corr to the appropriate output data structure.

read filein.record inputds;
eval-corr internalds = inputds;

... some calculations here against internalds

eval-corr file1ds = internalds;
write file1.rec file1ds;
eval-corr file2ds = internalds;
write file2.rec file2ds;
... etc.

This would cause minimal disruption to your programs, and give you the ability to use qualified files and data structures vs. prefixes. In this scenario eval-corr could be used to minimize blocks of code that simply copy similar fields from one data structure to another.


-----Danny Hayes <Danny_Hayes@xxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx>
From: Danny Hayes <Danny_Hayes@xxxxxxxxx>
Date: 01/20/2017 11:10AM
Subject: RE: Externally Defined Data Structure Qualified


Mark,

The program fills up all of the fields for the write, this is when I need to 'store' the record so it is not in any DS, because I cannot create a base DS due to the fact that several of the files used in this program have the exact same field names, so when it tries to create an externally defined DS it says this field is already define, you cannot use it here (sort of).

Danny

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of mlazarus
Sent: Friday, January 20, 2017 10:26 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Externally Defined Data Structure Qualified

Danny,

You can read into (and write) a record using a DS. Some read into a DS (externally defined, based on the input record). EVAL-CORR from that DS into the various DS's that would be used as the output format.

-mark

On 1/20/2017 10:06 AM, Danny Hayes wrote:
Mark,

Thanks for your reply, however the issue is I cannot create a 'base' DS due to having field the same in other files, so I can have the renamed fields DS but nowhere to eval-corr to. Do you follow my dilemma? If I cannot get the fields back into the record format to write the record then I have not accomplished the goal. I do not think I can do an eval-corr into a record format, can I?

-Danny

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
mlazarus
Sent: Friday, January 20, 2017 9:10 AM
To: RPG programming on the IBM i (AS/400 and
iSeries)<rpg400-l@xxxxxxxxxxxx>
Subject: Re: Externally Defined Data Structure Qualified

Danny,

Check out the EVAL-CORR opcode. It moves fields with the same name from one DS to another. For the purpose of the operation of this opcode, the subfield qualification (due to the "qualified" keyword) is ignored. I assume that EVAL-CORR would not recognize "prefix"ed variables and know to restore the variable back to its original name.

-mark

On 1/20/2017 8:07 AM, Danny Hayes wrote:

I have a program, actually 6 of them (around 5,000 lines each), that each have multiple files that have field names in common across all of the files.

The programs write a header record for incoming EDI and then write detail records for that header record.

The issue was that at the time the header record was processed and then moved on to process the details another program began processing the details before all had been written.

The decision was made to delay the writing of the header until all
detail records had been processed. To do this I created a flag to
say header is ready and instead of writing moved the

externally defined DS to a second one with a prefix on it so that no values would be changed prior to when I actually do write the record, after all details were processed.

Well, due to the commonly named fields the second external DS would not rename its fields because they were already defined in the first DS.

To handle this I added QUALIFIED onto each of the External DS's, this allowed everything to compile, almost.

Now the issue is the original design of the program counted on
population of all fields at one time. SO even if I qualify
everywhere one of the 'commonly named fields' is used I then loose
the populating of

every other iteration of that field name.

My objective is to not have to write subroutines/subprocedures to manually move these hundred plus fields into a save area and then back out of the same.

I know that someone out here has had to figure this out before, although maybe not, I have never seen anything like this before, that I can recall, but then some days I don't remember what I had for lunch yesterday.

Thanks& Regards,
Danny


--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://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: http://amzn.to/2dEadiD This e-mail and any attachments, contain Genuine Parts Company confidential information that is proprietary, privileged, and protected by applicable laws. If you have received this message in error and are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy this e-mail, any attachments or copies therein forthwith. Please notify the sender immediately by e-mail if you have received this e-mail in error.

"This e-mail and any attachments, contain Genuine Parts Company confidential information that is proprietary, privileged, and protected by applicable laws. If you have received this message in error and are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy this e-mail, any attachments or copies therein forthwith. Please notify the sender immediately by e-mail if you have received this e-mail in error."

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://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: http://amzn.to/2dEadiD
This e-mail and any attachments, contain Genuine Parts Company confidential information that is proprietary, privileged, and protected by applicable laws. If you have received this message in error and are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy this e-mail, any attachments or copies therein forthwith. Please notify the sender immediately by e-mail if you have received this e-mail in error.

"This e-mail and any attachments, contain Genuine Parts Company confidential information that is proprietary, privileged, and protected by applicable laws. If you have received this message in error and are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy this e-mail, any attachments or copies therein forthwith. Please notify the sender immediately by e-mail if you have received this e-mail in error."

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.