View previous topic :: View next topic
|
Author |
Message |
BRKS
New User
Joined: 20 Apr 2007 Posts: 14 Location: pune
|
|
|
|
I want to overwrite the field in a record using the DFSORT or ICETOOL
The Input files are like this
INPUT FILES
File1
aaaaa bbbbb ccccc ddddd 06/08/20
aaaaa bbbbb ccccc ddddd 06/08/22
aaaaa bbbbb ccccc ddddd 06/08/30
aaaaa bbbbb ccccc ddddd 06/08/40
File2
wwwww xxxxx yyyyy zzzzz 07/08/28
wwwww xxxxx yyyyy zzzzz 07/08/27
wwwww xxxxx yyyyy zzzzz 07/08/26
wwwww xxxxx yyyyy zzzzz 07/08/25
OUTPUT FILE should Look like this
File3
aaaaa bbbbbb ccccc dddddd 07/08/28
aaaaa bbbbbb ccccc dddddd 07/08/27
aaaaa bbbbbb ccccc dddddd 07/08/26
aaaaa bbbbbb ccccc dddddd 07/08/25
Please provide the solution any one
Regards,
BRKS |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to post more complete example data or explain what you have posted.
What is the relationship between file1 and file2?
What if there is a different number of records in the files?
What are the recfm and lrecl of the records? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
BRKS
New User
Joined: 20 Apr 2007 Posts: 14 Location: pune
|
|
|
|
dick scherrer wrote: |
Hello,
You need to post more complete example data or explain what you have posted.
What is the relationship between file1 and file2?
What if there is a different number of records in the files?
What are the recfm and lrecl of the records? |
Hi Dick and Frank,
Thanks for responding to my query,
There is no relation between the File1 and File2 they two different input files which contains the date filed
The number of records or equal in the files
The Record format is fixed and
File1 LRECL=260 and
File2 LRECL=80 and the date field is at the position 252-260 in file1 and in File2 at 72-80
I want to overwrite the file1 date field with file2 date field the remaning data should be unchanged only the date field should be change.
Regards,
BRKS. |
|
Back to top |
|
|
BRKS
New User
Joined: 20 Apr 2007 Posts: 14 Location: pune
|
|
|
|
Hi Frank,
Thanks for responding to my query, and for the sorttrck.PDF ,
i have refered the example which Join fields from two files on a key but in this example file2 data is concatinating, but in my requirement i just want to overwrite the date field of file1 with date field of file2 with out appending the file2 data.
Regards,
BRKS. |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
Code: |
// EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//FILE1 DD ....
//FILE2 DD ....
//T1 DD DSN=&&T1,DISP=(MOD,PASS)
//OUT DD .....
//TOOLIN DD *
COPY FROM(FILE1) TO(T1) USING(CTL1)
COPY FROM(FILE2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(261,9,ZD) WITH(252,8) USING(CTL3)
//CTL1CNTL DD *
OPTION COPY
INREC OVERLAY=(261:SEQNUM,9,ZD)
/*
//CTL2CNTL DD *
OPTION COPY
INREC OVERLAY=(252:72,8,261:SEQNUM,9,ZD)
/*
//CTL3CNTL DD *
OUTREC FIELDS=(1,260)
/*
// |
|
|
Back to top |
|
|
BRKS
New User
Joined: 20 Apr 2007 Posts: 14 Location: pune
|
|
|
|
Thanks shankar it is working but there is small change in the CTL3
there is no ouput destination mentioned it is giving severe error
it is
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OUTREC=(1,260)
Regards,
BRKS |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
BRKS,
Quote: |
it is working but there is small change in the CTL3
there is no ouput destination mentioned it is giving severe error |
Code: |
SPLICE FROM(T1) TO(OUT) ON(261,9,ZD) WITH(252,8) USING(CTL3) |
The SPLICE itself contains the ddname of the output dataset in TO(OUT) and that's the syntax too.
I tried with the code which i posted. It's working fine. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
BRKS,
I said
Quote: |
Take a look at the "Join fields from two files record-by-record" Smart DFSORT Trick |
You said
Quote: |
i have refered the example which Join fields from two files on a key |
You are looking at the wrong trick. I pointed you to the trick for joining record-by-record. You apparently looked at the trick for joining on a key. These are two different tricks. Please look at the one I indicated.
BRKS and Shankar,
BRKS is right about Shankar's job being in error. An OUTREC statement is NOT allowed with SPLICE. You must use an OUTFIL statement. The newer version of DFSORT's ICETOOL will flag an OUTREC statement used with SPLICE as in error. Older versions may appear to work using OUTREC, but there's no guarantee OUTREC will always work, whereas OUTFIL will. |
|
Back to top |
|
|
|