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

How to replace string in dataset1 from dataset2


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
milanboros

New User


Joined: 14 Feb 2022
Posts: 2
Location: Hungary

PostPosted: Tue Feb 15, 2022 5:22 am
Reply with quote

Hello Guys!

For some reason I can't get my head around this problem. It looks easy to me to achieve with SORT but I can't make it work.
I have an email template where I have placeholder strings for the email address and the name:

EMAIL.TEMPLATE (FB / 80)
Code:
HELO SMTP                                                   
MAIL FROM: <email.address.of@sender>                       
RCPT TO:<RECIPIENT-EMAIL>                                     
DATA                                                           
From:     email.address.of@sender
To:       RECIPIENT-EMAIL                                   
Subject:  Your weekly summary                                 
MIME-VERSION: 1.0;                                             
Content-Type: text/html;                                       
                                                               
<html>                                                         
<body> 
Dear RECIPIENT-NAME
</body>
</html>


EMAIL.RECIPIENTS (FB / 130):
This data set has fixed layout
Code:
----+----1----+----2----+----3----+----4----+----5----+
JOHN.DOE@COMPANY             JOHN DOE
BILL@COMPANY                 BILL
TAYLOR@COMPANY               TAYLOR

What I try to achieve is to replace the "RECIPIENT-EMAIL" in the EMAIL.TEMPLATE data set with the email address like JOHN.DOE@COMPANY and also replace the RECIPIENT-NAME with the corresponding name "JOHN DOE".

A bonus would be if I could repeat the template 3 times, 1 for each guy in the input data set.

Thank you!
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 776
Location: Bamberg, Germany

PostPosted: Tue Feb 15, 2022 7:57 am
Reply with quote

You have tried what so far?

Basically it's possible w/ JOINKEYS and some IFTHENs to replace the fields and keep the formatting. In a quick and dirty hack, I can see some result as:
Code:
****** **************************** Datenanfang ****
000001 HELO SMTP                                   
000002 MAIL FROM: <email.address.of@sender>         
000003 RCPT TO:<JOHN.DOE@COMPANY>                   
000004 DATA                                         
000005 From:     email.address.of@sender           
000006 To:       JOHN.DOE@COMPANY                   
000007 Subject:  Your weekly summary               
000008 MIME-VERSION: 1.0;                           
000009 Content-Type: text/html;                     
000010                                             
000011 <html>                                       
000012 <body>                                       
000013 Dear JOHN DOE,                               
000014 </body>                                     
000015 </html>                                     
000016 .                                           
000017 HELO SMTP                                   
000018 MAIL FROM: <email.address.of@sender>         
000019 RCPT TO:<BILL@COMPANY>                       
000020 DATA                                         
000021 From:     email.address.of@sender           
000022 To:       BILL@COMPANY                       
000023 Subject:  Your weekly summary               
000024 MIME-VERSION: 1.0;                           
000025 Content-Type: text/html;                     
000026                                             
000027 <html>                                       
000028 <body>                                       
000029 Dear BILL,                                   
000030 </body>                                     
000031 </html>                                     
000032 .                                           
:
Back to top
View user's profile Send private message
milanboros

New User


Joined: 14 Feb 2022
Posts: 2
Location: Hungary

PostPosted: Wed Feb 16, 2022 3:52 am
Reply with quote

Hello Joerg.

I actually gave up on SORT and wrote a PLI instead which produce the same output. PLI is something I am more familiar with.
If you think please share your SORT solution, so anyone who ends up in this thread in the future thru search or google can use your solution as sample.

Thank you!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1492

PostPosted: Wed Feb 16, 2022 5:21 am
Reply with quote

Using SORT here is possible, but it is a shoehorned solution.

PL/I is better (as ANY procedural language, from Assembler to FORTRAN), but it doesn’t worth the task.

The best way should be using REXX: quick, and simple.

The only non-suitable thing for this task would be: HTML. icon_razz.gif
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 Replace a string in a VB file and cop... DFSORT/ICETOOL 2
No new posts Replacing character string in file th... JCL & VSAM 9
No new posts Cobol Db2 program (inserting Char Equ... COBOL Programming 0
No new posts Read file names from existing file th... DFSORT/ICETOOL 6
No new posts Multiple find/replace on the same dat... DFSORT/ICETOOL 4
Search our Forums:

Back to Top