I am an experienced IBM programmer starting work on the AS/400 Query/400 system, and I'm having a problem.
My company stores dates as six digit numbers in the AS400(not sure if this is normal or not), so if there is no date the field is 0. To query against dates the following is typed in the Define Result Fields:
Setup: Date field is called Mydate
@MYDATEMM substr(digits(mydate),1,2)
@MYDATEDD substr(digits(mydate),3,2)
@MYDATEYY substr(digits(mydate),5,2)
@MYDATE date(@mydatemm || '/' || @mydatedd || '/' || @mydateyy)
This works fine in other people's queries, but for some reason I am not able to emulate it. I have tried typing it verbatim many times, and I've even tried copying and pasting. When I try to use this method, however, I recieve the error message "Error retrieving record from a file".
Now I have worked around this by not using the Date() function and just querying against a string value, which has worked until now, when I need to query against Current(date).
Does anyone have any ideas why this may be happening? I know it's not the date format because in a query where this works for one field (a query I did not write) if I add this type of formatting for a second field (i.e. MyDate1) I get the same "Error retrieving record from a file" message.
Any help would be GREATLY appreciated!
AC
My company stores dates as six digit numbers in the AS400(not sure if this is normal or not), so if there is no date the field is 0. To query against dates the following is typed in the Define Result Fields:
Setup: Date field is called Mydate
@MYDATEMM substr(digits(mydate),1,2)
@MYDATEDD substr(digits(mydate),3,2)
@MYDATEYY substr(digits(mydate),5,2)
@MYDATE date(@mydatemm || '/' || @mydatedd || '/' || @mydateyy)
This works fine in other people's queries, but for some reason I am not able to emulate it. I have tried typing it verbatim many times, and I've even tried copying and pasting. When I try to use this method, however, I recieve the error message "Error retrieving record from a file".
Now I have worked around this by not using the Date() function and just querying against a string value, which has worked until now, when I need to query against Current(date).
Does anyone have any ideas why this may be happening? I know it's not the date format because in a query where this works for one field (a query I did not write) if I add this type of formatting for a second field (i.e. MyDate1) I get the same "Error retrieving record from a file" message.
Any help would be GREATLY appreciated!
AC