Seems that the command look like this from the command definition:
EMLSTMF     SUBJECT(BLAH) 
FROMNAME(MIKE) 
FROMADDR(MPANTZOPOULOS@xxxxxxxxxxxxxxxx)
TO(*TO/MIKE/MPANTZOPOULOS@xxxxxxxxxxxxxxxx
*CC/ANDREW/AROSS@xxxxxxxxxxxxxxxx)

STMF('/i90/anvdev/emailbody/ed972ok.txt')        

In order to do this "dynamically" you'll have to use individual fields
for each QUAL keyword:

EMLSTMF SUBJECT(BLAH) FROMNAME(MIKE)
FROMADDR(MPANTZOPOULOS@xxxxxxxxxxxxxxxx)
TO(&to/&name/&address &to1/&name1/&address1, etc...)

Doing this in CL will be a real PITA...

The first 2 bytes of the incoming string will contain the number of
entries being passed from the command interface.  You'll have to take
that into account as well.

In RPGLE I usually set this up in a data structure containing an array.
D MyAddresses  ds               Qualified
D SendType                       4a
D Name                            50a
D Address                        50a

D ToAddr         ds                  Qualified
d AddrCount                       5i 0          
d Addresses                       Dim(300) LikeDS(MyAddresses)

D I                   s               10i 0
D ToAddressString    s     300a varying
D CmdString             s     500a varying

The TO() keyword would enter the RPGLE in the ToAddr DS.

/free
   ToAddressString = 'TO(';
   for I = 1 to ToAddr.AddrCount;
      ToAddressString = ToAddressString + ' ' +
ToAddr.Addresses.SendType +'/'
                  +ToAddr.Addresses.Name+'/'+ToAddr.Addresses.Address;
   EndFor;
   ToAddressString = ToAddressString +')';
   CmdString = 'EMLSTMF SUBJECT(BLAH) FROMNAME(MIKE)'+
                  ' FROMADDR(MYEMAIL@xxxxxxxxxxxx) ' +
                  ToAddressString + ' STMF(MYSTMF)';
   QCMDEXC(CmdString : %Len(CmdString);

This is just sample code if used it should be tested..especially since
I'm using outlook as a code editor ;-)

Thanks,
Tommy Holden


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Mike Pantzopoulos
- (H/O)
Sent: Wednesday, January 03, 2007 3:26 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Parameter Substitution for Qualified Parameter.

I've never had cause to do this before and I can't find any examples,
and I'm not a command expert, so could someone please help...........

 

I'm using the EASY400 software to generate emails from our iSeries
application. The command doesn't really matter.

 

The command I'm using is EMLSTMF which allows up to 50 recipients to
receive an email with attachments.

Here is the definition from the CMD source for the TO parameter:

 

0013.00              PARM       KWD(TO) TYPE(QUAL1) MIN(1) MAX(50) +


0014.00                           PROMPT('Recipients')


0015.00  QUAL1:      QUAL       TYPE(*NAME) LEN(4) RSTD(*YES) DFT(*TO) +
0016.00                           SPCVAL((*TO 0) (*CC 1) (*BCC 2))
0017.00              QUAL       TYPE(*CHAR) LEN(50) MIN(1) +
0018.00                           PROMPT('''name''')
0019.00              QUAL       TYPE(*CHAR) LEN(50) MIN(1) +
0020.00                           PROMPT('''e-mail address''')
                                               

When I run this command from a command entry line I am able to include a
number of recipients defined as *TO or *CC or *BCC, all in the single
command:

EMLSTMF     SUBJECT(BLAH) 
FROMNAME(MIKE) 
FROMADDR(MPANTZOPOULOS@xxxxxxxxxxxxxxxx)

TO(MPANTZOPOULOS@xxxxxxxxxxxxxxxx/MIKE/*TO
AROSS@xxxxxxxxxxxxxxxx/ANDREW/*CC) 

STMF('/i90/anvdev/emailbody/ed972ok.txt')          

 

 

Notice how the TO parameter has constructed the two qualified values.

 

I now want to run this same sort of thing in a CL and populate the TO
parameter with 1 or more recipients in a dynamic manner based on other
reference data. For example, a particular report may need to go to two
different team leaders, but may also need to be copied to senior
manager. Who the recipients are will be based on a reference table
accessed by report id.

 

I tried creating a character variable to look like the above TO
parameter but it ended up being used as the first qualifier above (the
email address). The slashes between the individual qualifiers seem to be
markers required by the qualified parameter, but are ignored when I
include them in a string substitution value. In other words a single
substitution value consisting of a character variable will not work.

 

The fundamental question is:

 

How do I construct the qualified parameters dynamically so that I can
have 1 - 50 sets of recipients?

 

I have a feeling it's a problem with apostrophes but I can't seem to
quite 'get it'. 

 

TIA

 

Mike Pantzopoulos

 

                              


************************************************************************
*********************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. If you are not the intended recipient, any use, disclosure or
copying of this message is unauthorised. If you have received this
message in error, please reply using the sender's email address. 

This footnote confirms that this email message has been scanned for
computer viruses. EIG-Ansvar Limited does not accept liability for any
loss or damage, whether caused by our own negligence or not, that
results from a computer virus or defect in the transmission of this
email or any attached file. 

EIG-Ansvar Limited - Australia (A.B.N. 21 007 216 506)
Email : insure@xxxxxxxxxxxxxxxx

Eig-Ansvar Limited - New Zealand
Email : insure@xxxxxxxxxxxxxxxx

************************************************************************
*********************************

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].