|
I am new to the whole are of service programs/binding source members. My
company are in the process of moving from OS/400 V4R5 to V5R4 after
which we commence technical training. In the meantime I need help!
I am testing a utility to help us manage character string variables used
to store emails. We had some guidance in putting together a quick
service program to do this for us but have run into problems testing it.
To begin with the email information is stored in an alphanumeric field,
with a semi colon used a separator - e.g.
'joeblogs@xxxxxxxxx;john.doe@xxxxxxx;royrogers@xxxxxxxxxx'. The
following is an extract of the code used to extract each individual
email address (which is then returned to an RPG program to display the
information for maintenance) ...
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
If the that string
'joeblogs@xxxxxxxxx;john.doe@xxxxxxx;royrogers@xxxxxxxxxx' is read the
'doW' reads in each of the 3 emails correctly but the ends up doing an
extra 'loop' returning a fourth address into the 'emails' variable which
contains corrupt data.
Please perform a code review and see if you can find why it returns the
extra 'ambiguous' data.
Kind regards,
John.
John Kelly
IT Project Manager
Stryker Orthopaedics
Raheen Business Park
Limerick
Ireland
Phone: +353 (0)61 498326
Fax: +353 (0)61 229941
E-mail: john.kelly@xxxxxxxxxxx
This message (and any associated files) is intended only for the
use of the individual or entity to which it is addressed and may
contain information that is confidential. If you have received this
message in error, please notify us immediately by replying to the
message and then deleting it from your computer. Any views presented
are solely those of the author and do not necessarily represent
those of the company.
Howmedica International S. de R. L. Registered in Ireland,
Registered No. 901582.
Incorporated in Panama with Limited Liability.
Vat No. IE9/Z/33717B.
Registered Office Raheen Business Park, Limerick, Ireland.
As an Amazon Associate we earn from qualifying purchases.
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.