Page 1 of 1

DFSORT Reporting Issue :Detail Line Customization

Posted: Fri Oct 26, 2007 1:34 pm
by Collona
Currently, using DFSORT, I am printing a Report.
Input File length = 55

Code: Select all

                  Starting Length Type    Heading
                  Position
Org                   1     2     A
grp           3     3     A      
filler1               6     2     A
ENBR            8     8     A      
NAME                 16     22    A      
date          38     8     A
filler2              46     2     A
Centre          48     5     A      
filler3              53     3     A
**************************************************
The SORT code using DFSORT is as follows:

Code: Select all

*********** Top of Data ***************
 SORT FIELDS=(3,3,CH,A,48,5,CH,A)
 OUTFIL FILES=1,
   OUTREC=(12:3,3,10X,25:48,5,10X,40:8,8,7X,55:16,22,3X,80:38,8,
          132:X),
   SECTIONS=(3,3,SKIP=0L,
   HEADER3=(50:'DISCOUNT CARD AUDIT REPORT',24X,&DATE=(DMY/),13X,
     'PAGE ',&PAGE,
     /,10:'PAYROLL',26:'COST',40:'EMPLOYEE',
      81:'EXPIRY',/,11:'GROUP',25:'CENTRE',41:'NUMBER',64:'NAME',
     82:'DATE'))
********** Bottom of Data *************
I want it to be printed using DFSORT
Can it be done?

Posted: Sat Oct 27, 2007 1:40 am
by Frank Yaeger
You can do that by changing your DFSORT control statements to the following:

Code: Select all

  SORT FIELDS=(3,3,CH,A,48,5,CH,A)                                   
  OUTFIL FILES=1,                                                    
   IFOUTLEN=132,                                                     
   IFTHEN=(WHEN=INIT,                                                
     BUILD=(12:3,3,25:48,5,40:8,8,55:16,22,80:38,8,                  
        133:SEQNUM,8,ZD,RESTART=(3,3))),                             
   IFTHEN=(WHEN=(133,8,ZD,GT,+1),OVERLAY=(12:3X)),                   
   SECTIONS=(3,3,SKIP=0L,                                            
   HEADER3=(50:'DISCOUNT CARD AUDIT REPORT',24X,&DATE=(DMY/),13X,    
     'PAGE ',&PAGE,                                                  
     /,10:'PAYROLL',26:'COST',40:'EMPLOYEE',                         
      81:'EXPIRY',/,11:'GROUP',25:'CENTRE',41:'NUMBER',64:'NAME',    
     82:'DATE'))                                                     

Posted: Mon Oct 29, 2007 2:33 pm
by Collona
Thanks Frank,

This is working fine.
Actually,I had tried using SEQNUM but did not know of how to use RESTART.
Thanks again.

I had another query on the same Report.
The Page Numbers are changing only when 60 line are over and not whenever the Header is being printed.
My requirement is to incrment the page number whenever Header is printed.
Header should be printed whenever Payroll Group changes or Number of lines in Report exceed 60.

I tried using Trailer2 withsame code as Header outside the section and Header3 inside section but its not working.
Can you crack this as well?

Posted: Mon Oct 29, 2007 8:08 pm
by Frank Yaeger
Please show me an example of your input records and what you want for output, including the page numbers you want.

Posted: Mon Oct 29, 2007 9:05 pm
by Collona
My requirement is to incrment the page number whenever Header is printed.
Header should be printed whenever:
1. Payroll Group changes or
2.Number of entries inside a particular Payroll Group exceeds 20.

Note that in Payroll Grp 'PAY', the header was printed again when Number of entries exceeded 20 in the grp 'PAY'.
Also note that for each new payroll grp, the page number is incremented in the Header.

Also the Page is being printed in the left side in the above Code. It is actually in the right side but is being printed in the left here as margin of this Site-page is not big enough.

Posted: Mon Oct 29, 2007 9:36 pm
by Frank Yaeger
You can use HEADER2 and SECTIONS with SKIP=P to get that. These DFSORT control statements should give you what you want:

Code: Select all

  SORT FIELDS=(3,3,CH,A,48,5,CH,A)
  OUTFIL FILES=1,
   IFOUTLEN=132,
   IFTHEN=(WHEN=INIT,
     BUILD=(12:3,3,25:48,5,40:8,8,55:16,22,80:38,8,
        133:SEQNUM,8,ZD,RESTART=(3,3))),
   IFTHEN=(WHEN=(133,8,ZD,GT,+1),OVERLAY=(12:3X)),
   HEADER2=(50:'DISCOUNT CARD AUDIT REPORT',24X,&DATE=(DMY/),13X,
     'PAGE ',&PAGE,
     /,10:'PAYROLL',26:'COST',40:'EMPLOYEE',
      81:'EXPIRY',/,11:'GROUP',25:'CENTRE',41:'NUMBER',64:'NAME',
     82:'DATE'),
   SECTIONS=(3,3,SKIP=P)

Posted: Tue Oct 30, 2007 1:33 pm
by Collona
Thanks Frank,

This is working fine. :lol:

I guess I could have used DFSORT Reporting Features in a lot of Projects which I coded using COBOL... :? ..

But, going forward...DFSORT is my best bet for Reports..