When you do the read/write/update operations, these can be directed to use
a qualified DS, instead of using the default fields defined with an
external file definition. You might want to even define the file as
qualified, so that the compiler will flag any fields in the program as
invalid if they're not using the data structure you're defining. All I/O
would then occur against the DS you've defined, giving you better control,
and the ability to do the EVAL-CORR operation.
From: Danny Hayes <Danny_Hayes@xxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 01/20/2017 10:06 AM
Subject: RE: Externally Defined Data Structure Qualified
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
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
As an Amazon Associate we earn from qualifying purchases.