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

Read two files


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
TGarcia

New User


Joined: 24 Jul 2021
Posts: 3
Location: United States

PostPosted: Thu Jul 29, 2021 8:48 pm
Reply with quote

How can I read two DSN compared one variable:

Code:
FILE1:

ALBERT  DAILY 
MARK WEEKLY
PETER MONTHLY

Code:
FILE2:
ALBERT 651-222-4561
ALBERT 651-333-4562
PETER   651-444-1235

Code:

DESIRED OUTPUT:
ALBERT DAILY       651-222-4561
ALBERT DAILY       651-333-4562
PETER   MONTHLY  651-444-1235

Coded
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Thu Jul 29, 2021 8:53 pm
Reply with quote

Why REXX? Easier and faster with DFSORT/SYNCSORT.
Please use code tags.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Jul 30, 2021 1:11 am
Reply with quote

Quote:
How can I read two DSN compared one variable:

Please, clarify this using the commonly used terminology.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Fri Jul 30, 2021 6:20 am
Reply with quote

Judging from the example, he wants to use the name column to join two tables.

The data is not in DB2 tables, so the join needs to be done through a program.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jul 30, 2021 3:25 pm
Reply with quote

You use the fact that a stem suffix is just a string. I assume that dataset 1 is the master, which will contain all names found in dataset 2.
Then this will do it:
Code:
/* populate lists */                         
 list1.1='ALBERT DAILY   '                   
 list1.2='MARK WEEKLY     '                 
 list1.3='PETER MONTHLY   '                 
 list1.0=3                                   
 list2.1='ALBERT 651-222-4561 '             
 list2.2='ALBERT 651-333-4562 '             
 list2.3='PETER  651-444-1235'               
 list2.0=3                                   
 /* split list1, make master */             
 mstr.='?'                                   
 do n=1 to list1.0                           
   parse var list1.n name text               
   mstr.name=text                           
 end                                         
 /* make result list (replace list2) */     
 do n=1 to list2.0                           
   parse var list2.n name text               
   list2.n=name mstr.name subword(list2.n,2)
 end                                         
 /* show */                                 
 do n=1 to list2.0                           
   say list2.n                               
 end                                         
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
Search our Forums:

Back to Top