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



Have you looked up the SQLSTATE? https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzala/rzalaccl.htm

"01004 The value of a string was truncated when assigned to another string data type with a shorter length. +000, +445, +802, +20141"

I'd say double-check that the Db2 column definitions match the RPG fields.


HTH



-----Original Message-----
From: Greg Wilburn [mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx]
Sent: Friday, January 10, 2020 1:14 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: SQL Error 01004

I'm getting this error inside my RPG program... I'm selecting 4 fields from one file into 4 fields in my program (which are defined by reference to fields in another file). I think the error is related to the time fields... but they are both defined the same.

All 4 fields in the "select into" are being populated correctly. However, my Sql State is 01004. Any ideas what could cause this? I'm on v7r3.

Code snippet:

Ompckr char(8)
Omplin packed(5:0)
Ompitm packed(5:0)
Ombgtm time(*iso) - defined as "T" in the file

(ALL fields are defined by reference to fields in a Physical file)

Exec Sql
Declare rfcsr Cursor for
Select aauser, count (distinct bbprt#), sum(bbqty#), min(aatime)
From RFPCKRBB
Join RFPCKRAA on aabid#=bbbid#
Where... Etc..

Exec Sql Open rfcsr;
Dou noRows;
Exec Sql Fetch Next from rfcsr
Into :ompckr, :omplin, :ompitm, :ombgtm;

If SqlStt <> SqlOk;
noRows = *on;
iter;
Endif;


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.