|
midrange-l-request@xxxxxxxxxxxx wrote: > 4. wrkobjlck to physical file (Dwayne Allison) > >Is it possible to do a work object lock and send the results to a physical >file? Dwayne: It's not directly possible, AFAIK. However, there are a few techniques that can make it "easier". To start, the List Object Locks (QWCLOBJL) API will provide the list in a user space. Not quite a 'file' but having some attributes that can cut a step or two out. For example, a *USRSPC object can be used as the source object for commands such as CPY, CPYFRMSTMF, CPYFRMIMPF, etc., just as if it were a streamfile object. If the copy started at the first byte of the list in the space and the physical file had a record length equal to the length of a list entry, you'd practically have your result. Unfortunately, I don't have a way off the top of my head for truncating the first couple hundred bytes off of a streamfile through any simple means other than just opening it with Notepad and deleting those positions. Perhaps a QShell utility has the ability? However, there is a way of getting it done in CL, and in HLLs such as RPG. In CL, you can retrieve the offset to the list in the *usrspc and then read the list entries in a simple loop. (In ILE RPG, you'd be better off getting a pointer and then retrieving list entries.) Each list entry can be placed in the input buffer for the Sort (QLGSORT) API and that API can output the entries as records in your PF. (In ILE RPG, you'd simply use the address of the beginning of the list for the input buffer and tell Sort how big the list was. For that, it isn't even necessary to retrieve the entries; just call the Sort API with the proper address.) When the Sort API completes, your PF will have the records. Technically, this can be done in 'not very many' CL commands. An ILE RPG program wouldn't be much different in size/complexity. I'd post a source example, but only have time to mention the possibility. Perhaps during the next day or so...? Tom Liotta
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.