Posted: Fri Jul 20, 2007 10:51 am Post subject: Sort problem - SELECT FROM(INPUT) TO(DIFFILE) ON(?,?,CH)
I have two files F-A(150) and F-B(200) and I know the 150 records in F-A is there in F-B, my aim is to get the other 50 new records in F-B which are not there in F-A.
F-A and F-B are VB sequential files of lrecl 2004.
I don't know what to specify in ON parameter. I think there is a limitation on the lrecl on this. Can anyone help me with this.
I appreciate your time.
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Fri Jul 20, 2007 11:15 am Post subject:
Kolusu,
The CH can have a max length of 1500. Any advantage to using several smaller lengths as apposed to say 2 for 1002 each? _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jul 20, 2007 11:24 am Post subject:
As Dick points out, DFSORT's SELECT operator allows you to use a maximum of 1500 bytes for CH and BI ON fields so the ON fields for positions 1-2004 could be:
ON(1,1500,BI) ON(1501,504,BI)
If you're comparing bytes without regard to format, BI is probably a better choice than CH from a doc standpoint. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Fri Jul 20, 2007 11:25 am; edited 1 time in total
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Jul 20, 2007 11:30 am Post subject:
Quote:
I don't have to compare the entire 2004, all i need is the 50 new records in the F-B file.
vak,
how do you identify which records are new?
apart from that go back and read the 1st post once again and your last post. You started with something and in the end you come back with another approach
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jul 20, 2007 11:31 am Post subject:
Quote:
I don't have to compare the entire 2004, all i need is the 50 new records in the F-B file.
You have to identify which bytes in the records are to be used to compare them. That's what the ON fields are for in this case. There could be a big difference between comparing positions 11-20 and comparing positions 21-30. You have to decide which bytes you want to compare in each pair of records and use the ON fields to tell DFSORT that. Remember that for a VB file, the first four bytes contains the RDW with the length in the first two bytes. You may or may not want to compare on that.
Your STEP01 step won't work for several reasons. SUM FIELDS=NONE will give you the first record with each value - it won't give you the records that don't compare. And even if you could use SUM FIELDS=NONE, you would need a SORT statement to indicate which bytes to compare on. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Sorry for the confusion. I know 150 records in FA is going to match the 150 of 200 records in FB. So all I need is the other 50 records.I don't have a common field to compare so i have to compare the entire length-2004.i will try with the first option and will update you.
I was just curious to know whether this could be done using SORT.
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Fri Jul 20, 2007 12:39 pm Post subject:
Kiran,
other than this being SYNCSORT and not DFSORT (thus Frank will not respond), you have forgotten to add 4 to the ON offsets (for the rdw), since it is a variable length record, and the error msgs told you the problem:
Quote:
WER168I CONTROL FIELD WITHIN RDW
apparently you can not reference the RDW. I don't know. _________________ Dick Brenholtz
American living in Varel, Germany
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum