ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

QSYSPRT headaches

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

  • QSYSPRT headaches

    Holy cow, I'm going beserk!!!

    I wrote a simple little report and I can't get it to print headings at OF!

    I turn on OF at program initialization to print them the first time but after that, they don't print again until the end, Total lines.

    I have tried everything, DLTOVR at CL call, OVRPRTF before RPG call, nothing gets them to print!
    Here's the code

    Code:
    FF0083   IF  E           K        DISK                
    FF00821  IF  E           K        DISK                
    FQSYSPRT O   F     132     OF     PRINTER             
     *                                                    
    E                    KYS         5 15                 
    E                    ARR        15  1                 
     *                                                    
    I              'ABCDEFGHIJKLMNOPQRS -C         HI     
    I              'TUVWXYZ'                              
    I              'abcdefghijklmnopqrs -C         LO     
    I              'tuvwxyz'                              
     *                                                    
    I            DS                                       
    I                                        1  77 KYWRD  
    I                                    B   1   20ENTRY  
    I                                        3  17 KYWRD1 
    I                                       18  32 KYWRD2 
    I                                       33  47 KYWRD3 
    I                                       48  62 KYWRD4 
    I                                       63  77 KYWRD5 
     *                                                    
    C           KEY       KLIST                           
    C                     KFLD           MTMNI            
    C                     KFLD           MTMNI                  
    C                     KFLD           MTSELN                 
     *                                                          
    C                     MOVE KYWRDS    KYWRD                  
    C                     MOVEAKYWRD1    KYS,1                  
    C                     MOVEAKYWRD2    KYS,2                  
    C                     MOVEAKYWRD3    KYS,3                  
    C                     MOVEAKYWRD4    KYS,4                  
    C                     MOVEAKYWRD5    KYS,5                  
     *                                                          
    C           *LOVAL    SETLLI0083                            
    C                     DO   *HIVAL                           
    C                     READ I0083                    99      
    C   99                LEAVE                                 
    C           LO:HI     XLATEMTMNTX    $$MNTX 40              
    C                     DO   ENTRY     X       10             
    C                     MOVEAKYS,X     KYWD   15              
    C           LO:HI     XLATEKYWD      $KYWD  15              
    C           $KYWD     IFNE *BLANKS                          
    C                     EXSR SR001                            
    C           $KYWD:Y   SCAN $$MNTX:1                 98      
    C           *IN98     IFEQ *ON                              
    C           KEY       CHAINI00821               99          
    C                     EXCPTPRINT                            
    C                     ADD  1         COUNT   40    
    C                     ENDIF                        
    C                     ENDIF                        
    C                     ENDDO                        
    C                     ENDDO                        
     *                                                 
    C                     MOVE *BLANKS   $$KYWD 75     
    C                     DO   ENTRY     X             
    C                     MOVEAKYS,X     KYWD          
    C   01      $$KYWD    CAT  ',':0     $$KYWD        
    C           $$KYWD    CAT  KYWD:1    $$KYWD        
    C                     SETON                     01 
    C                     ENDDO                        
     *                                                 
    C                     SETON                     LR 
     *                                                 
    CSR         *INZSR    BEGSR                        
    C           *ENTRY    PLIST                        
    C                     PARM           KYWRDS 77     
     *                                                 
    C                     TIME           TIMDAT 120    
    C                     MOVELTIMDAT    @TIME   60    
    C                     MOVE TIMDAT    @DATE   60    
     *                                                               
    C                     SETON                     OF               
    CSR                   ENDSR                                      
     *                                                               
    CSR         SR001     BEGSR                                      
    C                     MOVEA$KYWD     ARR                         
    C                     Z-ADD15        Y       20                  
    C                     DO   *HIVAL                                
    C           ARR,Y     COMP ' '                  90  95           
    C   90                LEAVE                                      
    C   95                SUB  1         Y                           
    C   95                ITER                                       
    C                     ENDDO                                      
    CSR                   ENDSR                                      
     *                                                               
    OQSYSPRT H  1     OF                                             
    O                         @TIME        '  :  :  '                
    O                         @DATE   +  2                           
    O                                  127 'Page:'                   
    O                         PAGE  Z  132                           
    O        H  2     OF                                             
    O                                   72 'Menu Selections Based On'
    O                                      ' Search Phrases'      
    O        H  1     OF                                          
    O                                      'Menu      '           
    O                                 +  2 'Option#'              
    O                                 +  2 'Text                 '
    O                                      '                     '
    O                                 +  2 'Pgm Name  '           
    O                                 +  2 'Menu Name '           
    O        H  1     OF                                          
    O                                      '----------'           
    O                                 +  2 '-------'              
    O                                 +  2 '---------------------'
    O                                      '---------------------'
    O                                 +  2 '----------'           
    O                                 +  2 '----------'           
    O        E  1             PRINT                               
    O                         MTMNI                               
    O                         MTSELNZ +  3                        
    O                         MTMNTX  +  3                        
    O                         MZJTOE    75                        
    O                         MZMTOE  +  2                        
    O        T 11                                                 
    O                                      '* Number Listed:'     
    O                         COUNT Z +  2                      
    O        T  1                                               
    O                                      '** Search Phrases:' 
    O                         $$KYWD  +  2

    Some of you might recognized this from an earlier post, and you would be correct. At that time, the report was only 1 page so I didn't see this problem until I ran it and got 20+ pages with heading for page 1 (at the begining) and page 2 (at the end with the total lines).
    Everyday's a school day, what grade are you in?

  • #2
    Re: QSYSPRT headaches

    I dont see you checking for overflow "OF"

    you need to do this prior to printing detail record.
    Code:
    if *INOF = *ON
     write header
     eval *INOF = *OFF
    endif
    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: QSYSPRT headaches

      O- specs! Aaaaaack!
      "Time passes, but sometimes it beats the <crap> out of you as it goes."

      Comment


      • #4
        Re: QSYSPRT headaches

        Hi RedVan:

        You need to do a fetch overflow on your exception output

        Code:
        O        E[COLOR=red]F[/COLOR]  1             PRINT
        Not sure if you need the overflow indicator defined on the f spec or not:

        Code:
        FQSYSPRT   O    F  132        PRINTER OFLIND(*INOF)
        Best of Luck
        GLS
        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

        Comment


        • #5
          Re: QSYSPRT headaches

          GLS:
          Thanks, that did the trick.

          Littlepd, Jamief:
          I understand what you're saying but I would think that would only apply if I were using a print file of my design (which I usually do but this little report didn't seem to warrant it's own print file).

          Thanks everyone.
          Everyday's a school day, what grade are you in?

          Comment


          • #6
            Re: QSYSPRT headaches

            Im not saying you need a print file, Im saying you have to code for overflow...
            Dont you???!!!

            PHP Code:
            FAPAVENDB  IF   E           K DISK                                       
            FQSYSPRT   O    F  132        PRINTER OFLIND
            (*INOF)                      
             *                                                                       
            D                 DS                                                     
            D  DUMMY                  1      1                                       
             
            *                                                                       
             /
            COPY QPGMSRC,APA1CTRL                                                  
             
            *                                                                       
            C                   EXSR      HSKPG                                      
             
            *                                                                       
            C                   READ      APAVENDR                               81  
             
            *                                                                       
            C     *IN81         DOWEQ     '0'                                        
             
            *                                                                       
            C     *INOF         IFEQ      '1'                                        
            C                   EXCEPT    HDGS                                       
            C                   SETOFF                                           OF      
            C                   END                                                      
             
            *                                                                           
            C                   EXCEPT    PRINT                                          
             *                                                                           
            C     AAVZIP        COMP      *ZEROS                                 96      
            C     AAVZI4        COMP      
            *ZEROS                                 95      
            C     AAVAD3        IFEQ      
            *BLANKS                                        
            C                   EXCEPT    PRINT1                                         
            C                   
            ELSE                                                     
            C                   EXCEPT    PRINT2                                         
            C                   END                                                      
             
            *                                                                           
            C                   READ      APAVENDR                               81      
            C                   END                                                      
             
            *                                                                           
            C                   SETON                                        LR          
             
            *                                                                           
            OQSYSPRT   E            HDGS           1 03                          
            O                       UDATE         Y     10                       
            O                       DACONM              53                       
            O                                           72 
            'PAGE'                
            O                       PAGE          Z     78                       
            O          E            HDGS           2                             
            O                       UTIME               10 
            '  :  :  '            
            O                                           44 'VENDOR MASTER'       

            blah blah blah .............................. 
            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


            • #7
              Re: QSYSPRT headaches

              Well, that depends; If I'm using a prtf, yes I check the error ind on the write statement and if on, "EXSR HEADER" to print headings on the next page.
              If I'm not using a prtf, no, I usually don't and have never had an issue, when it's coded like the example code I supplied. However, I now realize that this time around, the exception statement was the difference and I needed to fetch overflow as GLS indicated. All is good now, without checking for OF.
              Everyday's a school day, what grade are you in?

              Comment

              Working...
              X