RE: [EXTERNAL] Fwd: Two Externally Defined Printer Files in same pgm
Greg Wilburn <gwilburn-kuYYJ3CQfvZxq3Q2jbZZw/[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <PH0PR17MB4863262DA0364CD6ABF26036DAC2A@PH0PR17MB4863.namprd17.prod.outlook.com> |
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 <[email protected]> On Behalf Of Brian Parkins
Sent: Thursday, November 6, 2025 11:21 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <[email protected]>
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 <[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://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/rfnqrfsdqnxynsktdwul955-q___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo2MGExMDZjZDA2MTFiNjRjYjc3ZTJiZDk2MzRhODhmMDo3OjMxZWQ6YzRlYmQxMDdlOWM0NjI5YzVlYTBhMDAwZTcxZTRmNWJkMzIyNGRmNGI3ZGZiYjcyOGZkZDFjZTBlNWNlNGYzOTpwOlQ6VA
or email: [email protected]
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 [email protected] 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
--
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.