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

SYNCSORT counting number of variables of records.


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

New User


Joined: 30 Sep 2008
Posts: 9
Location: Chennai

PostPosted: Wed Oct 01, 2008 7:44 pm
Reply with quote

My input file contains records like:

abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl

Every record consists of date.
My output file looks like: it consists of header and trailer.

Header00140 12520080915abc
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
Trailer017825

The date in header in output file is run date of job. But, we want to change the date should be the date that is contained in maximum number of records in the input. Such as we need to count the occurences of date from input file,and want to change the date in header to that date. Like in example: above input file consists 20080927 four times- so my requirement is to change output file header date i.e. 20080915 to 20080927.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 01, 2008 7:55 pm
Reply with quote

Amit Chadha,

Are you trying to do this by taking the Output file given above as input? Or the input file? Also can you post some more details like input RECFM,LRECL etc
Back to top
View user's profile Send private message
amitchadha30

New User


Joined: 30 Sep 2008
Posts: 9
Location: Chennai

PostPosted: Wed Oct 01, 2008 8:16 pm
Reply with quote

I am reading the input file and adding header & trailer with maximum occuring dates in input should come on header date. I am able to put run date on header but want to replace run date to maximum occuring date in input file.
Input file- RECFM=FBA,LRECL=133
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Oct 02, 2008 8:53 pm
Reply with quote

Amit,

Here's a SYNCTOOL job which works for your requirement. I have assumed the output file has the same attributes as that of input (FBA, LRECL=133).
Code:
//STEP1    EXEC PGM=SYNCTOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//T1       DD DSN=&&T1,DISP=(,PASS),DCB=RECFM=FB                 
//C1       DD DSN=&&C1,DISP=(,PASS)                               
//IN       DD DSN= Input file                                     
//OUT      DD DSN= Output file                                   
//TOOLIN   DD *                                                   
 SORT FROM(IN) TO(T1)  USING(CTL1)                               
 SORT FROM(T1) TO(C1)  USING(CTL2)                               
 COPY FROM(IN) TO(OUT) USING(CTL3)                               
//CTL1CNTL DD *                                                   
 SORT FIELDS=(17,8,CH,A)                                         
 OUTREC BUILD=(17,8,9:SEQNUM,8,ZD,RESTART=(17,8))                 
//CTL2CNTL DD *                                                   
 SORT FIELDS=(9,8,CH,D)                                           
 OUTFIL REMOVECC,ENDREC=1,                                       
 BUILD=(C' OUTFIL HEADER1=(''Header XXXXXXX '',C''',1,8,C'''),',/,
        C' TRAILER1=(''Trailer YYYY ''),BUILD=(2,132)')           
//CTL3CNTL DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)     

OUT
Code:
Header XXXXXXX 20080927           
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080926abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080925abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
abcdefghijklmno20080927abcdefghijkl
Trailer YYYY
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 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
Search our Forums:

Back to Top