×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Overflow is only an issue on numeric operations.

Paul Therrien
Orion South, Inc.
504-374-9551
800-437-7173
ptherrien@xxxxxxxxxxxxxxx


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Crosby
Sent: Thursday, June 14, 2012 3:43 PM
To: RPG programming on the IBM i / System i
Subject: Truncating when concatenating text

All,

Maybe everyone else already knows this. I have a situation where I'm stringing various pieces of text into a single text field. On rare occasions, the length of the text I want to string in _could_ be longer than the text field where I'm storing it. If that happens, I don't want the last piece of text to cause an exception or halt or whatever.

I decided maybe a Monitor group for the last concatenate would be the best so I did a little quickie program to test what would happen. In this program I defined a text field 60A and put in these 2 statements:

Text = 'L18.9000A18.90M19.0700LS22.97AS22.97';
Text = %Trim(Text) + 'L18.9000A18.90M19.0700LS22.97AS22.97';

The 2nd statement will overflow the field. When I ran the test without a Monitor group, I got no error! The program dump shows this:

TEXT CHAR(60) 'L18.9000A18.90M19.0700LS22.97AS22.97L18.9000A18.90M19.0700LS'

so it filled the field and then stopped. That is not what I expected.

I'm going to RTFM to confirm this is expected, but it just startled me.

--
Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my company. Unless I say so.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


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-2026 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.