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

Get unmatched and matched recs with a specific condition


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

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Thu Oct 24, 2013 11:09 am
Reply with quote

Hi,

I have a requirement to get unmatched and mached recs with a specific condition using JCL (SYNCSORT). Sample data is given below. Could anyone please help me to get the solution in 1 step ?

File 1

Code:

123 20140101 ALBERT
456 20130101 MARTIN
789 20130701 LUTHER


File 2

Code:

111 20110101 20120101 TEST1
456 20140101 20141231 TEST2
789 20130101 20131231 TEST3


Requirement is:
1) Get the unmatached recs from F1 using the Key (column 1-3) of F1/F2
2) Get the matched recs from F1, however, the date(column 5-12) of F1 should not fall in the range of F2 dates(5-12 and 14-21).

Expected output:
Code:

123 20140101 ALBERT
456 20130101 MARTIN
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: Thu Oct 24, 2013 12:22 pm
Reply with quote

REFM and LRECL please. Can there be duplicates on either file?
Back to top
View user's profile Send private message
maki_psg

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Thu Oct 24, 2013 12:24 pm
Reply with quote

Hi Bill,

LRECL (F1 = 100; F2 = 1000).
Yes, there can be duplicates on either file.
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: Thu Oct 24, 2013 12:40 pm
Reply with quote

You need a JOINKEYS with UNPAIRED,F1

You need a REFORMAT statement, and for SyncSort you need a FILL (or to use the default fill of space) and choose a byte somewhere on F2 which can never contain that fill value.

FIELDS=(F1:1,100,F2:1,1000) on your REFORMAT.

I will assume you want two output files.

For the first, use OUTFIL with INCLUDE=(startoffilltest,1,CH,EQ,C'the single byte fill character')

That, along with the name for OUTFIL, will get you all your unmatched F1s.

A second OUTFIL for the matches.

Needs INCLUDE= with reverse of above condition (NE) and the test the date as being within the range on the F2. The date from F1 on the REFORMAT record is at the same position as the F1, and the date from F2 is offset by 100 bytes.

From the JOIN you will get multiple records for duplicates on the match.

If you only want a single record in this case, you need to decide what you want.
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(F1 & F2) and writ... JCL & VSAM 8
This topic is locked: you cannot edit posts or make replies. Construct new record using specific f... DFSORT/ICETOOL 6
No new posts Creating CSV file from Variable recs ... DFSORT/ICETOOL 11
No new posts Select a DB2 value in a specific deci... DB2 4
No new posts Need to find a specific STRING COBOL Programming 11
Search our Forums:

Back to Top