IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Introducing pagebreak and a header - SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Wed Jul 08, 2009 1:32 am
Reply with quote

Hello,

I have a file with data as follows:

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000000001     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000000002     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04 
00000000000000000000004     ABC       0721 NND  04/15/09          01/05/07 
00000000000000000000005     ABC       0721 NND  04/12/07          04/05/06
00000000000000000000006     ABC       0721 NND  04/03/08          00/00/00
00000000000000000000012     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000001188     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04   
00000000000000000000018     ABC       0703 NNF  04/15/08          00/00/00 
00000000000000000001388     ABC       0704 NNE  04/12/08          01/01/06 
00000000000000000000113     ABC       0701 NNC  04/01/07          02/09/02   

After sorting the file on the first 4 numeric digits of the value under the heading ENTITY and arriving the following file,




Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000000001     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000000002     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04 
00000000000000000000012     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000001188     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04   
00000000000000000000113     ABC       0701 NNC  04/01/07          02/09/02
00000000000000000000018     ABC       0703 NNF  04/15/08          00/00/00 
00000000000000000001388     ABC       0704 NNE  04/12/08          01/01/06 
00000000000000000000004     ABC       0721 NND  04/15/09          01/05/07 
00000000000000000000005     ABC       0721 NND  04/12/07          04/05/06
00000000000000000000006     ABC       0721 NND  04/03/08          00/00/00


Every time the value of the first four digits under the heading ENTITY changes ( 0701 to 0703, or 0703 to 0704..etc ) i want to introduce a page break ( an empty record )
and print the following header :




Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE



So that my final output file should look like:


Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000000001     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000000002     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04 
00000000000000000000012     ABC       0701 NNC  04/15/08          00/00/00 
00000000000000000001188     ABC       0701 NNC  04/12/08          00/00/00 
00000000000000000000003     ABC       0701 NNC  04/01/08          02/03/04   
00000000000000000000113     ABC       0701 NNC  04/01/07          02/09/02

ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000000018     ABC       0703 NNF  04/15/08          00/00/00 

ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000001388     ABC       0704 NNE  04/12/08          01/01/06 

ACCOUNT                     PRODUCT   ENTITY    CURR MAINT DATE   PREV MAINT DATE
00000000000000000000004     ABC       0721 NND  04/15/09          01/05/07 
00000000000000000000005     ABC       0721 NND  04/12/07          04/05/06
00000000000000000000006     ABC       0721 NND  04/03/08          00/00/00


I know that it can be achieved thru easy trieve, but i am a fan of syncsort icon_smile.gif. Please advise
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jul 08, 2009 4:51 am
Reply with quote

Hello,

Look up SortWriter in your Syncsort documentation.

Here is a list of reporting capabiities (possibly not complete because the info is not from the current release):
Quote:
The SortWriter capability of OUTFIL can produce completely formatted reports. The report
writing features, which can be specified differently for each output file, can accomplish
these tasks:
• Arrange the report into pages.
• Divide the report into sections.
• Format headers and trailers for sections, pages, and the complete report.
• Create multiple lines of output from each input record.
• Convert and edit numeric data.
• Provide TOTAL and SUBTOTAL capabilities for data fields in a specific part of a
report.
• Provide MIN, MAX, AVERAGE, SUBMIN, SUBMAX, and SUBAVG capabilities for
data fields in a specific part of a report.
• Provide COUNT and SUBCOUNT capabilities for records in a specific part of a report.

From the 1.2 Programmer's Guide
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jul 08, 2009 7:45 pm
Reply with quote

Hello,

Here's a SyncSort job which would work for your requirement. Note that you'll have one additional blank line at the end of the report.
I assumed files of FB/LRECL=81 as shown in your example.
Code:
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN= Input  file --> FB/81                 
//SORTOUT  DD DSN= Output file --> FB/81                 
//SYSIN    DD *                                           
  OMIT COND=(1,7,CH,EQ,C'ACCOUNT')                       
  SORT FIELDS=(39,4,CH,A)                                 
  OUTFIL REMOVECC,SECTIONS=(39,4,                         
         HEADER3=('ACCOUNT',                             
                  29:'PRODUCT',                           
                  39:'ENTITY',                           
                  49:'CURR MAINT DATE   PREV MAINT DATE'),
         TRAILER3=(X))     
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
Search our Forums:

Back to Top