ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Printer top of page question

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

  • Printer top of page question

    So lets say I have a simple program that reads through some records and as it does this it totals some fields. Then I print the total during the end of file. What if I want to print those totals at the header level? Is there a "top of page" overlay anyone knows about? I know I can do this another way but why I'm asking is this program is huge and I didn't create it and would not rather change it that much. Just something I thought might be useful.
    This all came up b/c I have a boss who would like some totals at the top instead of looking all the way at the bottom for the number.

    Thanks in advance.

  • #2
    Re: Printer top of page question

    Hi CaptainRon:
    If you are using an externally defined print file use the SKIPB keyword:
    (code taken from here: http://www.texas400.com/tutddsspecs.html )
    Code:
    [B]0006.00      A          R HDG1                                                 
    0007.00      A                                      [COLOR=#ff0000]SKIPB(1)   [/COLOR]                
    0008.00      A                                     2DATE(*YY) EDTCDE(Y)
    0009.00      A                                    26'CUSTOMER ORDER REPORT'    
    0010.00      A                                    60'PAGE'                     
    0011.00      A                                    67PAGNBR                     
    [/B]
    If you are using an internally defined print file:
    Code:
    0028.00 OPRINTER   E            LBL            1 [COLOR=#ff0000]01  [/COLOR]            
    0029.00 O                       CON                 33           
                   
     Prompt type . . .    O      Sequence number . . .  0028.00      <----- use f4 (prompt) on line 28 to get this display
                                                                     
     Filename     Type     Fetch   N01N02N03    EXCEPTName           
     PRINTER       E                            LBL                  
      ---- Space -----    ----- Skip -----                           
      Before     After    Before     After      Comment              
                    1        [COLOR=#ff0000]01[/COLOR]
    The Skipb(01)/"skip before 01" says skip to line number 1 before printing.

    The above solution assumes you want to print the total line AFTER all of the detail lines.

    If you want to print the Total line first you will need to do some coding.

    Best of Luck
    GLS
    Last edited by GLS400; August 8, 2014, 08:51 AM.
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Printer top of page question

      I now all that. I want to skip to the first line after the last line is printed. no point in printing the totals on the next pages header...

      Comment


      • #4
        Re: Printer top of page question

        I'm still not quite clear on what you're asking. Are you asking how to print the totals on the next page if overflow requires it - but not print the headings if all it is printing is the totals? You do that by setting on an indicator and specifying that indicator on the print specs of the headers to only print if that indicator is turned off. Using the example in earlier post:
        Code:
              A          R HDG1                                                       
              A                                      SKIPB(1)                         
              A                                     2DATE(*YY) EDTCDE(Y)              
              A N90                                26'CUSTOMER ORDER REPORT'          
              A N90                                60'PAGE'                           
              A N90                                67PAGNBR
        If *IN90 is turned off (normal) it prints - in your code when you get to the code that prints the totals turn on *IN90 - if it overflows the headings won't print.

        Comment


        • #5
          Re: Printer top of page question

          Example.. Lets say I only have one page. Header, detail, and totals. After the last record is read and printed totals usually print. I want to print those totals where the Header ALREADY printed.
          The way I'm going to get around this is print the report and save it to a file. Then read this file put my totals in where I want that were passed from the calling program. Kind of an odd way to do it but I was more interested to see if there was some "reset" to top of page routing I already printed too.

          Or to make this real confusion and comical I could
          use the skipb, but make everything print everything upside down, sort it in descending seq and then have the printer collate the pages backwards so the total shows up on the first page....LOL

          Comment


          • #6
            Re: Printer top of page question

            So - you essentially want a "rewind" on the current page so you can print on line 3 even though your last line printed was on line 40... not aware of this capability - I suppose you can write the records to a work file and after x # of records read the records and print them - and if appropriate print the totals before the detail... but that defeats the stated goal of not wanting to make substantial changes to the program.

            Comment


            • #7
              Re: Printer top of page question

              yep.. you got it.. I think I would rather copy the spool to a file then write a program to add those totals. Should be a few lines of code vs a mess...

              Comment


              • #8
                Re: Printer top of page question

                If you have an electronic forms package you could accomplish it fairly simple....

                Comment


                • #9
                  Re: Printer top of page question

                  The way I see it you have 3 options:
                  1. do it the way you described .... you need a second program to scan the printed output and re-print
                  2. Basically the same as you described but output a record at level break (you need a seperate program to do this) and consume that file in your existing program.
                  3. Use SQL to calculate totals on the fly at each "page header".... This can be done in the existing program

                  Best of Luck
                  GLS
                  Last edited by GLS400; August 8, 2014, 10:41 AM.
                  The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                  Comment

                  Working...
                  X