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
 

 

Syncsort: Splitting file based of date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort: Splitting file based of date
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: 578
Location: USA

PostPosted: Wed Feb 15, 2012 6:25 pm    Post subject:
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    Post subject: Reply to: Splitting file based of date
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Feb 15, 2012 6:55 pm    Post subject: Reply to: Splitting file based of date
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: 578
Location: USA

PostPosted: Wed Feb 15, 2012 8:56 pm    Post subject:
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    Post subject: Reply to: Splitting file based of date
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    Post subject:
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: 578
Location: USA

PostPosted: Wed Feb 15, 2012 9:31 pm    Post subject:
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    Post subject: Reply to: Syncsort: Splitting file based of date
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    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 syncsort: copy lines after the keyword shreya19 SYNCSORT 5 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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