Use CAST:
CREATE TABLE QTEMP/LISTJRN AS (
SELECT cast( JOURNAL_RECEIVER_LIBRARY as char(10)) as RCVLIB
,cast (JOURNAL_RECEIVER_NAME as char(10)) as RCVNAM
,DETACH_TIMESTAMP as TIMESTMP
FROM QSYS2.JOURNAL_RECEIVER_INFO
WHERE DETACH_TIMESTAMP IS NOT NULL
AND SUBSTR(JOURNAL_RECEIVER_LIBRARY, 1,1) <> 'Q'
AND DETACH_TIMESTAMP < CURRENT_TIMESTAMP - 14 DAYS
ORDER BY DETACH_TIMESTAMP)
WITH DATA
- Dan Bale
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jim Oberholtzer
Sent: Wednesday, May 28, 2025 2:19 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: SQL column size in CLLE
I am running this SQL in a CLLE program:
Runsql ('CREATE TABLE QTEMP/LISTJRN AS (
SELECT JOURNAL_RECEIVER_LIBRARY as RCVLIB
,JOURNAL_RECEIVER_NAME as RCVNAM
,DETACH_TIMESTAMP as TIMESTMP
FROM QSYS2.JOURNAL_RECEIVER_INFO
WHERE DETACH_TIMESTAMP IS NOT NULL
AND SUBSTR(JOURNAL_RECEIVER_LIBRARY, 1,1) <> ''Q''
AND DETACH_TIMESTAMP < CURRENT_TIMESTAMP - 14 DAYS
ORDER BY DETACH_TIMESTAMP)
WITH DATA')
COMMIT(*NONE)
In SQL runscrips, the SQL works great, until I go to use the columns RCVLIB and RCVNAM. The SQL produces a file with varchar output which the CLLE does not like.
How to I put a size on the two columns (ideally Char 10) so the CLLE compiler won't complain?
--
Jim Oberholtzer
Agile Technology Architects
*** CONFIDENTIALITY NOTICE: The information contained in this communication may be confidential, and is intended only for the use of the recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. ***
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.