OPNQRYF problem CPF9899

90 pts.
Tags:
CL
CL/400
Open Query File
OPNQRYF
DCLF FILE(LIBRARY/DISPLAY) START: SNDRCVF RCDFMT(REC) WAIT(*YES) IF COND(&IN03 *EQ '1') THEN(DO) GOTO CMDLBL(END) ENDDO IF COND(&ENQQUA1 *EQ ' ') THEN(DO) GOTO CMDLBL(START) ENDDO IF COND(&ENQQUA1 *NE *BLANKS) THEN(DO) OPNQRYF FILE((SARKNS/ENQP002)) OPTION(*ALL) + QRYSLT('&ENQQUA *EQ ''' *CAT &ENQQUA1 *CAT'''') OVRDBF FILE(ENQP002) TOFILE(SARKNS/ENQP002) + SHARE(*YES) CPYFRMQRYF FROMOPNID(ENQP002) TOFILE(SARKNS/ENQP00222) + MBROPT(*REPLACE) ENDDO DLTOVR FILE(ENQP002) CLOF OPNID(ENQP002) END: ENDPGM
I had made a mistake while in QRYSLT. Here is a field from Physical File (LIBRARY/ENQP002) and &ENQQUA1 is a field from display file (LIBRARY/DISPLAY). Both the fields' attributes are the same (size and data type). When I call this programme, I get the following message:
CPF9899 received by OOQ at 112 (C D I R)


Answer Wiki

Thanks. We'll let you know when a new response is added.

/// sorry – Mr Phil made mistake. //////////

Yes, there is still a mistake in the QRYSLT

‘&ENQQUA *EQ ”’ *CAT &ENQQUA1 *CAT ””
Now transmits

&ENQQUA *EQ ‘YOURVAL’

and the error is…
the first character — your field in the database is not named &ENQQUA
it is named ENQQUA only in the CL land would we refer to it as &ENQQUA.
The OpnQry Select is built in the CL land but runs in the database engine.

Sooooooooo the select should be:

‘ENQQUA *EQ ”’ *CAT &ENQQUA1 *CAT””

Sorry.

Phil

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • LBurkett99
    Message CPF9899 only says an error occured in a command. You need to dig deeper into your job log to determine what the error is and what may have caused. it. Pressing F10 in the command entry screen displays all messages. To get to the command entry screen, CALL QCMD. You can also use the DSPJOB command or SYSREQ, option 3 to get the Display Job menu, then use option 10 to see your job log. From here, F10 to display all message and F18 to go to the end. Read from the bottom up to get to the message describing the error.
    830 pointsBadges:
    report
  • graybeard52
    You can make your life easier with OPNQRYF by defining a CL variable for the QRYSLT parm. Something like this DCL &QRYSLT *CHAR 1024 CHGVAR &QRYSLT VALUE('your select statememt') OPNQRYF QRYSLT(&QRYSLT) etc The advantage to this is it simplifes the quotes. It also lets to do a SNDMSG with the &QRYSLT variable before the OPNQRYF actually runs so you can see what the variable builds up as. The OPNQRYF errors often are caused by confused quotes, and the error doesn't always give much help.
    3,115 pointsBadges:
    report
  • WoodEngineer
    There is another advantage to Graybeard's suggestion. After entering your select statment you can quickly get a general idea if your quotes are correct by checking for upper and lower case characters after pressing F4. For example, ChgVar &QrySelect ('fieldA *gt' *bcat &num1 *bcat '*and fieldB *eq ''X'' ') should be returned as (''fieldA *gt' *BCAT &NUM1 *BCAT '*and fieldB *eq ''X'' ') Notice how everything outsite your quorte is capitalized. This is not a 100% validation but at least gives a quick idea if the elements of the select statement will be treated as literals or variables.
    6,725 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following