The example given was deceptive not only for the missing DSPUSRPRF OUTPUT(*OUTFILE) which created OUTFILE(routines/userlist), but also for the missing CREATE FUNCTION which defined the SQL qcmdexc() invocation which would be a SQL UDF that passes the input [CL command] string to the QCMDEXC program invoked as a[n optionally created\declared] SQL External Stored Procedure and returns a value [such that if the SELECT is run in a report writer, that value displays on the report].

I prefer to name the UDF with something other than a "Q" prefix, avoiding QCMDEXC, to avoid any confusion that might cause for appearing to be a "system" name. I gave an example for creating a simple and limited-feature User Defined Function named CmdExec in a reply to a Jun 2010 discussion subject "Find source file members":
http://groups.google.com/group/comp.sys.ibm.as400.misc/browse_thread/thread/9d385c8b3d104b9f?fwc=2
http://newsgroups.derkeiler.com/Archive/Comp/comp.sys.ibm.as400.misc/2010-06/msg00023.html

Similar UDF have been given as examples on this list as well.

I personally would never use a UDF like that for DLTUSRPRF, nor typically for any other "destructive" actions. I tended to generate CL or REXX source output to a source member like SJL alluded for those types of operations, and then edit the source member both to review what was generated and optionally to add some other logic like an error handler or perhaps //BCHJOB to make the source a CL batch stream.

Regards, Chuck

On 3/14/11 6:28 AM, McGovern, Sean wrote:
Can you run QCMDEXC through a SELECT statement ?

Rob Berendt on 14 March 2011 13:04 wrote:

No, it's just a file we routinely run DSPUSRPRF's output to.

"McGovern, Sean" on 03/14/2011 06:28 AM wrote:

Is routines/userlist something new at 7.1 ?

Rob Berendt on 09 March 2011 20:46 wrote:

Program? Who needs a stinking program?

SELECT upuprf, upstat, qcmdexc('DLTUSRPRF ' CONCAT UPUPRF)
FROM routines/userlist
WHERE UPSTAT='*DISABLED'

Whether or not doing it this way is a good idea, I'll leave up
to you. (ie, do you really want to delete all disabled user
profiles?)

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.