Ooops! Mistype on the second example - missed off the "1"   :-) . Should read:

Write PrtFmt1;

Brian.



-------- Forwarded Message --------
Subject: Re: Two Externally Defined Printer Files in same pgm
Date: Thu, 6 Nov 2025 16:03:35 +0000
From: Brian Parkins <goodprophet.bp@xxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxxxxxxxx



Greg, would this do the trick?

dcl-f  prtf01     printer oflind(*in09) qualified usropn;
dcl-f  prtf02     printer oflind(*in08) usropn;

Dcl-DS Dstr1  LikeRec(PrtF01.Fmt1);

Write PrtF01.Fmt1 Dstr1;

BTW, are the Printer Files declared locally within the subprocedure - or globally within the mainline (procedure) code? If the former, then you'll have to use the Data Structure approach for PRTF02 as well. (I/O within a subprocedure for locally defined files must be done using Data Structures because I- and O-specs are not generated.)

Another approach might be to rename the formats and fields, e.g.

dcl-f  prtf01     printer oflind(*in09) Prefix(P1) usropn Rename(Fmt1:PrtFmt1);
dcl-f  prtf02     printer oflind(*in08) usropn;

Write PrtFmt;

HTH,
Brian.

On 06/11/2025 14:28, Greg Wilburn wrote:
I have a situation where I need to print to two different printer files within the same program... the problem is that both printer files share record format and field names.

I've been attempting to use the "qualified" when defining one of the printer files (maybe I should do both?), but the compiler is giving me this error
RNF7274: A result data structure is required for I/O operations to file

Definitions are:
dcl-f prtf01 printer oflind(*in09) qualified usropn;
dcl-f prtf02 printer oflind(*in08) usropn;

Each is being written inside a separate procedure... Each is open/closed as needed.

Not sure how to solve this short of writing separate pgms.

Thx,
Greg

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 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.