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 :
I have a procedure that selects which LF to CHAIN to depending upon its input parameters. All the LF's compiled on the same PF.
Trouble is I seem to need a different DS receptor for each LF. When I try to compile I get RNF7595 "Position 1of the DS doesn't contain a subzone for a record format".
If I look at the compile listing of the DS definitions DS1 and DS2, they seem to be identical.
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.