View previous topic :: View next topic
|
Author |
Message |
pushpagiri
New User
Joined: 07 Jul 2005 Posts: 51
|
|
|
|
I want a output like :
Code: |
1111 XAAX AAAA
2222 XBBX BBBB
4444 XDDX DDDD |
From the inputs in1 and in2 given below .
But i am getting output as in 'out'..
I have used the jcl given below..
please find the error in it.
------in1------------
Code: |
1111 AAAA
2222 BBBB
3333 CCCC
4444 DDDD
|
------in2------------
Code: |
2222 XBBX
1111 XAAX
4444 XDDX
5555 XEEX
|
------ out ------------
Code: |
1111 XAAX
2222 XBBX
4444 XDDX |
---------JCL------------
Code: |
//TMP1 DD DSN=U117584.TRAIN.OUT1,DISP=MOD
//OUT DD DSN=U117584.TRAIN.OUT3,DISP=SHR
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CPY1)
COPY FROM(IN2) TO(TMP1) USING(CPY2)
SPLICE FROM(TMP1) TO(OUT) ON(1,4,CH) WITH(6,9)
/*
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,4,11:6,9)
/*
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,4,6:6,9)
/*
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Change the SPLICE statement to:
SPLICE FROM(TMP1) TO(OUT) ON(1,4,CH) WITH(6,4)
and you will get the results you require. You don't want to overlay the blanks from positions 11-14 over the values that are already in those positions. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Superk is right. Actually, I'd suggest changing the job to the following to make it clear where the data comes from and where the spaces come from. I'd also use a temporary file for the TMP1 MOD data set instead of a permanent file so you don't have to empty out TMP1 each time you run the job.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//TMP1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CPY1)
COPY FROM(IN2) TO(TMP1) USING(CPY2)
SPLICE FROM(TMP1) TO(OUT) ON(1,4,CH) WITH(6,4)
/*
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,4,11:6,4,19:X)
/*
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,4,6:6,4,19:X)
/*
|
|
|
Back to top |
|
|
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
Hi,
I am replying to an old thread becoz my requirement is similar to this,
IN01
1111 AAAA
2222 BBBB
3333 CCCC
4444 EEEE
4444 DDDD
IN02
2222 XBBX
1111 XAAX
4444 XDDX
5555 XEEX
4444 XDEX
Ouput required,
1111 XAAX AAAA
2222 XBBX BBBB
4444 XDDX DDDD
4444 XDEX EEEE
When I tried running using same TOOLIN parameters, I get only one record corresponding to 4444.
Kindly let me know if we can populated multiple entries corresponding to the Key field in the output file.
Thanks, |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Elixir,
It would have been easier to diagnose the problem if you posted the entire TOOLMSG and DFSMSG output. Also I noticed that there is a many to many match in your data. Looks like both files have duplicates and in that case you can't use SPLICE. You need to use JOINKEYS. However you need to do a better job of explaining the rules (especially when there are duplicates involved). The key 4444 has 2 keys and in IN01 file and some how you managed to matched the second 4444 DDDD record with the first 4444 XDDX record and followed the same pattern for the other 2 records. What happens if there are more than 2 records per key? |
|
Back to top |
|
|
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
SKolusu,
IN01
1111 AAAA
2222 BBBB
3333 CCCC
4444 EEEE
4444 DDDD
IN02
2222 XBBX
1111 XAAX
4444 XDDX
5555 XEEX
4444 XDEX
Requied output:
1111 XAAX AAAA
2222 XBBX BBBB
4444 XDDX DDDD
4444 XDEX EEEE
Kindly let me know how to achieve this. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
F1
Code: |
1111 AAAA
2222 BBBB
3333 CCCC
4444 EEEE
4444 DDDD
|
F2
Code: |
2222 XBBX
1111 XAAX
4444 XDDX
5555 XEEX
4444 XDEX |
Your expected output:
Code: |
1111 XAAX AAAA
2222 XBBX BBBB
4444 XDDX DDDD
4444 XDEX EEEE |
First state your rule clearly
I don't understand what is the criteria that you don't want record
4444 XDDX EEEE but want 4444 XDEX EEEE
Also
4444 XDEX DDDD but want 4444 XDDX DDDD
Is it because in both third character is same???
Sorry.. but today am thinking in all nonsense directions ...
4444 XDEX EEEE
4444 XDDX DDDD |
|
Back to top |
|
|
|