Hey fellow programmers & genius,
I have this problem the CONCAT in my embedded SQL. I am stringing three fields together. That works fine. The problem is when I try to test against the field I am building. Am I able to do this or am I just wrong on the syntax?
Please help.
My error code is a -514. When I cut and paste the statement from debug and run interactively I get an error that states that the field DATE can't be found. The exact statement is "Column DATE not in specified tables" which is true because I am creating it. If I remove the test it runs without errors.
The following is what I cut from debug which is much more readable:
SELECT rdbrr, rditem, rdpack ,rdbttl, rdcase, imwgal, impcse ,
DIGITS(rdject) CONCAT DIGITS(rdjeyr) CONCAT DIGITS(rdjemo) AS date
FROM rrrdmast, icmsmp WHERE rditem = imitem AND rdpack = impack AND
rdbrr = 38 AND ((date >= "200101") or (date <= "200106"))
The following is what I cut directly from my program:
c eval sql_string2 = 'SELECT rdbrr, rditem, rdpack -*
c ,rdbttl, rdcase, imwgal, impcse, -
c DIGITS(rdject) CONCAT DIGITS(rdjeyr) CONCAT -
c DIGITS(rdjemo) AS date -
c FROM rrrdmast, icmsmp -
c WHERE rditem = imitem AND rdpack = impack -
c AND rdbrr = ' + %editc(mwwhse:'X') + *
c
' AND ((date >= "' + beg_date + '") or -
c (date <= "' + end_date + '"))'
c/exec sql
c+ PREPARE p2 FROM : sql_string2
C/end-exec &
nbsp;
c/exec sql
c+ DECLARE data2 CURSOR FOR p2
C/end-exec
c/exec sql
C+ OPEN data2
C/end-exec
C Dow sqlcod = 0
C/exec sql
C+ FETCH data2 INTO :sql_input2
C/end-exec
Thanks in Advance:
Daniel A. Keith
PS I wasn't sure if this was to be in midrange-l or rpg-l.