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

Syncsort: Splitting file based of date


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

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Wed Feb 15, 2012 5:22 pm
Reply with quote

Hi,
I have two files.
File1- FB,LREC=10, have only one record which have date mentioned in it.
File2- FB,Lrec=80, contains many records. Each record have date starting from 11th position and have same format as of date in first file.

Now I wanted to split file2 into sortout1 and sortout2 based on date in first file. If a date of record from file2 is greater than date in first file then that record should go in SORTOut1 file and if date of record (of file2) is equal of less than date of file 1 then records should go in sortout2 file.

How can we do this?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Feb 15, 2012 6:25 pm
Reply with quote

Shriram Jogdand,
What is the format of the date in both the files?

Thanks,
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Wed Feb 15, 2012 6:46 pm
Reply with quote

Its YYYYMMDD
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 15, 2012 6:55 pm
Reply with quote

You can have a look at this. Generates a DFSORT Symbol for the SYMNAMES file in the following step. Then use OUTFIL INCLUDE/OMIT for your two output files using the Symbol generated.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Feb 15, 2012 8:56 pm
Reply with quote

Shriram Jogdand,
See if below works...

Code:
//STEP0001 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD INPUT FB/10                                         
//SORTOUT  DD DSN=&&DT,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS) 
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL BUILD=(C'DT,',1,10,80:X)                                 
/*                                                               
//STEP0002 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SYMNAMES DD DSN=&&DT,DISP=(OLD,PASS)                           
//SORTIN   DD INPUT FB/80                                         
//OUT01    DD OUTPUT1 FB/80                                       
//OUT02    DD OUTPUT2 FB/80                                       
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL FNAMES=OUT01,INCLUDE=(11,8,ZD,GT,DT)                     
  OUTFIL FNAMES=OUT02,SAVE                     
/*                                                               

Thanks,
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Wed Feb 15, 2012 9:00 pm
Reply with quote

Hi,
I tried below code just to create one file using SYMNAMES but it is giving SYMNAMES error

//STEP10 EXEC PGM=SORT
//SORTIN DD DSN=ABC.XYZ,
// DISP=SHR
//SORTOUT DD DSN=&&SYS1,DISP=(,PASS)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,4,C'-',5,2,C'-',7,2)
SORT FIELDS=COPY
OUTREC BUILD=(C'CIPE,',1,10,80:X)
//*
//STEP20 EXEC PGM=SORT
//SYMNAMES DD DSN=&&SYS1,DISP=(OLD,PASS)
//SORTIN DD DSN=ABC.INPUT.FILE,
// DISP=SHR
//SORTOUT DD DSN=ABC.OUTPUT.FILE,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(51,10,CH,EQ,CIPE)

The error coming is
SYNCSORT FOR Z/OS 1.3.2.1R U.S. PATENTS: 4210961, 5117495 (
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 5F782, MODEL 2817 609
*** ERRORS IN SYMNAMES STATEMENTS ***
CIPE,2012-01-31
*
*** SYNTAX ERROR ***
WER470A SYMNAMES ERRORS FOUND WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 15, 2012 9:02 pm
Reply with quote

oohhhh golly!

seems as if SYNCSORT is not the same as DFSORT.

oh well, yet again another thread which is a waste of time
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Feb 15, 2012 9:31 pm
Reply with quote

Shriram Jogdand,
You didn't mention that you wanted to compare date(s) in YYYY-MM-DD format. Change your OUTREC for STEP10 as below and see if it works.

UNTESTED
Code:
OUTFIL BUILD=(C'CIPE,C''',01,10,C'''',80:X)


Thanks,
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Feb 16, 2012 2:46 pm
Reply with quote

Thanks. It worked perfectly.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top