|
Without testing, doesn't the chain need to be like this:
CHAIN %kds(WrecordKey) FILE1 Wrecord1;
Also, don't forget, David, that you'll still have to load the key values, and they'll be qualified.
e.g. wRecordKey.key1 = myvalue;
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of M. Lazarus
Sent: Tuesday, February 17, 2009 9:13 AM
To: RPG programming on the IBM i / System i
Subject: RE: CHAIN + DS as result field
David,
You're missing the key on the CHAIN! Assuming
that the key is identical for both files, try this:
D WrecordKey DS LIKEREC ( RECORD1 : *Key )
D Wrecord1 DS LIKEREC ( RECORD1 : *INPUT )
D Wrecord2 DS LIKEREC ( RECORD2 : *INPUT )
When condition1
CHAIN WrecordKey FILE1 Wrecord1;
EVAL-CORR Globalrecord= Wrecord1;
When condition2
CHAIN WrecordKey FILE2 Wrecord2;
EVAL-CORR Globalrecord= Wrecord2;
-mark
At 2/17/09 04:16 AM, you wrote:
Thanks, Alan
I already had the global definitions as you suggest.
In my subprocedure, I now have :
D Wrecord1 DS LIKEREC ( RECORD1 : *INPUT )
D Wrecord2 DS LIKEREC ( RECORD2 : *INPUT )
When condition1
CHAIN FILE1 Wrecord1;
EVAL-CORR Globalrecord= Wrecord1;
When condition2
CHAIN FILE2 Wrecord2;
EVAL-CORR Globalrecord= Wrecord2;
So now I can put the result into one common DS, thanks again.
I don't find the compile message very clear. Just to test it, I tried :
CHAIN FILE1 Wrecord2;
File1 is a PF with RECORD1, File2 is an LF with RECORD1 renamed RECORD2.
This is an extract of the compiled listing : the
gravity level of the message is 20 although in
the summary there is just one message at level
30. If I look at the definitions of Wrecord1 and Wrecord2 they are identical.
*RNF7701 20 1 La structure de données n'est pas admise pour l'opér
* * * * * F I N D U R E C A P I T U L A T I F D E S M E S S A
5722WDS V5R4M0 060210 RN IBM ILE RPG D126169V03/CL
R é c a p i t u l a t i f f i n a l
Nombre total de messages :
Information (00) . . . . . . . : 4041
Avertissement (10) . . . . . . : 11
Erreur (20) . . . . . . . : 0
Erreur grave (30+) . . . . . . : 1
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Alan Campin
Envoyé : lundi 16 février 2009 18:58
À : RPG programming on the IBM i / System i
Objet : Re: CHAIN + DS as result field
What release level are you at? The new ability
to pass a file to a sub-procedure looks perfect for you. (V6R1).
The other one I could think of is why not just
use an override? Have one dummy input file overridden to the actual.
The other one I could think of is that you do
not need a separate data structure. Couldn't you
declare a templete (Type defintion) in the header and use EVAL-CORR?
d TD_FORMAT...
d e ds ExtName(LF1)
d Based(StdNulPtr)
d FileData...
d ds LikeDs(TD_Format)
FileData = GetFileData(values);
In Subprocedure
d FileData...
d ds LikeDs(TD_Format)
Chain LFILE1 DS1;
Eval-Corr FileData = DS1;
Return FileData;
This could be especially handy if you don't want all the data.
Not sure I am really answering your question.
On Mon, Feb 16, 2009 at 10:09 AM, David FOXWELL
<David.FOXWELL@xxxxxxxxx> wrote:
I don't understand why I can't do this :CHAIN to depending upon its input parameters.
I have a procedure that selects which LF to
All the LF's compiled on the same PF.
receptor for each LF. When I try to compile I
Trouble is I seem to need a different DS
get RNF7595 "Position 1of the DS doesn't
contain a subzone for a record format".
definitions DS1 and DS2, they seem to be identical.
If I look at the compile listing of the DS
D DS1 LIKEREC(LFORMAT1 *INPUT)
D DS2 LIKEREC(LFORMAT2 *INPUT)
CHAIN LFILE1 DS1;
CHAIN LFILE2 DS2;
How can I get the result of the CHAIN into one common DS?
Thanks.
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.
As an Amazon Associate we earn from qualifying purchases.
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.