Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
View previous topic :: :: View next topic  
Author Message
deb_parthas

New User


Joined: 24 Nov 2005
Posts: 18

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

sathish_rathinam

New User


Joined: 22 Aug 2005
Posts: 59
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: 7130
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: 18

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: 7130
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am
This topic is locked: you cannot edit posts or make replies. MEMOAPIX - Searching for a Reference ... Steve Coalbran All Other Mainframe Topics 13 Wed Feb 03, 2016 12:01 pm
No new posts Need help on searching '82 in SRCHFOR rohanthengal TSO/ISPF 6 Thu Aug 27, 2015 4:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us