!*! Updated on 25-Jun-93 at 2:29 AM by James A. Jarboe I V; edit time: 0:25:04
!*! Created on 25-Jun-93 at 12:36 AM by James A. Jarboe I V; edit time: 0:01:06
!
! Test for WHERIZ.SBR
!
! Format:
!       XCALL WHERIZ, NAME, COUNT, JOB(array), JOBPRG(array)
!
! Where:
!       NAME = If empty will find and load current Job user name.
!              Can contain FULL or PARTIAL name to find and
!              will return full name.
!
!       COUNT = Before XCALL:
!                       0 = Find all entries (if there)
!                       x = Find only number of x entries (if there).
!
!               After XCALL:
!                       Returns total number of found entries up to
!                       the maximimum defined before call is made.
!
!       JOB(array)  = Job name of entry.
!       JOBPRG(ary) = Job program of entry.
!
map1 NAME,       S, 20          ! User Name (Size minimum must be 20.
map1 COUNT,      F, 6           ! Number of found entries.
map1 JOBS(10),   S, 6           ! Job names of found user.
map1 JOBPRG(10), S, 6           ! Job Program of found user.
map1 i, f                       ! For loop counter.


! First return only one occurance of our name, job and program.
! Note this will find the first entry of our current job name in the job
! table so it may NOT be us running this program on this job.
!
       NAME  = ""              ! Find our name
       COUNT = 1               ! Find only one entry.

       XCALL WHERIZ, NAME, COUNT, JOBS(1), JOBPRG(1)

       ? NAME;" is attached to ";JOBS(1);" running ";JOBPRG(1)
       ?

! Here we set the maximum count to 10 (since our array is maxxed at 10)
! COUNT will return the number of times our name is found and fill
! the arrays with JOBNAM and JOBPRG values for each found entry.
!
       COUNT = 10   ! Find up to ten entries.

       XCALL WHERIZ, NAME, COUNT, JOBS(1), JOBPRG(1)

       ? NAME;" is logged on in ";COUNT;" instances:"

       For i = 1 to COUNT
               ? "    ";JOBS(i);"  ";JOBPRG(i)
       next i

! Here we are looking for "ROBERT SMITH" so we can enter in a full
! or partial name.
!
       COUNT = 10              ! Set max at 10.
       NAME = "ROBERT S"       ! Will find first match of ROBERT S
                               ! And return the full name.

       XCALL WHERIZ, NAME, COUNT, JOBS(1), JOBPRG(1)

       ?
       IF COUNT = 0 goto NONE

       ? NAME;" is logged on in ";COUNT;" instances:"

       For i = 1 to COUNT
               ? "    ";JOBS(i);" running ";JOBPRG(i)
       next i
       ?
OUT:
       END

NONE:   ? COUNT;" instances of ";NAME; " where found."

       END