The following code gets process data associated with the
first relative process (PROCTOK=0) to which the caller
is authorized access (by the security access facility). For the callable
service, see
w_getpsent (BPX1GPS) — Get process data.
For the data structure, see
BPXYPGPS — Map the response structure for w_getpsent.
LA R15,PGPS Getmain area mapped by BPXYPGPS
ST R15,PGPSA Hold pointer to this area
XC PROCTOK,PROCTOK First relative process (Zero)
LA R2,PGPSCONTTYBUF Controlling TTY ->buffer
ST R2,PGPSCONTTYPTR Store into PGPS
MVC PGPSCONTTYBLEN,=A(L'PGPSCONTTYBUF) Length
LA R2,PGPSPATHBUF Pathname ->buffer
ST R2,PGPSPATHPTR Store into PGPS
MVC PGPSPATHBLEN,=A(L'PGPSPATHBUF) Length
LA R2,PGPSCMDBUF Command ->buffer
ST R2,PGPSCMDPTR Store into PGPS
MVC PGPSCMDBLEN,=A(L'PGPSCMDBUF) Length
SPACE ,
CALL BPX1GPS, Get process data +
(PROCTOK, Input: Relative process token +
PGPSL, Input: Length of buffer needed +
PGPSA, I/O: ->Buffer, mapped by BPXYPGPS +
RETVAL, Return value: -1, 0, next proctok +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------
SPACE ,
ICM R15,B'1111',RETVAL Test Return value: 0 or -1
ST R15,PROCTOK The next relative process token
BZ PSEUDO RETVAL = 0, end of file
BM PSEUDO RETVAL < 0, error
BP PSEUDO RETVAL > 0, next logical process