IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 7312
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: 7312
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

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Converting Hex to PD Special Condition SYNCSORT 3
No new posts Print next line strings when a condit... DFSORT/ICETOOL 9
No new posts using TXT2PDF to colour specific lines All Other Mainframe Topics 3
No new posts Compare Two datasets and Override Mat... DFSORT/ICETOOL 7
No new posts Compare Two datasets and get the 1st ... DFSORT/ICETOOL 7

Back to Top