ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Total Number of Pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Total Number of Pages

    Hi

    In printer file I need to print (Page No / Total Number of Page) any one help with this regards

    Thanx in Advance
    Magesh

  • #2
    Re: Total Number of Pages

    you will have to print it twice..
    once to get total pages and the second time to print with pages..

    you can use
    PHP Code:
    D CUR_PAGE              369    372I 0         Current page cnt 
    from INFDS see here



    this should help
    PHP Code:
    FARC45AP   o    e             printer usropn   oflind(*in70)      
    F                                              infds(PrintFDS)    
                                                                      
    d PrintFDS        ds                                  
    d x                       1    404                    
    d a                     103    112                    
    d b                     113    122                    
    d c                     123    124I 0                 
    d LineNumber            367    368I 0                 
    d PageNumber            369    372I 0 
    Please post a sample when you get it going.

    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Total Number of Pages

      Execute a little SQL statement to see how many records you will print (select count(myfield)...)
      Thereafter it's just simple maths.
      Regards

      Kit
      http://www.ecofitonline.com
      DeskfIT - ChangefIT - XrefIT
      ___________________________________
      There are only 3 kinds of people -
      Those that can count and those that can't.

      Comment


      • #4
        Re: Total Number of Pages

        Risky Kit. What happens if the report is modified later on ?

        <Edit>
        There is also the article PRINTING "PAGE X OF Y" by Scott Klement. Look here.
        Last edited by Mercury; December 21, 2010, 06:57 AM.
        Philippe

        Comment


        • #5
          Re: Total Number of Pages

          Philippe,

          I am bad ...I have let my subscription end.

          so without divulging top secret info what was his solution?
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: Total Number of Pages

            Please look at attachments.
            Attached Files
            Philippe

            Comment


            • #7
              Re: Total Number of Pages

              I hate disagreeing with Mercury (as much as I hate disagreeing with Biggie) but **in this case** I'm going to.

              If I make a change to the program and I don't check - then I'm at fault.
              But using the qusrspla API will most likely lead to problems on an OS upgrade. The value of the record length for this API changes for every release. Here's an example http://www.code400.com/cpyfrmsplf.php. In v5r4 the RECLEN value needs to be 3841 - I've not implemented this for a higher OS release.

              In sum, in this instance, (i.e. for something so simple) I would rather trust my own programming with my own documentation. For something more complex then I would (and do) recommend using the GET/PUT SPLF API method. (eg. http://www.code400.com/forum/showthr...ll=1#post31345 )
              Regards

              Kit
              http://www.ecofitonline.com
              DeskfIT - ChangefIT - XrefIT
              ___________________________________
              There are only 3 kinds of people -
              Those that can count and those that can't.

              Comment


              • #8
                Re: Total Number of Pages

                @Kit
                you are not yet on Release V5R4 or higher!
                PUTSPLF and GETSPLF will disappear with Release V5R4
                (... and IBM always suggested not to use these APIs but use Scott's method)

                Birgitta

                Comment


                • #9
                  Re: Total Number of Pages

                  Biggie

                  But it's not these (GET/PUT SPLF) API's that are the problem... as stated, it's the qusrspla API (see post #7) which IS used.

                  You state that these 2 API's are not available on v5r4... could you post a link please?... because we are using these API's on our v5r4 box.

                  edit... The supplied source DOES use these 2 API's (GET/PUT SPLF).
                  Last edited by kitvb1; December 22, 2010, 05:16 AM.
                  Regards

                  Kit
                  http://www.ecofitonline.com
                  DeskfIT - ChangefIT - XrefIT
                  ___________________________________
                  There are only 3 kinds of people -
                  Those that can count and those that can't.

                  Comment


                  • #10
                    Re: Total Number of Pages

                    Kit,

                    If I had forethought such reaction I would have restrained my words. Believe me I had not the slightest intention of annoying you. I just wanted to push up that using " select count " was not a long-lasting solution.

                    Originally posted by kitvb1
                    The value of the record length for this API [QUSRSPLA] changes for every release.
                    That's true. However, but maybe it' just me, I don't see how it matters here since Scott anticipated this change by adding 500 to the user space size (look at the Scott's pagexofyr4 program) and this is probably more than enough for future releases.
                    Code:
                         c                   eval      wkSpcSize = (dsSA_BufSiz * dsSA_NbrBuf)
                         c                                   + %size(dsGSH) [COLOR="red"]+ 500[/COLOR]
                    Besides the needed fields positions (Spool number, Total pages and Number of buffers) don't change between releases.
                    Last edited by Mercury; December 22, 2010, 07:52 AM. Reason: typo
                    Philippe

                    Comment


                    • #11
                      Re: Total Number of Pages

                      Hi Philippe

                      No, you haven't annoyed me at all - only my boss does that, daily!!

                      I must admit I did not read Scott's program so didn't pick up that he catered for the version changes. I was going mostly on the CPYFRMSPLF command notes and my own experience using that command when I installed it here in 2007.

                      But now, in light of what Biggie has written... ???
                      Originally posted by Biggie
                      ... PUTSPLF and GETSPLF will disappear with Release V5R4
                      (... and IBM always suggested not to use these APIs ...
                      Regards

                      Kit
                      http://www.ecofitonline.com
                      DeskfIT - ChangefIT - XrefIT
                      ___________________________________
                      There are only 3 kinds of people -
                      Those that can count and those that can't.

                      Comment


                      • #12
                        Re: Total Number of Pages

                        Kit,
                        Look here please.
                        Philippe

                        Comment


                        • #13
                          Re: Total Number of Pages

                          hahaha ... when I talk about (GET/PUT SPLF) API's .... it's the API - not the utility ... i.e. QSPGETSP & QSPPUTSP API's.
                          Regards

                          Kit
                          http://www.ecofitonline.com
                          DeskfIT - ChangefIT - XrefIT
                          ___________________________________
                          There are only 3 kinds of people -
                          Those that can count and those that can't.

                          Comment


                          • #14
                            Re: Total Number of Pages

                            Maybe a little stubborn Kit

                            Originally posted by Bruce Vining
                            The QSPGETF and QSPPUTF programs are not intended to be used for saving and restoring of spool files. These programs are intended to be used to send reports to IBM in service situations. From the IBM Service web site (with no idea how this might look): Bruce Vining ------------------------------ Document Title Using QSPGETF and QSPPUTF Print Utilities with Command Source (R510 and Above) Document Description This document covers usage of the QSPGETF and QSPPUTF print utilities. The command source and a save file for the GETSPLF and PUTSPLF commands are supplied if the user wants to use a command entry screen rather than doing a CALL QSPGETF or CALL QSPPUTF. These utilities work with all types of IBM® OS/400® or IBM® i5/OS? spooled files including *SCS, *AFPDS, *IPDS, and *USERASCII spooled files. Caution: QSPGETF and QSPPUTF are not Application Programming Interfaces (APIs). They are unsupported utilities used to copy spooled files to a database file and back again for the sole purpose of sending the spooled file to the Rochester Support Center without having to do a remote signon. These utilities are not intended for saving and restoring or archiving OS/400 or i5/OS spooled files and are not guaranteed to restore the spooled file with 100 percent fidelity. Therefore, they should not be used in a production environment. If an OS/400 or i5/OS spooled file cannot successfully be copied to or from a database file using these utilities, IBM is under no obligation to diagnose nor fix these utilities. Furthermore, QSPGETF and QSPPUTF will be removed from the OS/400 or i5/OS in a future release. A new procedure will be created for the Rochester Support Center to retrieve spooled file information from a customer's system. To write a program that copies OS/400 or i5/OS spooled files to and from database files, refer the Get Spooled File Data (QSPGETSP) and Put Spooled File Data (QSPPUTSP) APIs in the AS/400 System API Reference (SC41-5801). The QSPGETSP and QSPPUTSP APIs can be used to copy an OS/400 or i5/OS spooled file to a user space and back and the program can copy the data stream from the user space to a database file and back again. Note: The QSPGETF print utility changed as of R510 (V5R1M0) because the spooled file number parameter in the various spooled file commands has increased from 4 digits (1 - 9999) to 6 digits (1 - 999999) and the SPLNBR variable in the GETSPLF command has changed from a TYPE(*INT2) to a TYPE(*INT4). Therefore, the attached save file and the QSPGETF command source in this document is not the same as those in the document for R320 through R450. If the QSPGETF and QSPPUTF print utilities are required on an older OS/400 or i5/OS system, refer to the following Rochester Support Center knowledgebase document: 8011926, Using QSPGETF and QSPPUTF Print Utilities with Command Source (R320 through R450): This document was last updated on 12/02/2004. Notice from the iSeries Memorandum to Users, Version 5 Release 3 - Programs QSPGETF and QSPPUTF to be Removed in Future Release Note: The following is stated in the iSeries Memorandum to Users, Version 5 Release 3: Programs QSPGETF and QSPPUTF have never been documented or supported as operating system APIs. In the release following V5R3, these programs will be removed. In preparation for this, remove any references to these programs from your application programs. Replace calls to QSPGETF and QSPPUTF with calls to documented and supported APIs for working with spooled files: o QUSRSPLA o QSPCRTSP o QSPOPNSP o QSPGETSP o QSPPUTSP o QSPCLOSP o QUSLSPL Appendix A of the IBM Redbook IBM AS/400 Printing III (GG24-4028-00), demonstrates how you can use the supported APIs to perform the same function as programs QSPGETF and QSPPUTF. IBM Backup Recovery and Media Services for iSeries and IBM Content Manager OnDemand for iSeries are examples of products that provide support for saving and restoring spooled files. For more information, refer to the following: iSeries Memo to Users Version 5 Release 3, in PDF format, URL http://publib.boulder.ibm.com/infoce...info/rzaq9.pdf IBM AS/400 Printing III abstract, URL http://publib-b.boulder.ibm.com/Redb...6?OpenDocument IBM AS/400 Printing III, GG24-4028-00, in PDF format, URL http://www.redbooks.ibm.com/pubs/pdf...s/gg244028.pdf Getting the GETSPLF and PUTSPLF Commands from the Attached Save File Creating the GETSPLF and PUTSPLF Commands from the Source Code Using the GETSPLF Command to Copy a Spooled File to a Database File Using the PUTSPLF Command to Create a Spooled File from a Database File Calling the QSPGETF Program Directly to Copy a Spooled File to a Database File Calling the QSPPUTF Program Directly to Create a Spooled File from a Database File Using FTP to Copy the Data Base File to a PC and Back to OS/400 or i5/OS
                            Philippe

                            Comment


                            • #15
                              Re: Total Number of Pages

                              Thanks for the extra info Philippe
                              Regards

                              Kit
                              http://www.ecofitonline.com
                              DeskfIT - ChangefIT - XrefIT
                              ___________________________________
                              There are only 3 kinds of people -
                              Those that can count and those that can't.

                              Comment

                              Working...
                              X