IBM i Global

IBM i Global

Connect, learn, share, and engage with IBM Power.

 View Only
Expand all | Collapse all

Copy PF Member to a Spool File

  • 1.  Copy PF Member to a Spool File

    Posted Thu October 19, 2023 08:08 AM

    Hello All,

    I have a Physical File member & I need to convert it to a Spool File. 

    Here are the steps I am taking.

    First to create a printer file as below:

    CRTPRTF FILE(MOHANLIB/Y) PAGESIZE(51 110) OVRFLW(41)

    Then copy the PF to the Printer File as below:

    CPYF FROMFILE(PFLIB/FILE1) TOFILE(MOHANLIB/Y)      

    The spool file is successfully created.

    But the spool file shows 5 blank lines, before it start showing the data from my Physical file.

    In other words, the 1st row of the PF member shows on the 6th line of the Spool file. 

    Why is this so ?

    I have tried overriding to QSYSPRT & I get the same result :

    OVRPRTF FILE(QSYSPRT) PAGESIZE(51 110) OVRFLW(41)           
    CPYF FROMFILE(PFLIB/FILE1) TOFILE(QSYSPRT) 

    Is there any solution for this ?

    Thank you



    ------------------------------
    Mohan Eashver
    ------------------------------


  • 2.  RE: Copy PF Member to a Spool File

    Posted Thu October 19, 2023 01:50 PM

    As much as distracts me when people start going tangentially I gotta ask, why do you have to convert a pf into a spool file?  I have some ideas in mind but I'd like to know the end goal.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 3.  RE: Copy PF Member to a Spool File

    Posted Thu October 19, 2023 01:57 PM

    Hi Rob this is to apply overlay [graphics like logo] over the spool file.

    For example an overlay for Invoice/BOL with signatures & logos.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 4.  RE: Copy PF Member to a Spool File

    Posted Thu October 19, 2023 02:21 PM

    Well, that's different.  I take it you are originally creating output to an internally defined physical file, where you already have your column and data all formatted.  Different than I suspect most people would do it but to each his own.

    Good luck

    IDK if the following on CRTPF has anything to do with what you are trying to do:
    Front margin:                    FRONTMGN
    It asks you for the offset down.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 5.  RE: Copy PF Member to a Spool File

    Posted Thu October 19, 2023 10:21 PM

    Dear Mohan

    I tried what you did in my IBM i 7.4 server using the sample file QCUSTCDT in QIWS library and the spooled file look fine :

    Could you try this with QIWS/QCUSTCDT and see the result?   BTW, is the parameter COMPRESS of your CPYF command set to *YES?



    ------------------------------
    Chance favors only the prepared mind.
    -- Louis Pasteur
    ------------------------------
    Satid S.
    ------------------------------



  • 6.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 07:42 AM

    Hi Satid,

    Yes I did as you mentioned & there are no blank lines in the Spool file.

    I need to compare attributes of my file with QIWS/QCUSTCDT, so I spot the trouble maker.

    BTW there are no deleted records in the file & no empty lines in the file beginning of my file.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 7.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 03:11 AM

    I Mohan,

    Are you sure there aren't 5 empty records (with blanks) at the beginning of the file ?



    ------------------------------
    Dominique Gayte
    ------------------------------



  • 8.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 07:28 AM

    Dear Dominique

    I see your point is a possibly valid one and Mohan can easily check on this by running DSPPFM command against the physical file at issue. 



    ------------------------------
    Chance favors only the prepared mind.
    -- Louis Pasteur
    ------------------------------
    Satid S.
    ------------------------------



  • 9.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 07:43 AM

    Hi Dominique,

    There are no deleted records in the file & no empty lines in the file beginning of my file.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 10.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 08:06 AM

    I'm guessing that Mohan created a file similar to something that you could create by doing the following:

    CRTPF FILE(ROB/MOHAN) RCDLEN(80)

    UPDDTA FILE(ROB/MOHAN)

    When I do a CPYF FROMFILE(ROB/MOHAN) TOFILE(*PRINT) my first 5 lines look like the following:

    With the whole spool file looking like the following:

    Generally most people on this platform would create a printer file using DDS and format that out.  Or bypass a spool file and create HTML for a website or an Excel spreadsheet.

    However perhaps Mohan did the alternative as a precursor to generate any of these desired outputs.  So assuming the best out of him, I'm at a loss as to how to get such a physical file to a simple spool file without all that other headings, footers and sidebars by simply using CPYF.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 11.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 08:21 AM

    I thought about CPYTOSTMF and then some tool there to pipe it to a spool file but other work is pressing.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 12.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 08:26 AM
    Edited by Dominique Gayte Fri October 20, 2023 08:34 AM

    Mohan,

    To understand where the problem is, you could try the following commands:

    • Use a CPYF to a new file. Is there such a thing as a blank line at the beginning of the file? CPYF FROMFILE(PFLIB/FILE1) TOFILE(MOHANLIB/TEST1) and DSPPFM (MOHANLIB/TEST1)
    • Use the QPRINT printer file instead of QSYSPRT


    ------------------------------
    Dominique Gayte
    ------------------------------



  • 13.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 08:34 AM

    Robert's idea is great too. This is a third possible test that allows for an excellent workaround.



    ------------------------------
    Dominique Gayte
    ------------------------------



  • 14.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 08:42 AM

    Dominique,

    QPRINT was a great idea.  That doesn't have the headings, footers and sidebars.  However DSPSPLF doesn't match what you get on the actual printout.  For example, any lines that are blank or all spaces are not shown on DSPSPLF.  So I think I'm finally getting to what Mohan's issue is:  Controlling where line one of the PF appears on the actual printed output.  When you're trying to then take that printer file, and apply overlays and signatures to it to add graphics, this line spacing is quite critical.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 15.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 09:38 AM

    When I copy the spool file created by QPRINT back to a disk file using the following command:

    CRTPF ROB/SPOOL RCDLEN(132)

    CPYSPLF FILE(QPRINT) TOFILE(ROB/SPOOL) SPLNBR(*LAST) CTLCHAR(*PRTCTL)

    DSPPFM FILE(ROB/SPOOL)

    You can see:

    That 006 says to start at line 6.  Which explains your 5 blank lines.  The 1's and 3's are space afters.  This is how it compresses out the blank lines on DSPSPLF, DSPPFM, etc.

    I do not see anything in OVRPRTF QPRINT to change this.  I tried playing with it a little with

    OVRPRTF FILE(QPRINT) CHLVAL((2 (1)))

    but that didn't seem to help.  And in my 37 years on this job that's probably the first time I ever tried the channel value parameter.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 16.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 09:56 AM

    Well done Robert.

    MOHAN, all you have to do is use the CPYTOSTMF proposed by Robert. 



    ------------------------------
    Dominique Gayte
    ------------------------------



  • 17.  RE: Copy PF Member to a Spool File

    Posted Fri October 20, 2023 03:09 PM

    Rob/Satid/Dominique,

    I don't know where to go after CPYTOSTMF.

    But there is a good news, one of my colleague has a solution.

    I will need to check with him how he did it & I will come back & post it for the benefit of all our IBM community.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 18.  RE: Copy PF Member to a Spool File

    Posted Mon October 23, 2023 10:21 AM

    After speaking with my colleague, l have to mention this so we can put off further curiosity.

    We had to change our overlay & the Data-Map to account for the 5 blank lines on the top of the spool file. 

    We have to do this to regenerate Old & aged BOL's for which we only have a PF as a backup.

    This is out of the ordinary & is not a normal way of applying Overlay's over a spool file. 

    Thank you all for chiming in on this topic.

    Have a great week!



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 19.  RE: Copy PF Member to a Spool File

    Posted Mon October 23, 2023 10:41 AM

    Thank you for the update.

    That explains why you have a PF with the data already formatted like I displayed in one of my examples.

    One might consider generated PDF's and retaining those in the IFS for a period of time.  And maybe keeping a PF with the BOL number and where that PDF is and what name it has.  One of the benefits of this is, if you change your overlay and format of the output your reprint program doesn't have to keep track of when that change occurred to handle multiple formats.  PDF are easy to generate using free standard IBM supplied programs if you load 

    Resource                                               
       ID     Option  Feature  Description                 
    5770TS1   *BASE    5050    IBM Transform Services for i



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------