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



Take the statement and reformat it.

SELECT T4.trmifl,
TIMESTAMP(T1.ISIHDATE, CAST(SUBSTR(DIGITS(T1.IHTIME),1,2)|| ''.'' || SUBSTR(DIGITS(T1.IHTIME),3,2) AS TIME) ),
T1.ISIHDATE,
CAST(SUBSTR(DIGITS(T1.IHTIME),1,2)|| ''.'' ||SUBSTR(DIGITS(T1.IHTIME),3,2) AS TIME ),
T1.IHTIME, T3.IOSEQ, T2.IDACODE, T2.IDAVALU, T1.IHNOTE, T4.TRMIRS, T2.IDACOMM, T1.IHRECB, T4.TRRNAME,
T4.TRMIDT, T4.TRMITM,
TIMESTAMP(T1.ISIHDATE, CAST(SUBSTR(DIGITS(T1.IHTIME),1,2) || ''.'' || SUBSTR(DIGITS(T1.IHTIME),3,2) AS TIME ) ),
TIMESTAMP(T4.ISTRTRDT, CAST(SUBSTR(DIGITS(T4.TRTRTM),1,2) || ''.'' || SUBSTR(DIGITS(T4.TRTRTM),3,2) ||''.''|| ********* WHERE'S THE END OF THIS? ********
TIMESTAMP(T2.IDASYSDT, CAST(SUBSTR(DIGITS(T2.IDASYSTM),1,2)) || ''.'' || SUBSTR(DIGITS(T2.IDASYSTM),3,2))||''.''|| SUBSTR(DIGITS(T2.IDASYSTM),5,2) AS TIME)),
T2.IDASYSDT,
CAST(SUBSTR(DIGITS(T2.IDASYSTM),1,2) ||''.''|| SUBSTR(DIGITS(T2.IDASYSTM),3,2) ||''.''|| SUBSTR(DIGITS(T2.IDASYSTM),5,2) AS TIME ),
TIMESTAMP(T4.TRMIDT, T4.TRMITM )
FROM SQAFC312.NCPIOHP T1
INNER JOIN NCPIODPA T2
ON T1.IHPAT = T2.IDAPAT
AND T1.ISIHDATE = T2.IDADATE
AND T1.IHTIME = T2.IDATIME
INNER JOIN NCIOMSP T3
On T2.IDACODE = T3.IOCODE
INNER JOIN SQAFC312.NCTRNSP T4
ON T1.IHPAT = T4.TRPAT#
and T1.ISIHDATE = T4.ISTRACDT
AND T1.IHTIME = T4.TRACTM
AND T4.TRCODE = 'I'



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Richard Reeve
Sent: Wednesday, June 22, 2011 8:55 PM
To: RPG programming on the AS400 / iSeries
Subject: Fw: Embedded SQL error

All,


I'm going crazy with this SQL stmt - when run I get a 'Token ) was not valid. Valid tokens: + -" (after digits) message in the joblog. For the life of me, I don't see the problem. Is there an easier or more intuitive way of debugging embedded SQL?
'SELECT T4.trmifl, TIMESTAMP(T1.ISIHDATE, '+
'CAST(SUBSTR(DIGITS(T1.IHTIME),1,2)|| ''.'''+
'|| SUBSTR(DIGITS(T1.IHTIME),3,2) AS TIME) '+
' ), T1.ISIHDATE, CAST( SUBSTR(DIGITS '+
'(T1.IHTIME),1,2) || ''.'' || '+
'SUBSTR(DIGITS(T1.IHTIME),3,2) AS TIME ), '+
'T1.IHTIME, T3.IOSEQ, T2.IDACODE, '+
'T2.IDAVALU, T1.IHNOTE, T4.TRMIRS, '+
' T2.IDACOMM, T1.IHRECB, T4.TRRNAME, '+
' T4.TRMIDT, T4.TRMITM, '+
' TIMESTAMP(T1.ISIHDATE, CAST( '+
' SUBSTR(DIGITS(T1.IHTIME),1,2) || '+
' ''.'' || SUBSTR(DIGITS(T1.IHTIME) '+
' ,3,2) AS TIME ) ), '+
'TIMESTAMP(T4.ISTRTRDT , CAST(SUBSTR( '+
'DIGITS(T4.TRTRTM),1,2) ||''.''|| SUBSTR( '+
'DIGITS(T4.TRTRTM),3,2) ||''.''|| '+
'TIMESTAMP(T2.IDASYSDT , CAST( SUBSTR( '+
'DIGITS(T2.IDASYSTM),1,2))||''.''|| SUBSTR('+
'DIGITS(T2.IDASYSTM),3,2))||''.''|| '+
'SUBSTR(DIGITS(T2.IDASYSTM),5,2) AS TIME)),'+
' T2.IDASYSDT, CAST(SUBSTR(DIGITS '+
'(T2.IDASYSTM),1,2) '+
'||''.''|| SUBSTR(DIGITS(T2.IDASYSTM),3,2) '+
'||''.''|| SUBSTR(DIGITS(T2.IDASYSTM),5,2) '+
'AS TIME ) , '+
' TIMESTAMP(T4.TRMIDT, T4.TRMITM ) '+
' FROM SQAFC312.NCPIOHP T1 INNER JOIN '+
' NCPIODPA T2 ON
T1.IHPAT = T2.IDAPAT AND'+
' T1.ISIHDATE = T2.IDADATE AND '+
' T1.IHTIME = T2.IDATIME '+
' INNER JOIN NCIOMSP T3 On '+
' T2.IDACODE = T3.IOCODE '+
' INNER JOIN SQAFC312.NCTRNSP T4 ON'+
' T1.IHPAT = T4.TRPAT# and '+
' T1.ISIHDATE = T4.ISTRACDT AND
'+
' T1.IHTIME = T4.TRACTM AND '+
' T4.TRCODE = ''I'' '

As always, thanks for your advice and help.

Warmest Regards,

Richard Reeve
--
This is the RPG programming on the IBM i / System i (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.

________________________________

Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.

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.