In CL, I've created a outfile out of dspobjd cmd. To this file, i've filtered a column using opnqryf. I've copied the output (cpyqryf) to a new file. While doing this, i'm getting the error data option was not allowed with open option'
The log shows :The first file is created-> added to library. Seqonly (*no)
Error occurs when copying data.
Software/Hardware used:
ASKED:
October 16, 2012 7:14 AM
The log is:
output file file1 created
file1 added to library
mmember of file1 is opened in library.
data option was not allowed with opn option
error reading member file1 in file1
0 records copied to file2
Now i tried to close the file file1 before the opnqryf cmd..
The error i’m getting is : Open-identifier specified for FROMOPNID not valid.
Not enough information. Any time errors are to be reported, the message identifier is needed. Usually, an error that makes a difference will be an *ESCAPE message. An escape message might be preceded by one or two *DIAG (diagnostic) messages. With the message IDs, simple text is often useless. — Tom
Beyond error reporting, the use of OPNQRYF should be avoided. The command comes from the original System/38 back in the 1970s, before SQL existed. If you’re simply ‘filtering a column’, a basic CREATE VIEW or a straight SQL SELECT is probably a much better choice. The modern needs for OPNQRYF are extremely limited. — Tom
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?
Is the data flow correct:
We can’t know. We don’t know what you’re trying to do. If it gives results you need, it’s correct enough. If not, it isn’t. So far, you’re asking only about purely technical issues. A technical item essentially works or doesn’t work.
But you haven’t given any business reason. We don’t know why you’re doing this nor what result you’re seeking. We can’t know if what you’re doing is appropriate or not.
…opnqryf (for where condition)…
Using a WHERE condition would be much easier.
…cpyfrmqryf (to a new file, file2)
It seems that you don’t actually need a new file, so there’s no way to know if that step makes sense.
‘file1 is already in use’. Can u help?
Most likely, you didn’t close the files when the first error occurred. Until you do the close (or closes) or possibly until you run the process in a different job, it will give that error every time.
But it might be something else. It’s not clear without a message ID.
Tom
I want to run a batch job which upon executig wuld fetch the objects present in all the user libraries (for excluding source phy file item i’m using qryslt, which should omit the ‘q..’ starting with ‘q’).
The final list still contains the objects starting with alphabet ‘q’., seems the qryslt is not working.