|
Chris,
You can use the RTVUSRPRF command to retrieve the current values for GRPPRF
and SUPGRPPRF.
DCL VAR(&GRPPRF) TYPE(*CHAR) LEN(10)
DCL VAR(&SUPGRPPRF) TYPE(*CHAR) LEN(150)
RTVUSRPRF USRPRF(&GRPLIST) GRPPRF(&GRPPRF) SUPGRPPRF(&SUPGRPPRF)
&GRPPRF will contain the group profile or *NONE if no group profile is set.
&SUPGRPPRF will contain the supplemental group profiles (up to 15) or *NONE
if no supplemental group profiles exist.
I've included a modified version of your program below. Give it a shot!
Richard
/* GRANT GROUP PROFILE */
PGM PARM(&USER)
DCLF FILE(MYLIB/GRPLIST)
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
DCL VAR(&GRPPRF) TYPE(*CHAR) LEN(10)
DCL VAR(&SUPGRPPRF) TYPE(*CHAR) LEN(150)
MONMSG MSGID(CPF0000)
/* RECEIVE FILE GRPLIST AND GRANT GROUP PROFILE */
GETREC:
RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDOFFILE))
MONMSG MSGID(CPF4101 CPF0860 CPF4131) EXEC(GOTO +
CMDLBL(EXIT))
RTVUSRPRF USRPRF(&GRPLIST) GRPPRF(&GRPPRF) +
SUPGRPPRF(&SUPGRPPRF)
/* If no current group profile, add it. */
IF COND(&GRPPRF *EQ '*NONE') THEN(DO)
CHGUSRPRF USRPRF(&GRPLIST) GRPPRF(&USER)
GOTO CMDLBL(GETREC)
ENDDO
/* If no supplemental group profiles, add it. */
IF COND(%SST(&SUPGRPPRF 1 5) *EQ '*NONE') THEN(DO)
CHGUSRPRF USRPRF(&GRPLIST) SUPGRPPRF(&USER)
GOTO CMDLBL(GETREC)
ENDDO
/* If 15 supplemental group profiles already there, can't add it! */
/* Possibly send a message, or just ignore the condition? */
IF COND(%SST(&SUPGRPPRF 141 1) *NE ' ') THEN(DO)
????? Can't add supplemental profile (15 already
specified!)
GOTO CMDLBL(GETREC)
ENDDO
/* Add profile to current supplemental profile list. */
CHGVAR VAR(&SUPGRPPRF) +
VALUE(&USER *CAT %SST(&SUPGRPPRF 1 140))
CHGUSRPRF USRPRF(&GRPLIST) SUPGRPPRF(&SUPGRPPRF)
GOTO CMDLBL(GETREC)
ENDOFFILE:
EXIT:
ENDPGM
-----Original Message-----
From: owner-midrange-l@midrange.com
[mailto:owner-midrange-l@midrange.com]On Behalf Of Chris Whisonant
Sent: Wednesday, February 28, 2001 9:23 AM
To: MIDRANGE-L@midrange.com
Subject: Granting another group profile
I need to grant a group profile for some software. I have a short CL
Program to receive the list of users with a parm for the group profile I
wish to add. In the CL I'm first trying to add a supgrpprf and if there is
no group profile it will then add the parm as the group profile. This
works fine if the user already has a group profile and no supgrpprf. But
if there is already one of each, then the original supgrpprf will be
replaced by the parm. Is there a way to add a group profile instead of
overwriting the original one?
For those interested, I have pasted my CLPGM - I'm no programmer by the way.
Thanks for any help,
Chris Whisonant
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.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.