the l400-err-rundate as you can see has a pic 9(8) attribute. That will be converted by using string command that will make the date a necessary format for querying.
Code:
MOVE L400-ERR-RUNDATE TO W300-RUNDATE
000279 STRING W300-YY DELIMITED BY SIZE
000280 '-' DELIMITED BY SIZE
000281 W300-MM DELIMITED BY SIZE
000282 '-' DELIMITED BY SIZE
000283 W300-DD DELIMITED BY SIZE
000284 INTO W300-RUNDATE2
000285 END-STRING
000286 DISPLAY 'RUNDATE: ' W300-RUNDATE2
000287 MOVE W300-RUNDATE2 TO PAY-PERIOD
Before I open the cursor, I tried to transfer the values as you can see on the top (w300-rundate to w300-rundate2), but I guess it's useless or ineffective.
When I try to use the linkage section as a host variable, it returns an error in compile time, saying the the variable is undefined or unusable.
PAY_PERIOD data type is DATE.
Defined in DB2 which has a format of YYYY-MM-DD
I'm using the string statement because, the L400-RUNDATE only comprises of the YYYYMMDD data.
ex. 20110228, which is a date but when used as a parameter in "WHEN" area of the sql statement will not return any rows.
So, it has to be STRINGed to follow querying format.
And yes. The w300-rundate is my previous variable when I'm trying the possible solutions.
The program worked, the STRINGing process should be recieved by w300-rundate.
It worked actually. My fault on not inserting required information to other tables. Since I was joining tables the information must be somehow complete. I failed on that part. I end up scolding and laughing at myself.