IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Searching and Writing using JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Thu Nov 24, 2005 10:12 pm
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
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 Developer


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

PostPosted: Fri Nov 25, 2005 8:29 pm
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:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Searching for a member but don't know... TSO/ISPF 6
No new posts AI writing DFSORT, REXX codes.. All Other Mainframe Topics 3
No new posts Writing the output file name from a p... JCL & VSAM 7
No new posts writing into VSAM indexed tabl in PL1... PL/I & Assembler 8
Search our Forums:

Back to Top