Solved

Check Group Membership

Posted on 2015-01-30
2
124 Views
Last Modified: 2015-02-02
Is there an easy way to check to see if a user is member of a group within a CL?

I want to check to see if a user is a member of a specific group -- but wasn't sure how exactly to do this.

Any help would be much appreciated.

Thanks!
0
Comment
Question by:Matthew Roessner
2 Comments
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 40580023
Here's a rough example:

DCL &PRIGRP *CHAR 10
DCL &SUPGRP *CHAR 150
DCL &GROUP *CHAR 10 value('QSECOFR')
RTVUSRPRF USRPRF(SOMEUSER) GRPPGM(&GROUP)  SUPGRPPRF(&SUPPLEMENTAL)
IF ((&PRIGRP *EQ &MEMBER) *OR (%SCAN(&GROUP &SUPGRP *NE 0))) THEN DO
...

One note:  &SUPGRP is one big long string containing up to 15 supplemental group profiles.  Each profile starts in a fixed position:  position1, position 11, position 21, etc.  It is technically possible to get a false positive:

Group = 'APR'
Supgrp = 'PROFILE00APROFILE00BPROFILE00C'

%SCAN would find APR in position 10.

So you'll need to get a little fancier in production code: maybe write a little loop that extracts 10 bytes at a time and tests them, or test the position returned by %SCAN to verify that it ends in a "1".
0
 
LVL 1

Author Closing Comment

by:Matthew Roessner
ID: 40583858
Thanks for the direction Gary
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IT certifications are a concrete representation of continual learning on the part of the candidate.  Continual learning is necessary for the long term success of an IT professional, but are IT certifications the right path for you?
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question