I use lansa to create my fields and files. Lansa does NOT support date fields (you have to create virtual fields that only work within lansa)
I have a file with a 6 digit numeric field that I store a MDY formatted Delivery Date. I want to be able to make a selection from this file using this field based on a MDY Date Range. In RPG using %date works great but I want to do it during a SQL statement.
I tried the following with no luck:
C/exec sql
C+ Declare INDIV Cursor for
C+ Select OICUST, OIIYWD, OIINVN, OIBLCK, OITYPE, OIBLNG, OIIMDY,OIIAMT, OIPAMT, OIPYWD, OIPMDY, OIEMPN, OIEMSN, OIBTCH, OICSSN, OIPAID, OIUBCH, OICOMM, OIRTE, OIGPID, OIRECN, OIRAMT, OIPONO
C+ From WHOINV
C+ Where CAST(OIIMDY as Date) >= :IStartDate
C+ and Cast(OIIMDY as Date) <=:IEndDate
C+ and OICUST = :ICustNum and OITYPE <=2
C+ Order By OIIMDY
C/end-exec
When compiled I get the error CAST FROM NUMERIC TO DATE NOT SUPPORTED. Does anyone how to convert a numeric to a date during the select statement? Otherwise I'm having to select ALL records and then convert the field to a date field (using %date)and then compare them to my date range.
Thank in advance for any and all help.
I have a file with a 6 digit numeric field that I store a MDY formatted Delivery Date. I want to be able to make a selection from this file using this field based on a MDY Date Range. In RPG using %date works great but I want to do it during a SQL statement.
I tried the following with no luck:
C/exec sql
C+ Declare INDIV Cursor for
C+ Select OICUST, OIIYWD, OIINVN, OIBLCK, OITYPE, OIBLNG, OIIMDY,OIIAMT, OIPAMT, OIPYWD, OIPMDY, OIEMPN, OIEMSN, OIBTCH, OICSSN, OIPAID, OIUBCH, OICOMM, OIRTE, OIGPID, OIRECN, OIRAMT, OIPONO
C+ From WHOINV
C+ Where CAST(OIIMDY as Date) >= :IStartDate
C+ and Cast(OIIMDY as Date) <=:IEndDate
C+ and OICUST = :ICustNum and OITYPE <=2
C+ Order By OIIMDY
C/end-exec
When compiled I get the error CAST FROM NUMERIC TO DATE NOT SUPPORTED. Does anyone how to convert a numeric to a date during the select statement? Otherwise I'm having to select ALL records and then convert the field to a date field (using %date)and then compare them to my date range.
Thank in advance for any and all help.