Midrange News for the IBM i Community

Posted by: Paulster
PvD Consultancy AB
Sweden and The Netherlands
Print invoice from physical file with CTLCHAR(*PRTCTL)
has no ratings.
Published: 19 Oct 2011
Revised: 23 Jan 2013 - 4055 days ago
Last viewed on: 01 Mar 2024 (6330 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Print invoice from physical file with CTLCHAR(*PRTCTL) Published by: Paulster on 19 Oct 2011 view comments(2)



I get a file ftp-ed on my system from a remote system. The file is a flat file containing invoices that have been invoiced on the remote machine. The file is generated on the remote machine during invoicing but looks exactly like it has been copied from a spooled file to a flat file using command CPYSPLF with CTLCHAR(*PRTCTL). The file would typically look something like below:


003                                              INVOICE
   1                                                                       Page   1
   2                                             Invoicedate            Customer ID
   1                                             11-09-26                      A040
   1                                                                     Invoice ID
   1                                                                         111513
   2      Invoice address
   1      Joe's nails and spikes
   2      5 Hammarroad 
   1      Albany NY
025       Description                        Qty                Amount
   1      ------------------------------------------------------------
   1      Golden hammer                        1                500.00
062           Amount   VAT %             VAT                    Amount
   1          500.00   10.00           50.00                    550.00 USD


Now here's for the question: is there any way to print this file in the intended layout without creating a program to format it properly before printing?


I reckon the answer to this question is no but I thought and check with you guys before setting of and creating a program to do this (or ordering a .pdf instead)


Thanks for any tips,


Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Comment on: Print invoice from physical file with CTLCHAR(*PRTCTL)
Posted: 12 years 4 months 14 days 4 hours ago

Press help on the CPYSPLF command and read the layout for *PRTCTL. Most options can be easily reproduced with an RPG pgm or a simple CPYF command. 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Print invoice from physical file with CTLCHAR(*PRTCTL)
Posted: 12 years 4 months 14 days 3 hours 33 minutes ago

Next time ask them to CPYSPLF ... CTLCHAR(*FCFC). You then do


Unfortunately there is no OVRPRTF CTLCHAR(*PRTCTL).

Any non-externally described printer file will work. If you do this regularly, you might want to CRTPRTF with appropriate PAGESIZE() and so forth, to save yourself typing (and remembering) all of the keywords from your OVRPRTF.