|
View previous topic :: View next topic
|
| Author |
Message |
amitkumar_sindhi
New User
Joined: 20 May 2005 Posts: 8
|
|
|
|
Hi,
I have two files let say A & B . A contains two filelds say F1 & F2, and
B has certain fields say F3,F4,F5,F6. I want a output dataset which will contain all the values of Field F1,F2 that were present in dataset A, alongwith the corresponding fields F4,F5,F6(if value of F1 = F3)but not F3. e.g.
Dataset A has
| Code: |
F1 F2
--------------
bus 100
can 40
disp 700
|
Dataset B has
| Code: |
F3 F4 F5 F6
--------------------------
bus 100l 32P 0.8
can 40l 13G 0.6
jam 900l 23H 0.2
|
output dataset should have
| Code: |
F1 F2 F4 F5 F6
-------------------------------
bus 100 100l 32p 0.8
can 40 40l 13G 0.6
disp 700
|
Can this be done using any of sort option.
Regards,
Amit |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
bus 100
can 40
disp 700
/*
//IN2 DD *
bus 100l 32P 0.8
can 40l 13G 0.6
jam 900l 23H 0.2
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(8,3) WITH(81,1) -
KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,4,15:8,16,81:C'22')
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1,80,81:C'11')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'22'),
OUTREC=(1,80)
/*
|
|
|
| Back to top |
|
 |
amitkumar_sindhi
New User
Joined: 20 May 2005 Posts: 8
|
|
|
|
Thanks a lot, the above jcl will work fine if there is no dups in
dataset B. But in my case dataset B can have dups values in it like
bus 100l 32l 0.8
bus 200l 31l 0.9
can 40l 13g 0.6
jam 900l 23h 0.2
jam 100l 13h 0.1
and i want all the duplicate occurrences to be in the output datasets
which are there in dataset A(if value of F1 = F3).The output should be.
F1 F2 F4 F5 F6
-------------------------------
bus 100 100l 32p 0.8
bus 100 200l 31p 0.9
can 40 40l 13g 0.6
disp 700
Regards,
Amit |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
Thanks a lot, the above jcl will work fine if there is no dups in
dataset B. But in my case dataset B can have dups values in it like |
Sigh. I gave you the JCL that works for the example you showed me. Then you tell me the JCL doesn't work because you have duplicate records. Why didn't you show that in the example in the first place? I can't read your mind. Please give me all of the details in the future, so I don't have to waste time.
Here's a DFSORT/ICETOOL job that will work with your new example:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
bus 100
can 40
disp 700
/*
//IN2 DD *
bus 100l 32l 0.8
bus 200l 31l 0.9
can 40l 13g 0.6
jam 900l 23h 0.2
jam 100l 13h 0.1
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) KEEPNODUPS -
WITHALL WITH(15,17) WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,80,81:C'11')
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1,4,15:8,16,81:C'22')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'22'),
OUTREC=(1,80)
/*
|
|
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
and nary a whisper of thanks.
However, I and countless others thank you Frank for time spent answering questions with incomplete information.
Dave |
|
| Back to top |
|
 |
amitkumar_sindhi
New User
Joined: 20 May 2005 Posts: 8
|
|
|
|
Hi Frank,
First of all i am very sorry for all the mistakes i have made from start till end whether its respect to incomplete requirement provided intially or delay i have made in giving the much deserved thanks to you.
Thanks a lot Frank for all your help and time. The JCL provided by you not only helped me saved my time but i was able to know much more about functionality of ICETOOL.
Thanks & Regards,
Amit |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Thanks for the kind words, Dave.
Amit,
I'm glad I could help. Just try to give more complete information the first time for future questions. |
|
| Back to top |
|
 |
pushpagiri
New User
.jpg)
Joined: 07 Jul 2005 Posts: 51
|
|
|
|
hi,
what does C'11' and C'22' signifies in the OUTREC of solution?
Please help me to know on this.
Regards,
Push. |
|
| Back to top |
|
 |
amitkumar_sindhi
New User
Joined: 20 May 2005 Posts: 8
|
|
|
|
It will append 11 & 22 at the postion 81 of output record. Used to differntiate from which file the input has come.
Regards,
Amit |
|
| Back to top |
|
 |
pushpagiri
New User
.jpg)
Joined: 07 Jul 2005 Posts: 51
|
|
|
|
| amitkumar_sindhi wrote: |
thankz amit for your quick reply.
regards,
push |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|