× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Musselman, Paul wrote:
<<SNIP>>

This is a stripped-down example program. It will work on a single
object at a time, not the entire library-- If you want to fix the
authority for every object you won't have more than one object under
repair at once.

Make a copy of the file QADSPOBJ from QSYS into a work library (I named
this file QAFIXAUTH). The reason you make a copy is because I didn't
and fouled things up once-- I had 2 programs, program A called program
B, and both of them needed to DSPOBJD to an outfile. My habit had been
to DCLF QADSPOBJ then OVRDBF QADSPOBJ to the file I used in that
program. This caused all sorts of fun and frolic when programs A and B
were competing for the file! DON'T DO THIS!!


PGM
DCLF QAFIXAUTH
/* this is a copy of QADSPOBJ from QSYS (output from DSPOBJD) */
DSPOBJD OBJ(YOURLIB/*ALL) OBJTYPE(*FILE) DETAIL(*SERVICE) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/QAFIXAUTH)
/* notice the outfile has the 'right' name but is in QTEMP */
OVRDBF FILE(QAFIXAUTH) TOFILE(QTEMP/QAFIXAUTH) SECURE(*YES)
/* this leaves your original file QAFIXAUTH intact (and empty), +
and uses the copy in QTEMP for its work area */
LOOP:
RCVF
MONMSG MSGID(CPF0000) EXEC(RETURN)
/* optional--> RVKOBJAUT OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) USER(*ALL) AUT(*ALL) */
/* optional--> CHGOBJOWN OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) NEWOWN(YOUROBJOWNR) */
GRTOBJAUT OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) AUTL(YOURAUTL)
GRTOBJAUT OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) USER(*PUBLIC) AUT(*AUTL)
GOTO LOOP


Regarding avoidance of the DCLF QADSPOBJ due to other [utility] programs possibly also using OVRDBF QADSPOBJ, there are IMO, better alternatives to creating a copy of the model file in QSYS. For example, the following two approaches:

1> Since the named file is just a compile-time reference, the DCLF could refer to any /name/ which attempts to be unique from a file name used in any other programs. Then prior to the compile, issue the override of whatever chosen name to the QADSPOBJ file. An override requires fewer resources than creating and even possibly keeping a copy of the model file.

<code>

ovrdbf UtilPgm01 TOFILE(QSYS/QADSPOBJ) OVRSCOPE(*CALLLVL)
crtclpgm util01 /* source below: */

//data
dclf utilpgm01 opnid(*none)
dspobjd qtemp/*all *file *full output(*outfile) +
outfile(qtemp/odfile)
ovrdbf utilpgm01 qtemp/odfile ovrscope(*calllvl)
loop:
rcvf
...
//

</code>

2> Since the override is relevant to the open but not to other processing with the CLP, the override can be performed just before the open and the override can be deleted before any external calls which might have their own override to the same file; i.e. just write the CLP to delete its override immediately after the open. The I\O operates against the open file, such that there is no requirement for the override to remain during RCVF receiving each row [after the first implicitly received]. Not as pretty in CL since the RCVF is the implicit open, versus having any CL command to effect an /open/ separate from the first read. Anyhow, one manner to accomplish this:

<code>

dclf qadspobj opnid(mydspobjd)
dspobjd qtemp/*all *file *full output(*outfile) +
outfile(qtemp/odfile)
ovrdbf qadspobj qtemp/odfile ovrscope(*calllvl) share(*no)
rcvf opnid(mydspobjd)
monmsg cpf0864 exec(goto done) /* leave msg as clue */
dltovr qadspobj lvl(*)
dowhile '1'
/* do something to last received row of DSPOBJD output */
wrkjob option(*opnf) /* dbg: view active rrn */
rcvf opnid(mydspobjd)
monmsg cpf0864 exec(do)
rcvmsg msgtype(*excp) rmv(*yes) msgq(*pgmq) pgmq(*same *)
leave
enddo
enddo
done:
return

</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.