View previous topic :: View next topic
|
Author |
Message |
debanandaghosh Currently Banned New User
Joined: 19 Aug 2008 Posts: 7 Location: bhubanaswer
|
|
|
|
I have two files with a key in bytes 1-3 and data in bytes 5-9.
File A has the following records
000 $$$$$
001 AAAAA
002 CCCCC
003 EEEEE
004 GGGGG
File B has the following records:
001 BBBBB
001 XXXXX
003 DDDDD
003 YYYYYY
004 FFFFF
005 HHHHH
I need the following output
001 AAAAA BBBBB
001 AAAAA XXXXX
003 EEEEE DDDDD
003 EEEEE YYYYYY
004 GGGGG FFFFF
how to do that |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
There was an example earlier today which had been moved to the JCL forum because it turned out that the product being used was SYNCSORT rather than DFSORT.
The code given is DFSORT code, but luckily worked for SYNCSORT too.
Click here to take a look at an example of the SPLICE part of ICETOOL. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Debanand,
Welcome to teh forums. Check this JCL.
Code: |
//STEPS200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
000 $$$$$
001 AAAAA
002 CCCCC
003 EEEEE
004 GGGGG
/*
//IN2 DD *
001 BBBBB
001 XXXXX
003 DDDDD
003 YYYYYY
004 FFFFF
005 HHHHH
/*
//T1 DD DSN=&&TESC1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),
// UNIT=SYSDA
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,3,CH) WITH(11,5) WITHALL
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1:1,3,5:5,5,11:5X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1:1,3,11:5,5)
/*
//OUT DD SYSOUT=* |
output:
Code: |
********************************* TOP OF DATA **********************************
001 AAAAA BBBBB
001 AAAAA XXXXX
003 EEEEE DDDDD
003 EEEEE YYYYY
004 GGGGG FFFFF
******************************** BOTTOM OF DATA ******************************** |
|
|
Back to top |
|
|
debanandaghosh Currently Banned New User
Joined: 19 Aug 2008 Posts: 7 Location: bhubanaswer
|
|
|
|
Thanks dude.It is working fine .
Now let me to explain my problem
I have one flat file having 920 LRECL .In this file 8th byte to 16byte will be used as key which can be occur repeatedly
Like as follows
Code: |
PPPPPPP111111111RWEIRUEWROPIWERPI.....................
RRRRRRR111111111E2WEQWEQWEQWE76........................
SSSSSSS222222222RERQWEREQWRER656.......................
FFFFFFF333333333RERWEREWEWRERWEER.......................
GGGGGGG333333333RTGHHRETERWEREW.......................
|
And i have another file having following format(1-9 th byte the key and in the 11 th byte one flag)
Code: |
111111111 Y
222222222 N
333333333 Y
|
Now i need to merge the files so that i get the following output(New flag of 2nd file will be in 922th field) .
Code: |
PPPPPPP111111111RWEIRUEWROPIWERPI.....................Y
RRRRRRR111111111E2WEQWEQWEQWE76.......................Y
SSSSSSS222222222RERQWEREQWRER656......................N
FFFFFFF333333333RERWEREWEWRERWEER.....................Y
GGGGGGG333333333RTGHHRETERWEREW.......................Y
|
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Debanand,
Quote: |
Thanks dude.It is working fine .
|
You are welcome. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Debanand,
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed you wanted the output records to be 922 bytes long.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file (FB/910)
//IN2 DD DSN=... input file (FB/11)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/922)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(8,9,CH) WITHALL WITH(1,921)
/*
//CTL1CNTL DD *
INREC BUILD=(8:1,9,922:11,1)
/*
//CTL2CNTL DD *
INREC OVERLAY=(922:X)
/*
|
|
|
Back to top |
|
|
debanandaghosh Currently Banned New User
Joined: 19 Aug 2008 Posts: 7 Location: bhubanaswer
|
|
|
|
Thanks for simpler approach |
|
Back to top |
|
|
|