Joined: 26 Nov 2002 Posts: 12404 Topics: 75 Location: San Jose
Posted: Thu Mar 25, 2004 6:18 am Post subject:
Phantom,
I can't think of way to get only the differences(non match data) in the output record. If you have eztrieve at your shop then check the following topic which discusses similar requirement.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Thu Mar 25, 2004 8:21 am Post subject:
Thanks kolusu,
I just wanted to know whether this could be accomplished via sort. We already have a cobol program to do this, but felt sort would be simpler than that as far as the no. of lines of code is concerned.
Joined: 26 Nov 2002 Posts: 12404 Topics: 75 Location: San Jose
Posted: Thu Mar 25, 2004 1:08 pm Post subject:
Phantom,
OK I guess my mind did not start working when I posted that I can't think of a solution. . I attribute it lack of sleep watching cricket matches(Day/night matches start at 4 Am in the morning and day matches start at 11:30 PM in the night here). But the matches are worth watching. Enjoyed every match.
Any way the following DFSORT/ICETOOL JCL will give you desired results. I assumed both your files are 80 bytes in length and is of FB recfm. If you have syncsort at your shop then change the pgm name to synctool.
A brief explanation of the job. As you said your file has 2 fields, we take file1 and split each record into 10 records based on your second field(as your second fields occurs 10 times)
The second copy operator does the same for the second file.
Now concatenate these 2 files together and using select operator eliminate all the dups.so you will be left with only keys when the records does not match.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Fri Mar 26, 2004 7:17 am Post subject:
Kolusu,
This is just awesome...Thanks a lot
I have one more question...
Code:
File: 1
AAAAA 111222333
BBBBB 444
CCCCC 111
File: 2
AAAAA 111333
BBBBB 555
CCCCC 222
Output:
AAAAA 222
BBBBB 444
CCCCC 111
When there is a mismatch between file A and file B (same comparison), is there any way by which I could stop the records from B from being written in the output...Please see the example above.
When there is a mismatch, the first way would write the following records also in the output. (these are available only FILE 2 and not in FILE 1).
Code:
BBBBB 555
CCCCC 111
CCCCC 222
Can this be stopped. The output should contain only records from File 1 and that does not match with the contents of File 2 (Please use the same comparison logic used above).
Joined: 26 Nov 2002 Posts: 12404 Topics: 75 Location: San Jose
Posted: Fri Mar 26, 2004 8:29 am Post subject:
Phantom,
Sure you can write only records from file1 in case of mismatch. The following DFSORT/ICETOOL JCl will give you the desired results.
A brief explanation of the job. We add unique identfier to the file while splitting. For file 1 we add a constant of '0001' and for file2 we add a constant of '0002' at the end of each record.
Now we concatenate the 2 temp files and sort on the keys while summing on the constants at the end. By doing so any duplicates will have count greater or equal to 3, so using include condition on the outfil we select only records where the constant remains '0001'.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Mar 31, 2004 2:45 am Post subject:
I am getting an error if I use FIRSTDUP option in SYNCSORT. I would like to know whether SYNCSORT (SYNCTOOL) supports this option. If not, is there any other way to achieve the functionality of FIRSTDUP
Code:
SYT000I SYNCTOOL RELEASE 1.3A - COPYRIGHT 1999 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED
SELECT FROM(IN) TO(OUT) ON(1,9,CH) FIRSTDUP
SYT050E INVALID OPERAND ON "SELECT" STATEMENT
SYT030I OPERATION COMPLETED WITH RETURN CODE 12
SYT015I PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE
SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12
Joined: 26 Nov 2002 Posts: 12404 Topics: 75 Location: San Jose
Posted: Wed Mar 31, 2004 9:06 am Post subject:
Phantom,
The version of synctool you have does not support the option FIRSTDUP. And the job you showed is just eliminating the duplicates, but will not fetch you the firstdup.
The following JCL will give you the desired results.
Joined: 26 Nov 2002 Posts: 12404 Topics: 75 Location: San Jose
Posted: Wed Mar 31, 2004 9:10 am Post subject:
vkphani,
Whenever you say a particular feature is not working then you need to post the error messages(toolmsg & dfsmsg) from the sysout. If you happen to have toolmsg in the following manner then your shop has syncsort and you have a older version of synctool which does not support many features that icetool supports
Code:
SYT000I SYNCTOOL RELEASE 1.3A - COPYRIGHT 1999 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED
SELECT FROM(IN) TO(OUT) ON(1,9,CH) FIRSTDUP
SYT050E INVALID OPERAND ON "SELECT" STATEMENT
SYT030I OPERATION COMPLETED WITH RETURN CODE 12
SYT015I PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE
SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12
Check this topic for an alternate solution(last post by me) for getting the firstdup in here
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Mar 31, 2004 10:14 am Post subject:
Kolusu,
Thanks for your help. I was thinking that whenever we use SUM FIELDS=(xx,yy,ff), the first occurance of the record with a total of the field that is SUMMED up. Is this correct ?
If so, then the statement INCLUDE=(14,4,ZD,EQ,1) will give me the records in which the summed up field contains a value greater than 1 meaning there was a duplicate in the input file and the records have been summed up. This way I have eliminated all the unique records and I produce only one occurence (which I think is the first occurance) of a duplicate record.
Please correct if I am wrong...Thanks a lot for your help
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Mar 31, 2004 10:43 am Post subject:
Thanks a lot kolusu,
Actually I first thought of the same solution. But I got a little confused when I read the following message regarding INREC control statement, which states that INREC will be processed after INCLUDE/OMIT control processing.
Code:
--------------- V=SYNCSORT P=SYNCSORT FOR Z/OS R=V1R1 I=INREC ----------------
****************** Text Below Copyright (c) 2004, SYNCSORT *******************
INREC Control Statement
The INREC control statement reformats the input records. Use the INREC
control statement to add, delete, or reformat fields before the records
are sorted or merged. Use the OUTREC control statement or the OUTREC
parameter of the OUTFIL control statement to delete or reformat fields after
the records are sorted or merged. Note that INREC is performed after E15
exit processing and INCLUDE/OMIT control statement processing.
All times are GMT - 5 Hours Goto page Previous1, 2, 3Next
Page 2 of 3
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