The total length of CMDBUFD is CMDBUFL.
Since this is a command buffer, you don't know if it was cleaned up or if the
command syntax was verified. I personally would not assume anything. The length
may not always be X'F8'. You don't know if CONNECT begins at offset 0. Is CONN a
short form of the CONNECT verb? Are operands separated by more than 1 blank? Can
they be seperated by comma's? Is a blank after the "(" required? Did RACF
validate the syntax before your exit received it?
CMDBUFO get's you to the first blank after the verb.
I personally use the TRT (combined with the EX instruction) to find the begin
and end of arguments. You could get a little more tricky if you wanted to use
offsets instead of just finding characters but that's a more advanced technique
I don't want to explain here. I just thru together the following to show how you
could use TRT to parse it: Don't trust this because it was just quickly thrown
together but it shows you how it could be coded..
LAR4,CMDBUFDStart of command buffer
AHR4,CMDBUFOAfter command verb
SRR4,R40
ICMR5,3,CMDBUFLLength
SHR5,CMDBUFOMinus command verb
* Find start of user field
#TRT0(R4),(R5),TRTBEGIN,NOTFOUND=ERR001 userid missing
SR R1,R4offset to start
ARR4,R1 Start of userid
SRR5,R1 Adjust length
* Handle list of userids
CLI0(R1),C'(' Is this a list of userid's?
BNEMAIN100 No, definitely single user
OIFLAG,CHKPAREN For later
LA R4,1(R4) Past paren
AHI R5,-1 Adjust length
BZ ERR001 Userid missing
#TRT0(R4),(R5),TRTBEGIN,NOTFOUND=ERR001 Userid missing
SR R1,R4offset to start
ARR4,R1 Skip to userid
SRR5,R1 Adjust length
MAIN100 EQU *
* Find end of userid
#TRT0(R4),(R5),TRTEND,NOTFOUND=ERR002 Missing args
SRR1,R4Length of userid
CHI R1,L'USERIDIs userid too large?
BHERR003 Yes,
* Copy userid
XC USERID,USERID Clear userid
#EX (R1),'MVC USERID(0),0(R4)' Copy the userid from command buffer
ARR4,R1 After userid
SRR5,R1 Adjust length
----- process userid -----
* Find next arg
#TRT0(R4),(R5),TRTBEGIN,NOTFOUND=ERR002 Missing args
SR R1,R4offset to start
ARR4,R1 Start of next field
SRR5,R1 Adjust length
*
TMFLAG,CHKPAREN Is there a list of userid's?
BZMAINxxx No, all done
CLI0(R4),C')' Close paren?
BEMAINxxx Yes, no more userid's in list
BMAIN100 Process next userid in list
TRTBEGIN DC 256AL1(*-TRTBEGIN)
ORG TRTBEGIN+C' '
DC X'00' Ignore blanks
ORG TRTBEGIN+X'00'
DC X'00' Ignore nulls (TRTBEGIN
actually has this)
ORG ,
TRTEND DC 256AL1(0)
ORG TRTEND+X'00'
DC C' ' Stop at nulls
ORG TRTEND+C' '
DC C' ' Stop at blanks
ORG C')'
DC C')' Stop at close paren
ORG ,
You'll need to create a #TRT macro to allow TRT with a larger size than 256
bytes. #EX is a macro that adjusts the length relative to 0 and issues the EX
instruction against the instruction passed in SYSLIST(2).
Jon Perryman
----- Original Message ----
> From: Scott Ford <[email protected]>
> I have a field in a RACF parameter list ...CMDBUFL ..this is the length of
> the
>command buffer.
> It looks like it is x'F8' which is 248 ..bytes. I need to calculate the
> total
>length of CMDBUFD which is
> the incoming buffer. I have a issue with a large amount of userids being
>passed to our exit..like this
>
> CONNECT (id id id id id id id) GROUP(grpid)
> or
> CONNECT id GROUP(grpid)
>
> I want be able to logically inside me code to decide do i have one id or
>many..
>
> I assume ( i know bad word ):
>
> LA R8,CMDBUFD+7
> LA R7,TEMPUSR
>
> LOOP DS 0H
> CLI 0(r8),C' '
> BNE CHKPAR
> LA R8,1(R8)
> B LOOP
> CHKPAR DS 0H
> CLI 0(R8),C'('
> BE BUMP8
> MOVEIT DS 0H
> CLI 0(R8),C')'
> BE STORID
> MVC 0(1,R7),0(R8)
> LA R7,1(R7)
> LA R8,1(R8)
> B MOVEIT
> STORID DS 0H
> MVC USERID,TEMPUSR
>
>
>
> USERID DS CL8
> TEMPUSR DS CL8
>
> This is fine for this:
>
> CONNECT id GROUP(xxxxxxx)
>
> But with more than one i know I have an issue so i want to address it by
>capturing all the ids..
> I have figured that out ...the length is bugging me. I know i missed
> something
>and need another
> pair of good , younger eyes..