ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Spool file problem

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

  • Spool file problem

    hi,

    I am retreiving multiple records from the database and displaying it in the PDM screen.if i need i can print those records.There r nearly 100 records. i want to create the report in horizondal manner. i am printing 18 records per page,but i can view only two pages fully and half of the next page,after that i am getting the following error message.

    CT70000P2 - Printer File
    CT7001CPY - RPG Program


    "I/O error CPF5004 was detected in file CT70000P2 (C G D F).

    The call to *LIBL/CT7001CPY ended in error (C G D F). "


    Even if i change the records per page as 16,i can view till the same half page and again the same error msg is displayed.

    Expecting the reply ASAP,
    R.Ranjini

  • #2
    Re: Spool file problem

    CPF5004 Error is
    Printer overflow line detected for file.

    This is something related to the handling of Overflow.

    Can u post the code ... That will be helpful
    Thanks,
    Giri

    Comment


    • #3
      Re: Spool file problem

      hi giri,

      this is my RPG code


      C PRINT BEGSR
      C EVAL #PG=COUNT1/38
      C EVAL #PAG=#PG+1
      C EVAL I=1
      C DOW I<=COUNT1
      C IF *IN88=*ON
      C WRITE HEADER
      C WRITE HEADER1
      C EVAL PG=0
      C EVAL *IN88=*OFF
      C ENDIF
      C MOVE #CUS(I) #CCDCUS
      C EVAL #T1=#QTY(I)+#T1
      C IF PG<38
      C WRITE DETAIL
      C EVAL PG=PG+1
      C EVAL I=I+1
      C ELSE
      C MOVE #T1 #TOT11
      C WRITE TOTAL
      C WRITE FOOTER
      C DO 2
      C EVAL SPACE=' '
      C WRITE GAP
      C ENDDO
      C EVAL *IN88=*ON
      C ENDIF
      C ENDDO
      C MOVE #T1 #TOT11
      C WRITE TOTAL
      C WRITE FOOTER
      C ENDSR



      This is my Printer file program

      A R HEADER
      A 46
      A SPACEB(001)
      A 'OUTSTANDING CUSTOMER ORDER
      A @DATE 8A O +2
      A R HEADER1
      A 1
      A SPACEB(001)
      A '__________________________
      A ___________________________
      A ___________________________
      A ___________________________
      A _______'
      A 104
      A 'Shipped'
      A SPACEB(001)
      A 113
      A 'Balance'
      A 133
      A 'Balance'
      A 141
      A 'Rmks'
      A 1
      A 'Cust.'
      A 8
      A 'Order'
      A 16
      A 'Ordered'
      A 24
      A 'Pack'
      A 36
      A 'Ordered'
      A 55
      A 'Price'
      A 71
      A 'Amount'
      A 78
      A 'Curr.'
      A 84
      A 'Shipped'
      A 104
      A 'Value'
      A SPACEB(001)
      A 113
      A 'Qty.'
      A 133
      A 'Value'
      A 8
      A 'No.'
      A 16
      A 'Date'
      A 24
      A 'ID'
      A 36
      A 'Qty.'
      A 84
      A 'Qty.'
      A 1
      A '__________________________
      A ___________________________
      A ___________________________
      A ___________________________
      A _______'
      A SPACEB(001)
      A R DETAIL
      A #CCDCUS R O 1
      A REFFLD(CUSHD/CCDCUS TESDAT/
      A SPACEB(001)
      A #CCDORD R O +1
      A REFFLD(CUSHD/CCDORD TESDAT/
      A #CODATE 8A O +1
      A #LCDKE1 R O +1
      A REFFLD(CUSED/LCDKE1 TESDAT/
      A #QTYORD 9S 2O +1
      A EDTCDE(3)
      A #LPRICE 15S 5O +1
      A EDTCDE(3)
      A #AMT 15S 2O +1
      A EDTCDE(3)
      A #CCDCUR R O +1
      A REFFLD(CUSHD/CCDCUR TESDAT/
      A #SHPQTY 8S 2O +1
      A EDTCDE(3)
      A #SHPVAL 17S 2O +2
      A EDTCDE(3)
      A #BALQTY 8S 0O +1
      A EDTCDE(3)
      A #BALVAL 17S 2O +2
      A EDTCDE(3)
      A R TOTAL
      A 1
      A SPACEB(001)
      A '__________________________
      A ___________________________
      A ___________________________
      A ___________________________
      A _______'
      A 1
      A SPACEB(001)
      A 'Totals'
      A #TOT11 9S 2O +26
      A EDTCDE(3)
      A #TOT21 15S 2O +18
      A EDTCDE(3)
      A #TOT31 9S 2O +3
      A EDTCDE(3)
      A #TOT41 18S 2O +2
      A EDTCDE(3)
      A #TOT51 8S 0O +1
      A EDTCDE(3)
      A #TOT61 18S 2O +1
      A EDTCDE(3)
      A 1
      A SPACEB(001)
      A '__________________________
      A ___________________________
      A ___________________________
      A ___________________________
      A R FOOTER
      A 1
      A SPACEB(001)
      A 'Date Printed :'
      A @DATE 8A O +1
      A 129
      A 'Page'
      A +1
      A PAGNBR
      A +1
      A 'of'
      A #PAG 4S 0O +1
      A EDTCDE(3)
      A R GAP
      A SPACE 5A O 1
      A SPACEB(001)

      Comment


      • #4
        Re: Spool file problem

        Ranjini,

        The problem is u r able to see only one page of the report. When ur display screen size is 24X80, open a spool file.. u will see page 1, press pagedown ,even then its page 1 , when u press page down again half of the page u will have page 1 , then page 2 will be started and hence u r getting the problem.

        To avoid this problem do the following.

        Ur requirement is to print say 16 records per page.

        In ur RPGLE program define Overflow indicator to ur printer file(I guess *In88 in ur program.) Set it on whenver the record count touches 16.

        Code should be something like this.

        read Databasefile;
        Count = 0;
        Dow till Eof

        Eval Count = Count+1 ;
        If ( Count/16 == 0 )
        *In88 = *On;
        EndIf ;

        If *In88 = *On
        Print Header ;
        --
        --
        *In88 = *Off ;
        EndIf ;

        Write detail ;

        read Databasefile;

        EndDo;

        Please let me know once u r done.
        Thanks,
        Giri

        Comment


        • #5
          Re: Spool file problem

          Hey i got it yar,

          i just did a silly mistake. i didn't initialize the overflow indicator while declaring the printer file.

          Thanks,
          R.Ranjini

          Comment

          Working...
          X