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



The value inserted into CMCITY is from a char(30) field.

This was an old, old, old RPG program that used RLA to build a workfile (ARINFOCM) that was then transformed to Excel.
Several years ago, I scrapped the RPG code for an SQL statement. I never noticed that the size of CMCITY was smaller than "city" filed in our ERP.

So I just changed CMCITY to be char(30) - problem solved. I was just wondering how we didn't see any issues in the last 2 years. Either the error didn't occur, we didn't encounter a city over 20 characters, or our clients didn't pay any attention to the report.

Since I regularly install PTF groups (weekly), I wondered if that may have something to do with it.

After this discussion, I'm thinking the 3rd option above is the most likely.

IMHO, if the truncation error is a severity 30 and halts an insert, it would be nice if the compile would fail. I mean it knows the lengths of both fields in a static statement.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Birgitta Hauser
Sent: Thursday, April 7, 2022 2:25 AM
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Suddenly I have SQL Insert errors?

How is the insert value for the CMCITY built? Are 2 columns concatenated and
the result is longer then 30 characters?
If so you should explicitly cast the value or explicitly truncate it to the
maximum length

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization - Education - Consulting on IBM i


"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to." (Richard Branson)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg
Wilburn
Sent: Mittwoch, 6. April 2022 21:40
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Suddenly I have SQL Insert errors?

I have a simple SQLRPGLE program that aggregates summary data and inserts it
into another DB file. This program has been running for years.

Now I'm getting this error:

SQL0404
Message . . . . : Value for column or variable CMCITY too long.
Cause . . . . . : An INSERT, UPDATE, MERGE, SET, VALUES INTO, or GET
DIAGNOSTICS statement specifies a value that is longer than the maximum
length string that can be stored in CMCITY. The length of CMCITY is 20 and
the length of the string is 30.
Recovery . . . : Reduce the length of the string from 30 to a maximum of
20
and try the request again.

Instead of just truncating and continuing to insert the remaining date, it
halted the insert altogether.
Easy enough to fix... BUT

1. I'm absolutely certain this situation would have occurred on a regular
basis in the past, and
2. This is the second SQL insert error I've seen TODAY that halted the
insert (the other was a NULL value into a character field).

Seems maybe a PTF or something has tightened up the syntax on the SQE??

TIA,
Greg
[Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<http://www.totalbizfulfillment.com>
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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.