Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Get unmatched and matched recs with a specific condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Get unmatched and matched recs with a specific condition
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Oct 24, 2013 12:22 pm    Post subject: Reply to: Get unmatched and matched recs with a specific con
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Oct 24, 2013 12:40 pm    Post subject: Reply to: Get unmatched and matched recs with a specific con
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    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 BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Route a product's job to specific lpar vasanthz All Other Mainframe Topics 9 Thu Mar 02, 2017 2:22 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us