View previous topic :: View next topic
|
Author |
Message |
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
hi all
my requirement is to compare 2 files and get the unmatched/unpaired records from both the files into a single output file
i have file 1 with below data
file 2 with data
i need to get in output file as
i have tried with the below joinkeys sort card and jcl as
Code: |
SORTJNF1 DD DISP=SHR,DSN=MY.RECORDS.FILE1
SORTJNF2 DD DISP=SHR,DSN=MY.RECORDS.FILE2
SORTOUT DD DSN=MY.UNMTCH.RECORDS,
DISP=(,CATLG,DELETE),
SPACE=(CYL,(1,1),RLSE),
DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)
SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(1,3,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:1,80,F2:1,80)
/* |
i am getting output as
(spaces in second line instead of 600)
Could anyone please help me out in this
thanks in advance
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please use the Code tags to preserve formatting.
Bear in mind that your "600" will being in column 81. Is that the problem? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Are you using Syncsort? |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
No Bill 600 is not coming in the output file |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Raj,
Remove 'REFORMAT FIELDS=' and try.....
Thanks
-3nadh |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi Nic ,
i am using
STEP01 EXEC PGM=SORT |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi 3nadh
i tried deleting reformat field i job abended with below message
JOINKEYS REFORMAT RECORD LENGTH= 84, TYPE = V
SORTOUT RECFM INCOMPATIBLE
SORTOUT : RECFM=FB ; LRECL= ; BLKSIZE= |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What are the RECFMs of your inputs?
Run this, please. If you see anything needing to be in hex, display it in hex. Either way, paste it here.
Code: |
JOINKEYS FILE=F1,FIELDS=(1,3,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:1,7,F2:1,7) |
|
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi Bill
RECFM of input files are FB with LRECL of 80
i have tried with
Code: |
REFORMAT FIELDS=(F1:1,7,F2:1,7) |
i am getting the following output
Code: |
----+----1----+----2--
**********************
300 ........
600 ........
|
600 is populated at column 8
Code'd, again |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
STEP01 EXEC PGM=SORT |
it tells absolutely nothing about the product You are using
to provide the proper answer we NEED TO KNOW THE BRAND of Your Sort product
SYNCSORT issues WER... messages
DFSORT issues ICE... messages
while providing the same overall functionality each of them has its own quirks
so ... what is the sort product You are using ??? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you had no 600 in your output before, then I'd guess you have a "pre-defined" or "defined in the JCL" output file, which is not taking account of the size of your REFORMAT record.
Since you got a failure with -3nadh's suggestion, you may even have other problems with your files.
Check that your inputs are both FB.
Check that your output is not pre-defined nor defined (LRECL/RECFM) in the JCL to let Sort set those values, or ensure instead that they are 80 and FB.
If you leave the REFORMAT off, I expect you'd then get the output you expect, even though you may have to review it for "usefulness". |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
if the requirement is simply to keep non matching records
an ICETOOL keep nodups migth give a better performance
search the forums and You will find quite a few examples of it |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I think you have been around long enough to know that PGM=SORT is not specifying the actual sort product but an alias. Look at the messages. They will tell you which sort product you are using. There are differences between Syncsort and DFSort - and DFSort questions are posted to the DFSort part of the forum whilst, for some reason, Syncsort questions are in the JCL section. |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
Try this
Code: |
JOINKEYS FILE=F1,FIELDS=(1,3,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:1,7,F2:1,7),FILL=X'00'
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(8,7,CH,EQ,X'00'),BUILD=(1,7)),
IFTHEN=(WHEN=(1,7,CH,EQ,X'00'),BUILD=(8,7)) |
It will be great help to forum members if you post all required info
Regards,
Chandan |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Chandan,
Checking 8,1 & 1,1 in Outrec should suffice |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
rajkumarmf1985,
Looking back, you show your sample data in sorted order. If it is actually like this, specify SORTED on the JOINKEYS for each file that is in order. |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Yes Pandora, Agree with you.. I missed it in the flow of posting resolution.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
You could have gotten your answer from the very first post of Bill, if you could read that carefully enough.
You've coded
Code: |
DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) |
in your JCL, so you won't see "600" in output, which is at position 81.
Again the second hint from Bill, could have told you why "600" did not appear in output with your first Job in this thread but, you said,"600 is populated at column 8".
If you've inputs strictly as what you've posted, try this:
Code: |
//JS001 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//*
//SORTJNF1 DD *
100
200
300
400
//SORTJNF2 DD *
100
200
400
600
//*
//SORTOUT DD SYSOUT=*
//*
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(1,3,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:1,3,F2:1,3)
OUTREC OVERLAY=(1,80,SQZ=(SHIFT=LEFT))
/*
//* |
You'll get, what are you looking for. You could use BUILD as well, though I leave that as an exercise. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
rajkumarmf1985 wrote: |
Hi 3nadh
i tried deleting reformat field i job abended with below message
JOINKEYS REFORMAT RECORD LENGTH= 84, TYPE = V
SORTOUT RECFM INCOMPATIBLE
SORTOUT : RECFM=FB ; LRECL= ; BLKSIZE= |
From the manual,
Quote: |
if a REFORMAT control statement is not provided and ONLY the unpaired records from both join inputs are requested, the resultant records will be variable-length, regardless of the record formats of the join input data sets, and the record length will be the maximum of any fixed-length input file record length plus four (for an RDW) and any variable-length input file record length. |
So if you get rid of DCB on SORTOUT and submit your Job again, you won't get that error.
errr..rr but the "600" will be at 81st posistion and it won't appear the way you want. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Without the REFORMAT and for UNPAIRED,ONLY, both F1 and F2 records will appear in the same position.
After all that, TS will have no clue as to which record comes from where, so I'm reluctant to expend much effort on this :-) |
|
Back to top |
|
|
|