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



Uummm. I looks like a SQL precompiler issue. It works fined if I
change the mergedFileRcd DS to not use like keyword:

D mergedFileRcd...
D DS qualified
D frmCC 11p 0
D toCC 11p 0
D fileType 10
D recordType 10
D lastChange 14
D rrn 15p 0



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai
Sent: Tuesday, April 29, 2008 3:26 PM
To: RPG programming on the AS400 / iSeries
Subject: SQL0420

I'm having one of those day where embedded sql just does not want to
work.

I'm getting the SQL0420 error and not able to figure out what is causing
the problem. I copy the code to a test program and it works just fine.
But in the actual program it is failing with SQL0420. Any help would be
appreciated.

below are relevent variables and SQL statements:
D processThisAsgnKey...
D DS qualified
D format like(ECFMTC)
D freq like(ECFREQ)
D baud like(ECBAUD)

D mergedFileRcd...
D DS qualified
D frmCC like(PSNStr)
D toCC like(PSNEnd)
D fileType 10
D recordType 10
D lastChange 14
D rrn 15p 0

C/exec sql
C+ declare mergedFileCursor scroll cursor for
C+ select
C+ PSNStr as CCStr,
C+ PSNEnd as CCEnd,
C+ cast('CCM ' as char(10)) as fileType,
C+ cast(
C+ (case PSULJB
C+ when :@pgmNM then 'BOSS'
C+ else 'CCM'
C+ end
C+ )
C+ as char(10)) as recordType,
C+ cast(
C+ digits(PSULCY)||digits(PSULYR)||
C+ digits(PSULMO)||digits(PSULDY)||
C+ digits(PSULTM)
C+ as char(14)) as lasChange,
C+ RRN(BLCAPASPF) as "rrn"
C+
C+ from BLCAPASPF
C+
C+ where PSFreq = :processThisAsgnKey.freq and
C+ PSBaud = :processThisAsgnKey.Baud and
C+ PSNEnd >= PSNStr
C+
C+ union all
C+ select
C+ ECCPCDFrm as CCStr,
C+ ECCPCDTo as CCEnd,
C+ cast('BOSS' as char(10)) as fileType,
C+ cast('BOSS' as char(10)) as recordType,
C+ cast(
C+ replace(char(curdate(), iso), '-', '') ||
C+ replace(char(curtime(), iso), '.', '')
C+ as char(14)) as lasChange,
C+ RRN(BLCCMBPF) as "rrn"
C+
C+ from BLCCMBPF
C+
C+ where ECFreq = :processThisAsgnKey.freq and
C+ ECBaud = :processThisAsgnKey.Baud and
C+ ECCPCDTo >= ECCPCDFrm
C+
C+ order by
C+ CCStr, CCEnd

. . .
P getNextmergedFileRcd...
P B
D pi n
D piMergedFileRcd...
D likeds(mergedFileRcd)

C/exec sql
C+ fetch from mergedFileCursor
C+ into :piMergedFileRcd
C/end-exec

. . .



--
This is the RPG programming on the AS400 / iSeries (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 ...

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.