Hi Steve
The field CGGRPNM that you've used represents the list of connect groups, so it can (and probably) will contain more than one entry. This is referred to as a repeat field. The SELECT command (SELECT CGGRPNM=(@ADJPAY,@DDE)) selects the entire user profile if the user is connected to either @ADJPAY or to @DDE, including the list of all connect groups.
If you wanted to prune down the list of connect groups for a selected user, you would have to use the DEFINE SUBSELECT command, like so:
newlist type=racf
define onlyDDEgroups subselect connects(group=@dde@*)
define onlyADJgroups subselect connects(group=@adj*)
SELECT S=BASE C=USER CGGRPNM=(@ADJPAY,@DDE)
sortlist profile(8,"Userid") onlyDDEgroups(8) onlyADJgroups(8)
Unfortunately, you cannot apply PARSE or SUBSTR to the result of SUBSELECT, so you're stuck with the whole 8 character group name, or left aligned truncation.
Now, if you print the CGGRPNM field, or a defined field based on CGGRPNM (like your ADJPAY and DDE fields), the result is a stack of values. CARLa offers a modifier to show only the first value of the repeat field: FIRSTONLY.
Also, CARLA has a SORT modifier that can be used on repeat fields, it works on the internal value of the field. I do not remember if a defined field with PARSE stores the parse output as an internal value, or if it re-calculates this for the SELECT command and again for the SORTLIST command, but you can try.
newlist type=racf
DEFINE ADJPAY AS PARSE(CGGRPNM,'@ADJ',' ') WHERE CLASS=USER
DEFINE DDE AS PARSE(CGGRPNM,'@DDE@',' ') WHERE CLASS=USER
SELECT S=BASE C=USER CGGRPNM=(@ADJPAY,@DDE)
sortlist profile(8,"Userid") adjpay(sort(descending),firstonly) dde(sort(descending),firstonly)
Sorry, you'll have to test this yourself, I no longer have access to a z/OS.
------------------------------
Rob van Hoboken
------------------------------