OPNQRYF command runs ok interactively but errors out in batch

10 pts.
Tags:
AS/400
CL Program
OPNQRYF
I have a CL (call it RUN) that calls multiple CLs. This was done to run several steps that were run manually. Two of these CLs ( STEP ONE and STEP TWO)  use an OPNQRYF against the same file. When I called RUN it worked fine interactively but when I submit it through WRKJOBSCDE, STEP TWO errors out on the OPNQRYF saying 'shared open not allowed for query'. Will a RSLRSC in the STEP ONE fix this and why was it OK when I ran it interactively?
1

Answer Wiki

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

You really should be cleaning up any opens in the program that opened them. Have each of STEP ONE and STEP TWO issue a CLOF command to close the OPNQRYF – Unless you want to deliberately share the open to save rebuilding it, in which case use SHARE(*YES).

Discuss This Question: 2  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.
  • Splat
    Do you run any commands between the first OPNQRYF and the second?
    12,905 pointsBadges:
    report
  • ToddN2000
    Post your code you have running in the job scheduler. It will help us understand your work flow to see what is wrong.
    133,800 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.

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

Following

Share this item with your network: