View previous topic :: View next topic
Author
Message
nirmal.poikaikumaran New User Joined: 29 Nov 2005Posts: 66 Location: Bangalore
Hi Team,
Request
---------
Two Input files of 80 character is available.Fil1,File2.
File2 may be updated with new records. or it may be modified for an existing record.Modified means only the date is changed in second file.Date starts at 25 th position and runs for 8 character.
The first 10 character is key. Both the files are sorted in ascending.
Expected Result
------------------
File 3 must be generate with all the newly inserted or changed records from File2.
File Strucutre example
-------------------------
File1 (sample 70 character i have given)
0010100002 20080410 0080430050000C 00 000000
0010100004 20080410 0080428050000C 00 000000
0010100009 20080502 0080501050000C 00 000000
File2 (sample 70 character i have given)
00101000020000000000000020080417 20080417235900C 00200804
00101000040000000000000020080417 20080417235900C 00200804
00101000090000000000000020080502 20080417235900C 00200804
00101000120000000000000020080417 20080417235900C 00200804
Expected result file3
00101000020000000000000020080417 20080417235900C 00200804
(for date changed)
00101000040000000000000020080417 20080417235900C 00200804
(for date changed)
00101000120000000000000020080417 20080417235900C 00200804
(as new record)
Third row of file2 is skipped,because it did not have any change.
Can anyone give me a ICETOOL code to generate the same.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
The following DFSORT/ICETOOL JCl will give you desired results
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
0010100002 200804100080430050000C 00 000000
0010100004 200804100080428050000C 00 000000
0010100009 200805020080501050000C 00 000000
//IN2 DD *
0010100002000000000000002008041720080417235900C 00200804
0010100004000000000000002008041720080417235900C 00200804
0010100009000000000000002008050220080417235900C 00200804
0010100012000000000000002008041720080417235900C 00200804
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,10,CH) WITHALL -
KEEPNODUPS USING(CTL3) WITH(01,80)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(81:1,10,25,8)
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(81:18X)
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(01,80),
INCLUDE=(25,8,CH,NE,91,8,CH)
/*
Hope this helps...
Cheers
Back to top
nirmal.poikaikumaran New User Joined: 29 Nov 2005Posts: 66 Location: Bangalore
Absolutely Brilliant.....
thanks a lot
it worked
Back to top
nirmal.poikaikumaran New User Joined: 29 Nov 2005Posts: 66 Location: Bangalore
Hi Skolusu,
I have an enhanced requirement on this.
//IN1 DD *
0010100002 200804100080430050000C 00 000000
0010100004 200804100080428050000C 00 000000
0010100009 200805020080501050000C 00 000000
//IN2 DD *
0010100002000000000000002008041720080417235900C 00200804
0010100004000000000000002008041720080417235900C 00200804
0010100009000000000000002008050220080417235900C 00200804
0010100012000000000000002008041720080417235900C 00200804
0010100012000000000000002008051720080417235900C 00200804
If i find a duplicate in the second file , both of them should be captured inthe o/p file. how can that be done?
plz help
Back to top
vyasricha New User Joined: 17 Mar 2008Posts: 27 Location: banaglore
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
0010100002 200804100080430050000C 00 000000
0010100004 200804100080428050000C 00 000000
0010100009 200805020080501050000C 00 000000
//IN2 DD *
0010100002000000000000002008041720080417235900C 00200804
0010100004000000000000002008041720080417235900C 00200804
0010100009000000000000002008050220080417235900C 00200804
0010100012000000000000002008041720080417235900C 00200804
0010100012000000000000002008051720080417235900C 00200804
//OUT DD *
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE),
// UNIT=SYSDA
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,10,CH) WITHALL -
KEEPNODUPS KEEPBASE USING(CTL3) WITH(01,80) WITH(99,1)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(81:1,10,25,8,99:C'AA')
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(81:18X,99:C'BB')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(01,80),
INCLUDE=(25,8,CH,NE,91,8,CH,AND,99,2,CH,NE,C'AA')
If the duplicates exist for the key which is present in the file1, the same jcl works. But if duplicates exist for the new records added in the file2 then use this jcl.
Hope this might help you...
Back to top
Please enable JavaScript!