|
Ken:
I guess we're all supposed to be using direct APIs rather than *outfile support
or IBM figures it's easy enough to roll-your-own or they figure a business
partner will supply the feature/function or they have to budget where they
spend their development dollars and not enough customers ask for it or...
Well, okay, I can feel comfortable with their direction whatever their
rationale is; it forced me to learn a lot more APIs sooner than I would have
otherwise. (Plus, I currently get paid by an IBM business partner.)
However, there are plenty of times I agree with your final sentiment.
I'm pasting a CLP that shows a possible approach. It's just a CRTPF, two API
calls and a bunch of CHGVARS, all with minimal comments; but I think it will do
pretty much exactly what you requested. With the addition of some parms to pass
in values that you'll want to change with each run and maybe a command shell,
it'll maybe be useful. By changing a couple things such as which format to
request from the QSYRAUTU API and handling errors, and maybe doing some work on
the minimal CRTPF parameters (possibly creating a "real" externally-described
file) and allowing for adding records rather than replacing them, it might even
become close to production-level.
It ought to compile and work just as it is assuming the profile name "#PRDNGO"
is valid.
Comments are minimal because the documentation for the two APIs covers it all
better than I would, not to mention how big the source would get for this post.
A major limitation is the current size of the list return variable for QSYRAUTU
-- it's set to *char(9999) because it's a CL program. That limits it to only
833 group members for the format being used. (It's _possible_ to get around
this, but there are nasty potential problems.) But once it's seen in CL, it can
be easier to visualize in RPG. Of course, once it's in RPG, writing to a file
is no problem.
If a "real" utility for this isn't submitted by someone else, maybe this will
give you a start.
Tom Liotta
midrange-l-request@midrange.com wrote:
> 8. Retrieving a list of group profile users (Graap, Ken)
>
>Does anyone know of a utility that will convert all the members of a group
>profile to a DB file for processing within a program?
>
>I'm always amazed that DSPUSRPRF USRPRF(#PRDNGO) TYPE(*GRPMBR) won't !!
Source for List Group Members to Outfile:
pgm
/* Basic parms for QSYRAUTU */
dcl &rtnlst *char 9999
dcl &lenrtnprf *char 4
dcl &rtnfdbk *char 16
dcl &prf *char 10 value( '#PRDNGO ' )
/* Basic parms for QLGSORT */
dcl &rcb *char 256
/* Breakdown &rcb */
dcl &lenrcb *char 4
dcl &typreq *char 4
dcl &opts *char 4
dcl &rcdlen *char 4
dcl &rcdcnt *char 4
dcl &offsetklst *char 4
dcl &nbrkey *char 4
dcl &offsetflst *char 4
dcl &nbrf *char 4
dcl &lenkey *char 4
dcl &lennls *char 4
dcl &lenfent *char 4
dcl &keylst *char 20
dcl &outflst *char 38
/* Breakdown &keylst */
dcl &keystr *char 4
dcl &keysiz *char 4
dcl &keytyp *char 4
dcl &keysrt *char 4
dcl &keypos *char 4
/* Misc. */
dcl &errcod *char 8 value( x'0000000000000000' )
dcl &hex0000 *char 4 value( x'00000000' )
/* Create a file for QLGSORT */
crtpf QTEMP/OUTFILE rcdlen( 12 )
monmsg ( cpf0000 )
/* Call QSYRAUTU to return group members */
call QSYRAUTU ( +
&rtnlst +
&lenrtnprf +
&rtnfdbk +
'AUTU0100' +
'*MEMBER ' +
'*FIRST ' +
'1' +
&prf +
&errcod +
)
/* Set &keylst values */
chgvar %bin( &keystr ) ( 1 )
chgvar %bin( &keysiz ) ( 10 )
chgvar %bin( &keytyp ) ( 6 )
chgvar %bin( &keysrt ) ( 1 )
chgvar %bin( &keypos ) ( 0 )
/* Build &keylst */
chgvar &keylst ( +
&keystr *cat +
&keysiz *cat +
&keytyp *cat +
&keysrt *cat +
&keypos +
)
/* Build &outflst */
chgvar &outflst ( +
'OUTFILE ' *cat +
'QTEMP ' *cat +
'OUTFILE ' *cat +
&hex0000 *cat +
&hex0000 +
)
/* Set &rcb values */
chgvar %bin( &lenrcb ) ( 138 )
chgvar %bin( &typreq ) ( 4 )
chgvar %bin( &opts ) ( 0 )
chgvar %bin( &rcdlen ) ( 12 ) /* Length of format AUTU0100 */
chgvar &rcdcnt %sst( &rtnfdbk 9 4 )
chgvar %bin( &offsetklst ) ( 80 )
chgvar %bin( &nbrkey ) ( 1 )
chgvar %bin( &offsetflst ) ( 100 )
chgvar %bin( &nbrf ) ( 1 )
chgvar %bin( &lenkey ) ( 20 )
chgvar %bin( &lennls ) ( 290 ) /* Most systems need this */
chgvar %bin( &lenfent ) ( 38 )
/* Build &rcb */
chgvar &rcb ( +
&lenrcb *cat +
&typreq *cat +
&hex0000 *cat +
&opts *cat +
&rcdlen *cat +
&rcdcnt *cat +
&offsetklst *cat +
&nbrkey *cat +
&hex0000 *cat +
&hex0000 *cat +
&hex0000 *cat +
&offsetflst *cat +
&nbrf *cat +
&lenkey *cat +
&lennls *cat +
&hex0000 *cat +
&lenfent *cat +
&hex0000 *cat +
&hex0000 *cat +
&hex0000 *cat +
&keylst *cat +
&outflst +
)
/* Call QLGSORT to output to outfile */
call QLGSORT ( +
&rcb +
&rtnlst +
' ' +
x'00000000' +
x'00000000' +
&errcod +
)
dmpclpgm
return
endpgm
End Source
--
Tom Liotta
The PowerTech Group, Inc.
19426 68th Avenue South
Kent, WA 98032
Phone 253-872-7788 x313
Fax 253-872-7904
http://www.powertechgroup.com
__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/
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.