Fwd: Two Externally Defined Printer Files in same pgm
Brian Parkins <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> To: [email protected] 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 -- This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/rpg400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions.