Thanks all! The rename of each record format worked perfectly.
This is our VICS Bill of Lading program.
dcl-f asn002pf printer oflind(*in09) usropn
rename(vicsform:svicsform)
rename(rphead:srphead)
rename(rpcus:srpcus)
rename(rpcust:srpcust)
rename(rpdata:srpdata)
rename(rptotl:srptotl);
dcl-f asn003pf printer oflind(*in08) usropn;
I still had to "adjust" the printer file - two fields (named the same) were defined a different lengths.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Brian Parkins
Sent: Thursday, November 6, 2025 11:21 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Fwd: Two Externally Defined Printer Files in same pgm
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
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/rfnqrfsdqnxynsktdwul955-q___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo2MGExMDZjZDA2MTFiNjRjYjc3ZTJiZDk2MzRhODhmMDo3OjMxZWQ6YzRlYmQxMDdlOWM0NjI5YzVlYTBhMDAwZTcxZTRmNWJkMzIyNGRmNGI3ZGZiYjcyOGZkZDFjZTBlNWNlNGYzOTpwOlQ6VA
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/wul955-q___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo2MGExMDZjZDA2MTFiNjRjYjc3ZTJiZDk2MzRhODhmMDo3OjlhYjk6NTk0ODk2ZDFiMjFhN2U1Njc3ZTE5Y2ZjYTUwM2UxZjRkZDkyYTBjZjRkNTQ5N2Y0NGE3NWM4ODU2NTk0ZWUwMjpwOlQ6VA.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
[CAUTION! This email originated outside of the organization. Please do not open attachments or click links from an unknown or suspicious origin.]
Greg Wilburn
Director of IT
301.895.3792 ext. 1231
As an Amazon Associate we earn from qualifying purchases.