Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Introducing pagebreak and a header - SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Introducing pagebreak and a header - SYNCSORT
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

Site Director


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

PostPosted: Wed Jul 08, 2009 4:51 am    Post subject:
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: 2284
Location: @my desk

PostPosted: Wed Jul 08, 2009 7:45 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us