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



Hi Jeff,

I believe this kind of truncation has always been how it worked.

"A character, graphic, or UCS-2 result will be left justified and padded with blanks on the right or truncated as required."
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzasd%2Fsc092508941.htm

-Kurt Anderson

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

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.