View previous topic :: View next topic
|
Author |
Message |
Sridhar R
New User
Joined: 11 Dec 2010 Posts: 20 Location: India
|
|
|
|
I have requirement of compare two files for eg:
File1 :
xxx yyy zzzz 5
xxx yyy zzzz 2
xxx yyy zzzz 3
File2 :
xxx yyy zzzz 2
xxx yyy zzzz 6
I want the output in the below order
xxx yyy zzzz 5
xxx yyy zzzz 2
xxx yyy zzzz 3
xxx yyy zzzz 6
This means, just i want to append the record which it is not present in file1 when it compare with file2 (whole record)
If i use SORT---> joinkeys or ICETOOL, I m getting the output but it is in asending or decending order. I dont want to do that. I just want to append the new record
Please advise. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
before the JOINKEYS, append a sequence number to file2 during a copy operation.
the output of JOINKEYS should be UNPAIED,F2,ONLY
sort the output of the JOINKEYS on the appended sequence number,
dropping the appended sequence number creating file3
concatenate file1,file3 creating file4. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You want matches, you want all records that are on file 2 and unmatched and all records on file 1 and unmatched?
In other words, "adding" records from file 1 only, to file 2?
Add the sequence numbers suggested, do the join, sort on the sequence numbers, remove them. |
|
Back to top |
|
|
Sridhar R
New User
Joined: 11 Dec 2010 Posts: 20 Location: India
|
|
|
|
Thats right I had an idea about this but could you please tell how we can add sequence numbers.
I mean to say that how we can increment the values? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Quote: |
Thats right I had an idea about this but could you please tell how we can add sequence numbers. |
SEQNUM
Also Please update your Mainframe skills
Quote: |
Mainframe Skills: 6 Months |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Sridhar R
New User
Joined: 11 Dec 2010 Posts: 20 Location: India
|
|
|
|
Thank you very much its working...!!! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Sridhar R,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
XXX YYY ZZZZ 5
XXX YYY ZZZZ 2
XXX YYY ZZZZ 3
//INB DD *
XXX YYY ZZZZ 2
XXX YYY ZZZZ 6
XXX YYY ZZZZ 1
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(1,15,A)
JOINKEYS F2=INB,FIELDS=(1,15,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,89,?,F2:1,89)
INREC IFOUTLEN=89,IFTHEN=(WHEN=(90,1,CH,EQ,C'2'),BUILD=(91,89))
SORT FIELDS=(81,9,CH,A),EQUALS
OUTREC BUILD=(1,80)
//*
//JNF1CNTL DD *
INREC OVERLAY=(81:C'1',SEQNUM,8,ZD)
//*
//JNF2CNTL DD *
INREC OVERLAY=(81:C'2',SEQNUM,8,ZD)
//* |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
hey! look at that.
i was almost close to kolusu's solution. |
|
Back to top |
|
|
Sridhar R
New User
Joined: 11 Dec 2010 Posts: 20 Location: India
|
|
|
|
Thanks to all its working... |
|
Back to top |
|
|
|