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

COMPARE FILE-1 & FILE-2 with a specific KEY and write O/


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

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Mon Dec 12, 2011 9:54 pm
Reply with quote

Hi All, Please help me to solve the below Issue.

I have File-1 (LRECL 300) and FILE-2(LRECL 350). MY O/P file is LRECL 300 same as File-1.

I need to compare the FILE-1 (KEY-1) with FILE-2 (KEY-2) and write the O/P file with all the NON-MATCHED records from FILE-1.

Code:
KEY-1 = (CLAIM# Pos 6,13,CH & MONEY AMOUNT Pos 28,10,CH & COVG Pos 40,4,CH)
KEY-2 = (CLAIM# Pos 3,13,CH & MONEY AMOUNT Pos 88,10,CH & COVG Pos 277,4,CH)


Code:
 IF KEY-1 NOT = KEY-2
          THEN WRITE RECORD TO THE O/P


Please help me to acheive this using DFSORT.

Let me know if im not clear with any details. Thank you all in advance.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Dec 12, 2011 10:02 pm
Reply with quote

As a team leader you should have people running around to solve your problems.
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Mon Dec 12, 2011 10:05 pm
Reply with quote

Never mind...nobody works for me. That was just my designation.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Dec 12, 2011 10:08 pm
Reply with quote

Which release level of DFSORT is installed at your site

Pick the output from a sort step and post the ICE201I message line on here
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Mon Dec 12, 2011 10:11 pm
Reply with quote

RELEASE : V1R5
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Dec 12, 2011 10:13 pm
Reply with quote

expat wrote:
Which release level of DFSORT is installed at your site

Pick the output from a sort step and post the ICE201I message line on here

Please supply the information requested, and not what you think you should supply
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Dec 12, 2011 10:15 pm
Reply with quote

Team member now? How many times are you going to change your profile?
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Mon Dec 12, 2011 10:34 pm
Reply with quote

I'm sorry I could not find the ICE201I.
But I found the below message
Code:
WER169I  RELEASE 1.3 BATCH 0485 TPF LEVEL 2.2

V=SYNCSORT P=SYNCSORT MESSAGES R=V3R7 I=WER169I
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Dec 12, 2011 10:34 pm
Reply with quote

subbu1522,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTJNF1 DD DSN=Your input FB LRECL 300 File1,DISP=SHR
//SORTJNF2 DD DSN=Your input FB LRECL 350 File2,DISP=SHR
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD    *                                   
  JOINKEYS F1=INA,FIELDS=(6,13,A,28,10,A,40,4,A)     
  JOINKEYS F2=INB,FIELDS=(3,13,A,88,10,A,277,4,A)     
  JOIN UNPAIRED,F1,ONLY                               
  SORT FIELDS=COPY         
//*


Peter ,

I am not sure your discussion would add anything to solve the problem or mend OP. why bother with trivial issues?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Dec 12, 2011 10:35 pm
Reply with quote

Topic moved to JCL forum because the product is SYNCSORT and not DFSORT
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Mon Dec 12, 2011 11:07 pm
Reply with quote

Dear Kolusu, Thank you somuch for the SORT logic. IT is working as expected. But I have encountered a new issue and I need to include the KEY-3

COuld you please HELP ME.

KEY-1 is from FILE-1
KEY-2 & KEY-3 are from FILE-2.

Code:

KEY-1 = (CLAIM# Pos 6,13,CH & MONEY AMOUNT Pos 28,10,CH & COVG Pos 40,4,CH)

KEY-2 = (CLAIM# Pos 3,13,CH & MONEY AMOUNT Pos 88,10,CH & COVG Pos 277,4,CH)

KEY-3 = (CLAIM# Pos 3,13,CH & MONEY AMOUNT Pos 78,10,CH & COVG Pos 277,4,CH)


Code:
IF KEY-1 NOT = KEY-2 AND KEY-3
          THEN WRITE RECORD TO THE O/P


Thank you so much!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Dec 12, 2011 11:11 pm
Reply with quote

Kolusu is a DFSORT developer, and your product is SYNCSORT, which is a competitior product with DFSORT.
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 Dec 12, 2011 11:11 pm
Reply with quote

As you have the unmatched only records on your current output, you could do a second step with the second key from file two, again taking the unmatched output.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Dec 12, 2011 11:19 pm
Reply with quote

subbu1522

Quote:
COuld you please HELP ME.



Yes, now is the time for you to use your brain, a figure this out.

Your SORTOUT file now contains the records from file 1 that did not match the first key of File 2.

What would you need to do with those records to ensure that they did not match the second key of file 2?

Hint: A second pass (sort step) is required.
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 Dec 12, 2011 11:54 pm
Reply with quote

Just to clear up, I think Dave got there first, my original post was almost identical to expat's of the same time, I then edited it, twice, the second time I think at the same time, or slightly after, Dave's solution. So Dave neither read nor failed to read mine before his.
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts how to eliminate null indicator value... DB2 7
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
Search our Forums:

Back to Top