|
|
| Author |
Message |
deb_parthas
New User
Joined: 24 Nov 2005 Posts: 8
|
|
|
|
Hi Friends,
I have 2 files A & B as below..
A
| Code: |
1234567 310
5345545 001
3456567 010
|
B
I need to get an out file like.
C
The logic should be to read the second column (e.g. 310) from A, search for 310 in B, take the contents of B and write in C. Could you please let me know if this can be done using only JCL utilities?
Thanks in advance,
Partha |
|
| Back to top |
|
 |
References
|
|
 |
sathish_rathinam
Active User
Joined: 22 Aug 2005 Posts: 57 Location: india
|
|
|
|
hi partha,
ur requirement CAN BE DONE USING ICETOOL splice operator...
try it..
regards,
sathish |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4621 Location: San Jose, CA
|
|
|
|
Partha,
Do you need the output records in the same order as the FileA records
(310, 010) or can the output records be in sorted order (010, 310)?
What is the RECFM and LRECL of FileA and FileB? |
|
| Back to top |
|
 |
deb_parthas
New User
Joined: 24 Nov 2005 Posts: 8
|
|
|
|
Thanks Sathish..
Frank, the output records can be in the same order as in file A. RECFM=FB and LREC=80 for both the files.. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4621 Location: San Jose, CA
|
|
|
|
I'll take "the output records can be in the same order as in file A" to mean they must be in the same order as in file A (we could use a simpler job if the output records could be in key order).
With that assumption, 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 *
1234567 310
5345545 001
3456567 010
//IN2 DD *
310 ZZZZ
010 ABCD
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN2->T1: Reformat records to:
* |key|data..|blanks|
COPY FROM(IN2) TO(T1) USING(CTL1)
* IN1->T1: Reformat records to:
* |key|blanks|seqnum|
COPY FROM(IN1) TO(T1) USING(CTL2)
* Use SPLICE to get only matching records as:
* |key|data..|seqnum|
SPLICE FROM(T1) TO(T2) ON(1,3,CH) WITH(81,8)
* Sort on seqnum to get spliced records back in their original
* IN1 order. Remove seqnum.
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,80,8X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(10,3,81:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
SORT FIELDS=(81,8,ZD,A)
OUTREC FIELDS=(1,80)
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html |
|
| Back to top |
|
 |
|
|
|