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

Syncsort - Need to write Unmatched records into another file


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

New User


Joined: 15 May 2007
Posts: 2
Location: chennai

PostPosted: Fri Jun 06, 2008 2:23 pm
Reply with quote

Hi folks,
I have an input file say FILE1. I need to write matching records in one file (FILE2) and unmatched into another file(FILE3).
I want to use only SYNCSORT.

FILE1:

A1234B1111C1111
A2345B2343C4563
A5678B3234C2346
V2342G2342T2343
Y1343H2343U4554


FILE2 (Based on the INCLUDE condition that I have) will contain :
(include 1,1,EQ,CH'A',AND,6,1,,EQ,CH'B',AND,11,1,EQ,CH'C')
A1234B1111C1111
A2345B2343C4563
A5678B3234C2346

FILE3 SHUD CONTAIN
V2342G2342T2343
Y1343H2343U4554

Please help me out in this
Thanks in advance
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: Fri Jun 06, 2008 8:33 pm
Reply with quote

Hello KrishnaChaitanya and welcome to the forums,

You should be able to do what you want using Syncsort JOIN and/or JOINKEYS.

There are several examples in the manual. There are also some topics in the JCL section of the forum (Syncsort topics are part of JCL - DFSORT is in the DFSORT section of the forum).
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Jun 06, 2008 9:13 pm
Reply with quote

JOIN is used when you want matched/unmatched records from 2 separate input files. If I understand the OP, there is only 1 input file. Please correct me if I am wrong.

Based on the sample input records and the required output, it looks like this can be done with 2 simple outfils:
Code:

//STEP1  EXEC  PGM=SORT
//SORTIN DD *                                                       
A1234B1111C1111                                                     
A2345B2343C4563                                                     
A5678B3234C2346                                                     
V2342G2342T2343                                                     
Y1343H2343U4554                                                     
//SORTOF01 DD DSN=MATCHED
//SORTOF02 DD DSN=UNMATCHD                                       
//SYSOUT DD SYSOUT=*                                               
//SYSIN DD *                                                       
    SORT FIELDS=COPY                                               
    OUTFIL FILES=01,                                               
     INCLUDE=(1,1,CH,EQ,C'A',AND,6,1,CH,EQ,C'B',AND,11,1,CH,EQ,C'C')
    OUTFIL FILES=02,SAVE
/*

Please let me know if this does not give you the output you need.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Jun 06, 2008 9:18 pm
Reply with quote

If you are running SyncSort for z/OS 1.3, you can simplify the INCLUDE statement as follows:
Code:
INCLUDE=(1,1,CH,EQ,L(C'A',C'B',C'C'))
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: Sat Jun 07, 2008 2:52 am
Reply with quote

Hi Alissa,

Good catch - i believe i mis-read what was needed icon_redface.gif

Have a great weekend icon_smile.gif

d
Back to top
View user's profile Send private message
KrishnaChaitanya

New User


Joined: 15 May 2007
Posts: 2
Location: chennai

PostPosted: Sun Jun 08, 2008 12:03 pm
Reply with quote

Thanks Alissa... Actually I found many posts with two input files and matchd and unmatchd output files, but not with one input and multiple output files.

Thanks again Alissa.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Jun 11, 2008 5:13 pm
Reply with quote

Alissa,

Quote:
If you are running SyncSort for z/OS 1.3, you can simplify the INCLUDE statement as follows:
Code:

INCLUDE=(1,1,CH,EQ,L(C'A',C'B',C'C'))


I have a doubt here. In the above requirement, 'A', 'B' & 'C' are checked in 3 different positions and not in the same position - 1,1,CH.

How can we use the above simplified statement in this case?

Thanks,
Arun
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Jun 11, 2008 8:59 pm
Reply with quote

arcvns wrote:
Quote:
If you are running SyncSort for z/OS 1.3, you can simplify the INCLUDE statement as follows:
Code:

INCLUDE=(1,1,CH,EQ,L(C'A',C'B',C'C'))


I have a doubt here. In the above requirement, 'A', 'B' & 'C' are checked in 3 different positions and not in the same position - 1,1,CH.

How can we use the above simplified statement in this case?

I missed that. You are correct - I did a quick glance and assumed they were all 1,1. Please disregard my simplified INCLUDE statement.
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 How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top