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

Joinkeys to find matching and unmatching records


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: Mon Apr 01, 2013 4:58 pm
Reply with quote

Hi,

I would like to identify the matching and non-matching recs of an input file against the master file. I had written a sort card to get the results. However, I will have to include another logic to filter the matching recs based on a value.

For e.g. See below the sample content of the files

Master file -F1
Code:

PABBBBBBTM000AE1111110010100
PABBB66GBQ000AE1111110010100
PAMEAAAAAA000AE1111110010100
PAMEBBBBBB000AE1111110010100

INPUT - F2
Code:

BBBBBBTM AE1111110010100
BBB66GBQ AE1111110010100
MEAAAAAA AE1111110010100
MERRRRRR AE1111110010110

Sort Card
Code:

JOINKEYS FILE=F1,FIELDS=(3,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A)
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,55,F1:30,5)
  SORT FIELDS=(1,8,CH,A,34,10,CH,A,44,10,CH,A)
  OUTFIL FNAMES=SORTOF01,INCLUDE=(56,1,CH,NE,C' '),
                         BUILD=(1,55,56:56,5,PD,ZD,66:15X)
  OUTFIL FNAMES=SORTOF02,SAVE,BUILD=(1,59,21X)


Here, I got the below results.

Matching File
Code:

BBBBBBTM AE1111110010100
BBB66GBQ AE1111110010100
MEAAAAAA AE1111110010100

Non matching File

Code:

MERRRRRR AE1111110010110

However, I would like to write only the matching recs, which has the 1st two chars in matching key as 'ME' into matching file, else, I will have to write it into non-matching file.

Expected Matching File
Code:

MEAAAAAA AE1111110010100

Expected Non Matching File
Code:

BBBBBBTM AE1111110010100
BBB66GBQ AE1111110010100
MERRRRRR AE1111110010110


I will have to consider given 8 bytes as the key field.

I can use IFTHEN=, however, the non matched will not be written into non matching file, if I use this logic. Please provide some suggestions to get the desired matching/non matching file.

Thanks
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Apr 01, 2013 5:26 pm
Reply with quote

What is your DFSORT version?

You can run this job to see the ICE201I message:


Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*
 
Back to top
View user's profile Send private message
maki_psg

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Mon Apr 01, 2013 5:52 pm
Reply with quote

Pandora-Box wrote:
What is your DFSORT version?

You can run this job to see the ICE201I message:


Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*
 


Hi,

I am currently using SYNCSORT FOR Z/OS 1.4.1.0R.
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: Mon Apr 01, 2013 6:24 pm
Reply with quote

So the topic has been moved to the JCL part of the forum, where SyncSort topics live.
Code:

  OUTFIL FNAMES=SORTOF01,INCLUDE=(56,1,CH,NE,C' ',
                                 AND,1,2,CH,EQ,C'ME'),
                         BUILD=(1,55,56:56,5,PD,ZD,66:15X)


Looking quickly, don't you just need to do something like the above?
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 only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top