OPNQRYF & CPYFRMQRYF error

270 pts.
Tags:
CPYFRMQRYF
OPNQRYF
RPGLE
The log is: output file file1 created file1 added to library mmember of file1 is opened in library. data option was not allowed with open option error reading member file1 in file1 0 records copied to file2

Answer Wiki

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

Discuss This Question: 7  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
  • TomLiotta
    Repeating a problem question won't help. Most likely result is that the redundant questions will simply be deleted. -- Tom
    125,585 pointsBadges:
    report
  • Archnav01
    Is the data flow correct: dspobjd->outputfile(file1)->opnqryf (for where condition)-> cpyfrmqryf (to a new file, file2). It is getting compiled. While execution it says, Upon the 1st run, 'data option was not allowed with open option'. further runs, 'file1 is already in use'. Can u help?
    270 pointsBadges:
    report
  • WoodEngineer
    I have seen this when a CL program fails after the OPNQRYF and before the CLOF command.  If this happened while running interactively (not in batch)  simply issuing the CLOF command from a command line can solve the problem and let you run the program again.  It does not always work but it is worth a try.
    6,715 pointsBadges:
    report
  • Splat
    Archnav01, what is the second-level text on the ‘data option was not allowed with open option’ message?  It sounds as though you need to change the value of the OPTION parameter in the OPNQRYF command; the second-level text should clarify that.
    7,385 pointsBadges:
    report
  • Archnav01
    It runs once i changed the option to *all.. In qryslt. to omit values starting with 'q'., is this correct qryslt('fldname *ne  "q%" ') Still i'm getting q values in the result., some problem with qryslt.
    270 pointsBadges:
    report
  • TomLiotta
    In qryslt. to omit values starting with ‘q’., is this correctqryslt(‘fldname *ne  “q%” ‘)   No, it's not correct. That checks for values not equal to "q%". If you're checking field names, there will never be names that have a lower-case "q" nor will there be any names with a percent sign in them. There definitely won't be any named "q%"   A 'not equal' test does not use wild-card characters. The OPNQRYF documentation will tell you that.   And as I've asked before, why are you trying to use OPNQRYF? As you're finding out, it's not what you should be using. It is far too complex for a beginning user, and other methods are easier anyway. Use SQL. (The wild-cards will be easier there, too.)   Tom
    125,585 pointsBadges:
    report
  • WoodEngineer
    Check out OPNQRYF documentation on %WLDCRD built-in function.  That may do what you want.
    6,715 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