Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort a Report file which has Headers and Trailers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Thu Aug 21, 2008 4:10 am    Post subject: Sort a Report file which has Headers and Trailers
Reply with quote

Hi,

I would like to know whether sorting a report file which has headers (more than 1 line) in every page and trailer(more than 1 line) in the last page of the report.

My Input file looks like the below:
Code:

----+----1----+----2----+----3----+----4
****************************************
1REPORT           DATE: 08/20/2008 11:34
0                             PAGE: 0001
  FLD  FL   FLD.   FIELD     
  NO.1 NO.2 No.3   N0.4       
  ---- ---- ---- ----------
  355  000  IDW  0000001210       
  355  000  IDW  0000001231       
  355  000  IDW  0000001231       
  355  000  IDW  0000001231       
  355  000  IDW  0000001232       
  355  000  IDW  0000001164       
  355  000  IDW  0000001164       
  356  000  IDW  0000001164       
  356  000  IDW  0000001164       
  356  000  IDW  0000001143       
  356  000  IDW  0000001162       
  356  000  IDW  0000001155       

 NUMBER OF LINES IN THE REPORT = 0012


If you note the Input contains the header in its first 5 lines on every page and the trailer is present in the last page ad is of 2 lines (1 blank line and a text line). Also the page count for a page is 66 records.

My requirement is to Sort this file with the Field no.1 and then by Field no. 4 and obviously this sort should happen without affecting the header and trailer. The output for this should be:

Code:

----+----1----+----2----+----3----+----4
****************************************
1REPORT           DATE: 08/20/2008 11:34
0                             PAGE: 0001
  FLD  FL   FLD.   FIELD     
  NO.1 NO.2 No.3   N0.4       
  ---- ---- ---- ----------
  355  000  IDW  0000001164       
  355  000  IDW  0000001164       
  355  000  IDW  0000001210       
  355  000  IDW  0000001231       
  355  000  IDW  0000001231       
  355  000  IDW  0000001231       
  355  000  IDW  0000001232       
  356  000  IDW  0000001143       
  356  000  IDW  0000001155       
  356  000  IDW  0000001162       
  356  000  IDW  0000001164       
  356  000  IDW  0000001164       

 NUMBER OF LINES IN THE REPORT = 0012


Please help!!
Thanks in Advance
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Aug 21, 2008 4:34 am    Post subject:
Reply with quote

Hello,

What should happen when there are 100 lines of data and multiple sets of headers for each of the 3 pages needed and some of the data from page 3 needs to be presented on the re-sorted page 1??
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Aug 21, 2008 4:38 am    Post subject:
Reply with quote

It's not clear what the input report looks like. You show one page, but imply that it's more than one page and that the header lines appear on every page and the trailer lines appear on the last page only. Are you trying to sort the data on all of the pages and keep the header and the same number of data lines on each page as was originally there, or are you trying to sort the data on each page independently, or what?

Please show a better example of input and expected output with multiple pages with records on the last page that sort before records on the first page. That will illustrate what you actually want to do.

Also, give the RECFM and LRECL of the input file.

It appears there's something in each header and trailer record that can identify it, e.g. 'REPORT' starting in position 2, 'PAGE:' in position 31, etc. Is that true?
Back to top
View user's profile Send private message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Thu Aug 21, 2008 5:06 am    Post subject:
Reply with quote

Ok.. I am sorry for not making this clear. If there are multiple pages of data, then all the data in all the pages should be sorted and based on the sort the output will be like:

Page 1:
--------
1. Header (5 lines)
2. The first 66 lines after the sorting is done on all the data on all the pages.

Page 2:
----------
1. Header (5 lines)
2. The next 66 lines after the sorting is done on all the data on all the pages.


.
.
.
.
.
.
.
.
.

Last Page:
----------
1. Header (5 lines)
2. The next 66 lines after the sorting is done on all the data on all the pages.
3. Trailer (2 lines).

And Frank, as you said it contains the word REPORT in Column 2 and Page in col 31. The LRECL is 40 and RECFM is Fixed Block.

Let me know if this helps.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Aug 21, 2008 6:10 am    Post subject:
Reply with quote

I believe this DFSORT job will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/40)
//SYMHD DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYMTRL DD DSN=&&S2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//DATA DD DSN=&&D1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=DATA,
   OMIT=(2,5,CH,EQ,C'REPORT',OR,
     31,5,CH,EQ,C'PAGE:',OR,
     3,3,CH,EQ,C'FLD',OR,
     3,4,CH,EQ,C'NO.1',OR,
     3,4,CH,EQ,C'----',OR,
     1,10,CH,EQ,C' ',OR,
     2,9,CH,EQ,C'NUMBER OF')
  OUTFIL FNAMES=SYMHD,ENDREC=5,
   IFOUTLEN=80,
   IFTHEN=(WHEN=(2,5,CH,EQ,C'REPORT'),
        BUILD=(C'HLN1,''',1,40,C'''')),
   IFTHEN=(WHEN=(31,5,CH,EQ,C'PAGE:'),
        BUILD=(C'HLN2,''',1,36,C'''')),
   IFTHEN=(WHEN=(3,3,CH,EQ,C'FLD'),
        BUILD=(C'HLN3,''',1,40,C'''')),
   IFTHEN=(WHEN=(3,4,CH,EQ,C'NO.1'),
        BUILD=(C'HLN4,''',1,40,C'''')),
   IFTHEN=(WHEN=(3,4,CH,EQ,C'----'),
        BUILD=(C'HLN5,''',1,40,C''''))
  OUTFIL FNAMES=SYMTRL,
    INCLUDE=(1,10,CH,EQ,C' ',OR,
     2,9,CH,EQ,C'NUMBER OF'),
   IFOUTLEN=80,
   IFTHEN=(WHEN=(1,10,CH,EQ,C' '),
        BUILD=(C'TLN1,''',1,40,C'''')),
   IFTHEN=(WHEN=(2,9,CH,EQ,C'NUMBER OF'),
        BUILD=(C'TLN2,''',1,40,C''''))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//         DD DSN=&&S2,DISP=(OLD,PASS)
//SORTIN DD DSN=&&D1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=(3,4,ZD,A,18,10,ZD,A)
  OUTFIL LINES=71,REMOVECC,
    HEADER2=(HLN1,/,HLN2,PAGE=(EDIT=(TTTT)),/,HLN3,/,
      HLN4,/,HLN5),
    TRAILER1=(TLN1,/,TLN2)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us