Can we update physical file through OPNQRYF command in clle (AS400)??Is it possible???plz guide me??
Through his option what we can do??
OPNQRYF FILE((lib/pf)) OPTION(*UPD) QRYSLT('CDE +
*EQ 101 ') KEYFLD((CDE))
Software/Hardware used:
AS400 (RPG,CL)
ASKED:
December 15, 2011 5:44 AM
UPDATED:
March 17, 2012 6:20 AM
1. The CLLe cannot update the file
2. The opnqryf has opened the file for update
3. If the CLLE includes an OVRDBF Share(*YES)
4. subsequent calls to RPG or COBOL will use the Record set from the OPNQRYF and can update it.
5. CLEL program should end the relationship with a CLOF and DLTOVR
Vendor response.
CL applications can update files accessed through OPNQRYF (or other means for that matter) using Control Langauge for Files (CLF). This can be done using the no-charge runtime support of CLF or, for improved programmer productivity, the fee-based pre-compiler. Further information can be found at this site.
End vendor response.
Sorry Bruce, didn’t intend to leave you out.
Phil
Mr. Pradeep and Mr. Phil
can you explain, below statement,
Option ‘*UPD indicates to Open the file for update operations.
my point is, we can’t update PF using OPNQRYF. but ‘The opnqryf has opened the file for update’ – this s ur point, how it is possible….
we can’t update PF using OPNQRYF. but ‘The opnqryf has opened the file for update’ – this s ur point, how it is possible….
It’s possible because that is what IBM created the command to do. It opens a query file. It doesn’t do updating. It just provides a file for your programs to update.
OPNQRYF creates a temporary open data path (an ODP) that can be used by programs in the job. When you use the OPTION(*UPD) parameter, the ODP is created with update capability. The file that is named on the OPNQRYF can be shared in the job, so other programs can issue update statements against the file. Every program that opens the file can share the ODP.
Tom
If you think of the F-spec in RPG
The Fmyfile UF will allow updates of a file but that statement doesn’t actually update the file, it open the file in update mode.
The OpnQryF does the same thing, open the file in update mode, the OVRDBF Share(*yes) allows the open with update to be passed with the call to RPG or COBOL (or Bruce’s CL commands) where rows in the underlining physical file can be changed.
If you have an SQL background, think of this as aboout the same as a Select with update command.
Phil
“Can we update physical file through OPNQRYF command ”
The meaning of the word THROUGH maybe the issue.
Through this one command can we change the data, NO!
Though the path opened by this command can subsequent commands especially subsequent programs in RPG or COBOL;change the data, yes,
As computer programmers we have an uneasy relationship with the lan guage that specifications are written in. Words and sentences can have more than one meaning.
Phil
As Philip Mentioned,
OPNQRYF will just create a view for the actual file.
here, *UPD means, The file is opened for update operations. The Updates to File can be done in the following programs(Like, RPGLE).
I guess, you will be able to get better idea if you can observe all the Possible vaues for OPTION.
*ALL
Open the file for all operations (*INP, *OUT, *UPD,*DLT).
*INP
Open the file for input. *INP is the only value allowed if join processing or group processing is requested, if UNIQUEKEY processing is specified, if all the fields in the open query file record format specified for the Format specifications (FORMAT) parameter are for input-only use, or if a temporary file is required to run the query.
*OUT
Open the file for output. In some high-level languages, output to certain files (such as files defined as ‘direct access’ in the high-level language program) is done by using a combination of input and update operations. *UPD and *INP are specified, or *ALL is specified, in order to use an open query file with Such a program.
*UPD
Open the file for update operations. If an input operation comes before an update, you must specify *INP when *UPD is specified.
*DLT
Open the file for delete operations. If a delete operation is preceded by an input operation, you must specify *INP when *DLT is specified.
Pradeep.