PRINTER FILE

20 pts.
Tags:
AS/400 printing
RELATED TO MY QUESTION

I HAVE EXTERNALY DISCRIBE PRINTER FILE. I WANT TO WRITE 30 RECORDS IN ONE PAGE. I USED OFLIND KEY WORLD BUT PAGE BREAK NOT WORK. TWO HEADINGS ARE WRITE IN ONE PAGE .

I ADD MY SOURCE CODE HERE  

FT@M@CHP2  iF   E           K DISK      FT@M@UWDT  iF   E           K DISK      FT@M@ADDR  iF   E           K DISK      FL@R@PARA  iF   F  128    10AIDISK    KeyLoc(1)      FCLR040FM  CF   E             WORKSTN INFDS(FIDS##)      FCLR040RL  O    E             Printer OFLIND(*In80)      F*                                    INFDS(LINDS1)      D*----------------------------------------------------------------_________      D* File information data structure      DFids##           Ds      D Action                369    369      D*WKSFPG                378    379B 0      D      D*LINDS1           Ds      D*F#PSZ1                152    153B 0      D*F#OFL1                188    189B 0      D*F#CRL1                367    368B 0      D      D* Program Status data structure      DPsds##          SDs      D  Prog##           *PROC      D  User##               254    263      D      D* Function key definition of Hex values      D Exit            C                   Const(X'33')      D Cancel          C                   Const(X'3C')      D Confirm         C                   Const(X'B1')      D Enter           C                   Const(X'F1')      D      D ErMsg           S             75    DIM(35) CtData PerRcd(1)      D Inits           S              2    DIM(20)      D Cntnopol        S              3  0 Inz(*Zeros)      D      D* Ds to describe Parameter file      DParaRec          Ds           128      D KeyPara                 1     10      D Kf1to2                  1      2      D Kf3to4                  3      4      D Kf11to40               11     40      D Kf11to16               11     16S 0      D Kf11to12               11     12S 0      D Kf13to16               13     16S 0      D Kf31to35               31     35S 2      D Kf36to40               36     40S 2      D Kf41to46               41     46S 0      D Kf42to43               42     43S 0      D Kf59to59               59     59      D Kf60to61               60     61      D Kf11to128              11    128      D      C*________________________________________________________________      C* Main Program logic      C      C                   Movel     User##        @OUSER      C                   Movel     Prog##        #RPTID      C                   write     HEAD01      C                   write     SUBHEAD      C      C                   Dow       Action <> Exit      C                   Exfmt     @459WLPR      C      C                   IF        Action = Exit      C                   Leave      C                   Endif      C      C                   Exsr      Val@459dsp      C      C                   If        #Error = *On      C                   Exfmt     @459EROR      C                   Endif      C*      C                   If        #Error = *Off      C                   Exsr      Pntchquedtil      C                   Movel     *Blanks       @POLNO      C                   Endif      C      C                   Enddo      C                   write     FOOT01      C      C                   Move      *On           *INLR      C 0031 C*_____________________________________________________________________      C     Val@459dsp    Begsr      C                   Eval      *In60 = *Off      C                   Movel     *Off          #Error            1      C*Policy no cannot be blanks      C                   If        @POLNO = *blanks      C                   Eval      *In60 = *On      C                   Movel     *ON           #Error      C                   Movel     ErMsg(1)      @ERRMSG      C                   Leavesr      C                   Endif      C*Policy no does not exist in the master file t.m.uwdt      C      C     @POLNO        Chain     LMUWDT      C                   If        Not%Found      C                   Eval      *In60 = *On      C                   Movel     *ON           #Error      C                   Movel     ErMsg(2)      @ERRMSG      C                   Leavesr      C                   Endif      C*      C     @POLNO        Chain     LMCHPR      C                   If        Not%Found      C                   Eval      *In60 = *On      C                   Movel     *ON           #Error      C                   Movel     ErMsg(3)      @ERRMSG      C                   Leavesr      C                   Endif      C      C                   Endsr 0031 C*_____________________________________________________________________      C     Pntchquedtil  Begsr      C      C      C     @POLNO        Chain     LMCHPR                             20      C                   If        %found      C                   Movel     @POLNO        #POLNO      C     @POLNO        Chain     LMADDR      C                   If        %Found      C                   Exsr      GetName      C      C                   If        *In20 = *Off      C                   Eval      Cntnopol = Cntnopol + 1      C                   Endif      C                   Z-add     Cntnopol      #NUMBER      C      C                   If        Cntnopol = 31      C                   Z-add     1             #NUMBER      C                   Eval      *In80 = *On      C                   Z-add     1             Cntnopol      C                   Endif      C      C**                 If        (F#OFL1-F#CRL1)<30      C**                 Eval      *In80 = *On      C**                 Z-add     *Zeros        Cntnopol      C**                 write     HEAD01      C**                 write     SUBHEAD      C**                 Eval      *in80 = *Off      C**                 Endif      C      C      C      C                   Select      C                   When      ADLIN4  <> *blanks      C                   Movel     ADLIN4        #PTOWN      C      C                   When      ADLIN3 <> *blanks      C                   Movel     ADLIN3        #PTOWN      C      C                   When      ADLIN2 <> *blanks      C                   Movel     ADLIN2        #PTOWN      C      C                   When      ADLIN1 <> *blanks      C                   Movel     ADLIN1        #PTOWN      C      C                   EndSl      C                   Endif      C      C****               Movel     *Zeros        #AMNT      C      C      C                   If        *In80 = *on      C                   write     HEAD01      C                   write     SUBHEAD      C                   Eval      *in80 = *Off      C                   Endif      C      C                   write     DETL01      C                   Endif      C      C**                 Endif      C      C                   Endsr      C*_____________________________________________________________________      C     GetName       Begsr      C                   Move      *Blanks       Wt_Fld1          20      C                   Z-add     *Zeros        k                 2 0      C                   Move      *Blanks       KeyPara      C      C                   Move      '06'          Kf1to2      C                   Move      AdTitl        Kf3to4      C     KeyPara       Chain     L@r@Para      ParaRec              53      C                   If        *In53 = *Off      C                   MoveL     Kf11to40      #NAME      C                   Endif      C      C                   Move      *Blanks       Inits      C                   Eval      k = 1      C      C                   Dow       %Subst(AdInit:k:1) <> *Blanks      C                   Eval      Inits(k) = %Subst(AdInit:k:1)      C                   Move      '.'           Inits(k)      C                   Eval      k = k + 1      C                   Enddo      C                   MoveA     Inits(1)      Wt_Fld1      C                   Cat       Wt_Fld1:1     #NAME      C                   Cat       AdSurn:1      #NAME      C                   Endsr      C*_____________________________________________________________________ ** ErMsg ERROR : Policy number cannot be blanks ERROR : Invalid policy number ERROR : Policy number not found in cheque detail file

I USED SKIP(B), BUT THERE IS NO PAGE BREAK.

THANKS FOR ANSWERS, 

 

Answer Wiki

Thanks. We'll let you know when a new response is added.

The main logic problem I see is that the code that increments Cntnopol and sets on indicator 80 is at a different nesting level of your IF logic than the code that writes to the printer file. If your chain to LMADDR fails, you will still perform the WRITE DETL01 but you will not increment Cntnopol. For both stylistic and logical reason, you should always keep related code such as incrementing a line counter and printing adjacent to each other.

I’m not sure if this will fix the specific problem you are currently having, but it will be an issue at some point. You might want to try putting your program in debug mode and stepping through it line by line to get a better understanding of when your header and detail lines are printing.

You may also want to remove the OFLIND(*In80) from the F spec of your printer file. Since you are manually controlling the line counting the automated overflow may be causing the header to print twice at the beggining.

If you are still having problems post the print file source here for us to look at.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    ElTerrifico is basically right about OFLIND(*In80). (And the logic nesting levels.) If you're going to be doing your own counting and setting *IN80 on and off, then you need to take care about doing it while the system is also counting lines and setting the indicator on. Either you should do it, or you should let the system do it. Personally, I'd say it's bad form to do the counting yourself. That's especially true if you use constants to set limits. It goes against the point of having externally-described files in the first place. You aren't counting lines on your display file. Why count them on your printer file? This is why printer files have an OVRFLW() attribute. Also, I'm a little confused about these lines:
    C     @POLNO        Chain     LMCHPR                             20      
    C                   If        %found
    ...and:
    C                       If        *In20 = *Off      
    C                         Eval      Cntnopol = Cntnopol + 1      
    C                       Endif
    If 20 is the NR indicator, then it will always be off at that point. You can't get there unless the earlier %FOUND was on. Two additional minor items:
    C                       If        Cntnopol = 31
    That should probably be:
    C                       If        Cntnopol > 30
    I don't see it making any difference in your existing logic, but it might make a difference as you develop the program more. And:
    C                       write     HEAD01      
    C                       write     SUBHEAD
    Since those always seem to be written together, why have them be separate record formats? Just make one record format that prints both of them with a single WRITE statement. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following