OPNQRYF Error on QRYSLT

Business Intelligence
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Q: I'm having a problem with the Open Query File (OPNQRYF) command. I have a display file that lets the user fill in a field called CSDATE. I use this field in a CL program to select certain records from the purchase order item (POITEM) file. When I run the OPNQRYF command, I get an error saying the field CSDATE is not found. Can you tell me what I'm doing wrong? Here is the OPNQRYF statement I'm using:

 OPNQRYF FILE((POITEM *FIRST)) + QRYSLT('CSDATE *LE STKDT') + KEYFLD((ACCTN) (ORDNO) (ITNBR)) 

A: You want the OPNQRYF statement to compare the value in CSDATE to the field STKDT. The problem is that the command thinks CSDATE is part of the POITEM file. One solution is to concatinate the value of the comparison field with the query select statement. Here is the OPNQRYF command you could use.

 OPNQRYF FILE((POITEM *FIRST)) + QRYSLT(&CSDATE *BCAT + '*LE STKDT') KEYFLD((ACCTN) + (ORDNO) (ITNBR)) 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$