I've been asked to make a modification to an online screen that uses OPNQRYF on a file to generate a report so that the user can enter a date range to extract specific data. The query is currently run within a CL program and the QRYSLT statement is built inside the program depending on what the user enters in the screen.
The problem is that the file I'm using in the query stores the date separately in two digit fields(CC, YY, MM, DD). I decided to create a query and just run it in the CLP. I converted the date fields from numeric to text and concatenated them together in a Result Field as @DATE with format yymmdd.
In the CLP I added this line to the QRYSLT statement:
' *AND ' &EnteredDTE ' *GE ' &@DATE
The job goes into MSGW and checking the log I saw that while the Entered date does get converted to text and stringed together as well as added to the Select statement the statement is incomplete because &@DATE is blank:
*and 070101 *GE)
Are there any other way to use a result field in a CL program?
The problem is that the file I'm using in the query stores the date separately in two digit fields(CC, YY, MM, DD). I decided to create a query and just run it in the CLP. I converted the date fields from numeric to text and concatenated them together in a Result Field as @DATE with format yymmdd.
In the CLP I added this line to the QRYSLT statement:
' *AND ' &EnteredDTE ' *GE ' &@DATE
The job goes into MSGW and checking the log I saw that while the Entered date does get converted to text and stringed together as well as added to the Select statement the statement is incomplete because &@DATE is blank:
*and 070101 *GE)
Are there any other way to use a result field in a CL program?