View previous topic :: View next topic
|
Author |
Message |
abirami_2006
New User
Joined: 29 Dec 2005 Posts: 7
|
|
|
|
Hi all,
I have two files with the length of 100 and with 3 thousand records.
I have to copy the first 5 bytes of first file to the second file, but other values in the second file should not be disturbed.
Eg:
Input
FIle1 - AA111111
BB222222
File 2 - XX333333
YY555555
I want the output as below
File2 - AA111333
BB222555
Please advice.
Thank You.
Abirami. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
abirami_2006
ICETOOL solution for your question is as follows
Code: |
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AA111111
BB222222
/*
//IN2 DD *
XX333333
YY555555
/*
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CP01)
COPY FROM(IN2) TO(TMP1) USING(CP02)
SPLICE FROM(TMP1) TO(OUT) ON(20,8,PD) KEEPNODUPS -
WITHEACH WITH(6,3) USING(CP13)
/*
//CP01CNTL DD *
OUTREC FIELDS=(1:1,8,20:SEQNUM,8,PD)
/*
//CP02CNTL DD *
OUTREC FIELDS=(6:6,3,20:SEQNUM,8,PD)
/*
//CP13CNTL DD *
OUTFIL FNAMES=OUT,OUTREC=(1,8)
/*
|
The output OUT should contain
|
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
manihcl85 Warnings : 1 New User
Joined: 11 Jan 2007 Posts: 52 Location: chennai
|
|
|
|
Hi,
try this logic below.
1. add sequence number to both the i\p files
2. Join the records from both the files using SPLICE based on sequence number
3. Using OVERLAY function copy the First 2 char which will be at end of temporary o\p from above step
4. Using BUILD omit the fields u added in 2nd step also the sequence number
Regards,
Mani |
|
Back to top |
|
|
abirami_2006
New User
Joined: 29 Dec 2005 Posts: 7
|
|
|
|
Thanks a lot. I got the output.
Regards,
Abirami |
|
Back to top |
|
|
|