Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Searching and Writing using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
Author Message
deb_parthas

New User


Joined: 24 Nov 2005
Posts: 8

PostPosted: Thu Nov 24, 2005 4:01 pm    Post subject: Searching and Writing using JCL
Reply with quote

Hi Friends,
I have 2 files A & B as below..

A
Code:

1234567  310
5345545  001
3456567  010


B
Code:

010  ABCD
310  ZZZZ


I need to get an out file like.

C
Code:

310  ZZZZ
010  ABCD


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
View user's profile Send private message
References
sathish_rathinam

Active User


Joined: 22 Aug 2005
Posts: 57
Location: india

PostPosted: Thu Nov 24, 2005 4:45 pm    Post subject: Re: Searching and Writing using JCL
Reply with quote

hi partha,

ur requirement CAN BE DONE USING ICETOOL splice operator...

try it..


regards,
sathish
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 4621
Location: San Jose, CA

PostPosted: Thu Nov 24, 2005 10:12 pm    Post subject:
Reply with quote

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
View user's profile Send private message
deb_parthas

New User


Joined: 24 Nov 2005
Posts: 8

PostPosted: Fri Nov 25, 2005 8:42 am    Post subject: Re: Searching and Writing using JCL
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 4621
Location: San Jose, CA

PostPosted: Fri Nov 25, 2005 8:29 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1