In our nightly batch processing, our shop reads the current day’s date, as of 7PM, from a date file so that if we run past midnight, the posting date will still be from the previous day. In one of our programs, we’re reading in the date from the date file and subtracting 1 year from the date. I’m having issues with the DB2 statement in Natural.
We move the date from the date file to #CURRENT-DATE(A10) with a format of YYYY-MM-DD. I have #CURR-DT-QUOTES defined as (A12).
Here’s my code. The SQL statement works fine in DbVisualizer, but I’m getting error -418 with SQLSTATE 42610 when I run my batch Natural program.
COMPRESS "'" #CURRENT-DATE "'" INTO #CURR-DT-QUOTES LEAVING NO SPACE WRITE '=' #CURR-DT-QUOTES * SELECT * FROM MYTABLE WHERE POST_DT >= DATE(:#CURR-DT-QUOTES) -1 YEAR
NAT3700 Error -418 with SQLSTATE 42610 from call to DB2
I looked up the error and SQLSTATE definitions.
Error -418: A STATEMENT STRING TO BE PREPARED CONTAINS AN INVALID USE OF PARAMETER MARKERS
SQLSTATE 42610: A parameter marker or the null value is not allowed.
Is that referring to the quotes around the date? Thanks for any help you can give.