If it's varying shouldn't it be %addr(body:*DATA)?

On Mon, Feb 14, 2022 at 11:31 AM Marco Facchinetti <
marco.facchinetti@xxxxxxxxx> wrote:

I guess they are using varying: %addr(body)+2

Best regards
--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco


Il giorno lun 14 feb 2022 alle ore 16:24 Vern Hamberg via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> ha scritto:

An even more efficient way, perhaps, is to use varying-length variables.
If, that is, these functions can use them or if RPG will properly make
them work - I think it might.

But varying-length generally work faster when building long string
variables than using %trim(). And the code is ever so much cleaner.

Cheers
Vern

On 2/14/2022 8:56 AM, Steve M via MIDRANGE-L wrote:
Jim,

That makes totals sense. Somewhere in the memory space allocated to
"body",
trailing your actual data, there was garbage causing your issue. It
just
shows, once again, just how important %Trim can be to success. I
think I
use that BIF almost as much as any other, for just the same kinds of
reasons.

Glad it all worked out.

Steve M.


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Jim
Hawkins
Sent: Monday, February 14, 2022 07:46
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Email from Power systems

A month or two back, there was some discussion about issues sending
email
from a power system. We have been doing this for some time, but a year
ago
we converted from an inhouse mail server to using the cloud 365 email
server
and many of our emails stopped arriving at the destination with a
bounce
back error code of 500 indicating that a text line was longer than
allowed.
One of my predecessors wrote a program called procedure that we use for
sending emails. The heart of this procedure has the following code:

header = 'From: ' + fromName + ' <' + fromAddr +
'>' +
CRLF
+'To: ' + toName + ' <' + toAddr + '>' + CRLF
+'Date: ' + MailDate() + CRLF
+'Subject: ' + subject + CRLF
+'MIME-Version: 1.0' + CRLF
+'Content-Type: text/html' + CRLF
+ CRLF;

callp write(fd: %addr(header)+2: %len(header));
//d02callp write(fd: %addr(body)+2: %len(body));
callp write(fd: %addr(body)+2: %len(%trim(body))); //a02
callp close(fd);

//
---------------------------------------------------------------------
// Send the e-mail
//
---------------------------------------------------------------------

fromLen = %len(%trim(fromAddr));
namelen = %len(%trim(filename));
sendmail(filename:namelen: fromAddr:fromLen:
%addr(RecipTbl):NbrRecips:ErrorCode);

About 2 weeks ago I deleted a line of this code (leading //d02
indicator)
and added a new line of code (trailing //a02 indicator). This appears
to
have resolved the issue we were having.

Hoping that this might help someone else.

Before someone asks: I think the entire code was from was "borrowed"
from an
online source, but there is nothing in the documentation indicating
where,
as such, I am not willing to share the entire code set.

Regards,

Jim Hawkins
Programmer Analyst
Interkal LLC
Kalamazoo, MI


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.