View previous topic :: View next topic
|
Author |
Message |
milanboros
New User
Joined: 14 Feb 2022 Posts: 2 Location: Hungary
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
milanboros
New User
Joined: 14 Feb 2022 Posts: 2 Location: Hungary
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
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. |
|
Back to top |
|
|
|