× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I did change the loop to a DoU but ended up with the same result.

As a novice to this whole area I am struggling to identify where the
getToken subprocedure. Attached please find the full code for the get
email/set email utility. My thoughts are that it is part of the QC2LE
binding directory, and is related to the Strtok C function.

The string the utility needs to process is a series of emails,
separated by a semi colon. It is to keep processing until it finds a
space which determines it has found all the email addresses. An example
of the string it is attempting to read would be ...

'john.wayne@xxxxxxxxxx;joe.blogs@xxxxxxxxxx'

In the attached code it sets the 'delimiters' variable to include both
a semi colon and a space - i.e. '; '. It then uses it to interrogate the
string using the gettoken procedure.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Needles,Stephen J
Sent: 19 February 2010 16:35
To: RPG programming on the IBM i / System i
Subject: RE: Help with Service Programming

Yep...that's it...thanks Dennis.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dennis Lovelady
Sent: Thursday, February 18, 2010 5:40 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Help with Service Programming

If I remember correctly Dow will always perform 1 extra iteration.
Try
changing the DOW to a DoU.

Rather than

doW (pToken <> *null);

try

doU (pToken = *null);

The above is incorrect. Difference between DoU and DoW is that DoU will
always do one iteration (the test is at the end), while DoW test is at
the
beginning, so it will not process the (potentially) extra step. Neither
operation will iterate an extra time after the test.

The problem is almost certainly in the getToken procedure. May we see
that,
please?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Some see the problem in every opportunity, some see the opportunity in
every problem."
-- Kevin Cowling



0001.00 h noMain bndDir('QC2LE') option(*srcstmt: *noDebugIO)
0002.00
0002.01 /include protoUtil
0002.02
0002.03 d getToken pr * extProc('strtok')
0002.04 d pString * value options(*string)
0002.05 d pDelimiters * value options(*string)
0002.06
0002.07 d delimiters s 2a inz('; ')
0002.08
0003.00 p get_eMail_Addresses...
0004.00 p B export
0004.01 d PI
0004.02 d forSplit 1000a const
0004.03 d numEmails 5i 0
0004.04 d emails 75a dim(13)
0004.05
0004.06 d pToken s *
0004.07 d split s like(forSplit)
0004.08 d emailIs s like(emails)
0004.09
0004.10 /free
0004.11 split = forSplit;
0004.12 pToken = getToken(%addr(split): %addr(delimiters));
0004.13 numEMails = 0;
0004.14 doW (pToken <> *null);
0004.15 emailIs = %str(pToken);
0004.16 if (emailIs <> *blanks);
0004.17 numEmails += 1;
0004.18 if (numEmails <= %elem(emails));
0004.19 emails(numEmails) = emailIs;
0004.20 endIf;
0004.21 endIf;
0004.22 pToken = getToken(*null: %addr(delimiters));
0004.23 endDo;
0004.24 return;
0004.25 /end-Free
0005.00 p E
0006.00
0007.00 p set_eMail_Addresses...
0008.00 p B export
0009.00 d PI
0010.00 d forSplit 1000a
0012.00 d emails 75a dim(13)
0012.01
0012.02 d i s 5i 0
0012.03 d split s 1000a varying inz('')
0012.04
0012.05 /free
0012.06 for i = 1 to %elem(emails);
0012.07 if (emails(i) <> *blanks);
0012.08 if (%len(split) > 0);
0012.09 split = split + ';';
0012.10 endIf;
0012.11 split = split + %trim(emails(i));
0012.12 endIf;
0012.13 endFor;
0012.14 forSplit = split;
0012.15 return;
0012.16 /end-Free
0014.00 P E
****************** End of data ****************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.