If you are doing the PREPARE first, followed by the OPEN, and it works interactively, then possibly you have specified SQL naming for the interactive session, but your program is using system naming.

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx /

On 5/24/2022 4:58 AM, gio.cot via RPG400-L wrote:
Hi all
when i execute the following statament inside an SQLRPGLE i receive error
26501 (after open) and 42601 after prepare , but if i try to run the same
statement from ACS script SQL function, it works fine ; can some help me to
understand which could be or hot to find the the problem ?

Thanks in advance


SELECT A1DAT,

'A' AS ID,

A1COD,

A1ORA,

IFNULL(CAST(NULL AS DEC(9, 0)), 0) AS AETNR

FROM Mylib.FILE1

WHERE (A1DAT BETWEEN 20220525 AND 20220525

OR A1DAT = 00000000)

AND A1NOM <> ''

AND A1NOT <> 'XXXXXXXXXX'

AND A1NOT <> '**********'

AND A1NOT <> 'XXXXXXXXX'

AND A1COD IN (

'ZZZ',

'AAA',

'CCC',

'ABC'

)

UNION ALL

SELECT AETDDS AS A1DAT,

'B' AS ID,

IFNULL(CAST(NULL AS VARCHAR(3)), ' ') AS A1COD,

IFNULL(CAST(NULL AS DEC(6, 0)), 0) AS A1ORA,

AETNR

FROM mylib.file2

WHERE AETCBL = 'S'

AND (AETDDS BETWEEN 20220525 AND 20220525)

ORDER BY 1,

4

FOR READ ONLY



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