View previous topic :: View next topic
|
Author |
Message |
skodidine
New User
Joined: 05 Apr 2006 Posts: 6
|
|
|
|
Hello, I have two input files. the first is a master and the second is an alternate. The alternate file can have any number of duplicate records. I need to sort them by the first 10 bytes then merge them.
IN1 = FB, 372bytes
IN2 = FB, 360bytes
key in both files 1:10 bytes
In the master file (IN1), there is data in bytes 360:12 which should be copied to all duplicate records in IN2.
For example.
IN1
0000000001....IND <--- in bytes 360:12
0000000002....-0-
0000000003....IND
IN2
0000000001
0000000001
0000000001
0000000002
DESIRED OUTPUT
0000000001....IND
0000000001....IND
0000000001....IND
0000000001....IND
0000000002....-0-
0000000002....-0-
0000000003....IND
My question is this: How can I sort/merge the two files so that the desired output is obtained? I tried icetool/splice but was unsuccessful.
Any suggestions??
Thanks! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I tried icetool/splice but was unsuccessful. |
I don't know what you tried so I can't tell you what you did wrong.
However, here's a DFSORT/ICETOOL job using SPLICE that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN2 DD DSN=... input file2 (FB/360)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=... input file1 (FB/372)
// DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD DSN=... output file (FB/372)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(1,10,CH) WITHALL WITH(1,360) -
KEEPNODUPS KEEPBASE
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,360,372:X)
/*
|
|
|
Back to top |
|
|
skodidine
New User
Joined: 05 Apr 2006 Posts: 6
|
|
|
|
Thanks Frank. It worked great. Comparing your icetool/splice with what I had, i see the folly of my ways. I was using the 372byte file first and trying to splice that with the 360byte. I see why you have the 360 first.
Once again, thank you!
Sanjay |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
That's a common mistake. Glad I could help. |
|
Back to top |
|
|
|