× 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.



Hi Jay,

I didn't see any  answer to Rob's question - what is the goal?

In CL, the usual thing I've seen is, attempt to remove the library from the library list, then add it at the end.  If the RMVLIBLE causes an error, ignore it, e.g.

 RMVLIBLE LIB(MyLib)
 MONMSG CPF0000
 ADDLIBLE LIB(MyLib) POSITION(*LAST)

If that's the goal, then using Rob's formatting, this should do it:

Myproc: BEGIN

BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '38501' BEGIN END; -- ignore error
CALL QSYS2.QCMDEXC('RMVLIBLE LIB(myLib)');
END;

CALL QSYS2.QCMDEXC('ADDLIBLE LIB(myLib) POSITION(*LAST)');

END Myproc;


I'm new to SQL procedures too, so my use of BEGIN/END to limit the CONTINUE handler to just the RMVLIBLE command may not be correct.

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx /



On 8/24/2022 6:04 AM, Rob Berendt wrote:
What is the goal? To ensure that not only is MYLIB in the library list, but it's the last entry in the library list?
If it's already in the library list remove it and ensure that it's at the end?

Normally the logic in an all CL situation is I just want to be able to use the objects in the library so I:
Try to add the library to the library list
Do my process
If I added the library to the library list just to do my process then remove it now. If it was already there then leave it there.

RMVLIBLE may not always remove a library from your library list. For example if it is your CURRENT library.


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.