I have a COBOL mainline which calls a PASCAL subroutine to give me as much info as possible on a session (AIFJSGET). I use the AIFJSGET intrinsic as it gives me much more needed info than the JOBINFO intrinsic. AIFJSGET works fine. It gives me back the info: error code, session number, JSMAIN pin no, CI pin no, returned job session id/number. Here is the mainline code: M100-LOAD-INVITEES. CALL INTRINSIC "GETPRIVMODE". PERFORM VARYING WS-JS-NUM FROM 1 BY 1 UNTIL WS-JS-NUM > WS-MAX-SESSIONS INITIALIZE WS-ERROR-CODE-DOUBLE INITIALIZE WS-PIN-NO INITIALIZE WS-JSMAIN-PIN-NO INITIALIZE WS-CI-PIN-NO INITIALIZE WS-QUIET-MODE INITIALIZE WS-JOB-NUMBER MOVE 1 TO WS-JS-IND CALL "get_js_data" USING WS-ERROR-CODE-DOUBLE, WS-PIN-NO, WS-JSMAIN-PIN-NO, WS-CI-PIN-NO, WS-QUIET-MODE, WS-JS-IND, WS-JS-NUM WS-JOB-NUMBER END-CALL DISPLAY "error code=>" WS-ECD-1 ">" DISPLAY "js ind =>" WS-JS-IND ">" DISPLAY "job number=>" WS-JS-NUM ">" DISPLAY "jsmain pin=>" WS-JSMAIN-PIN-NO ">" DISPLAY "ci pin no =>" WS-CI-PIN-NO ">" DISPLAY "returned jno-1=>" WS-JN-1 ">" DISPLAY "returned jno-2=>" WS-JN-2 "<" display "****************" END-PERFORM. CALL INTRINSIC "GETUSERMODE". GO TO M100-EXIT. M100-EXIT. EXIT. Here's the run time results: error code=>+0000> js ind =>+0001> job number=>+000000001> jsmain pin=>+000000045> ci pin no =>+000000035> returned jno-1=>+6385> returned jno-2=>+0000< **************** error code=>+0000> js ind =>+0001> job number=>+000000002> jsmain pin=>+000000038> ci pin no =>+000000070> returned jno-1=>+6386> returned jno-2=>+0000< **************** error code=>+0000> js ind =>+0001> job number=>+000000003> jsmain pin=>+000000068> ci pin no =>+000000080> returned jno-1=>+6387> returned jno-2=>+0000< **************** error code=>+0000> js ind =>+0001> job number=>+000000004> jsmain pin=>+000000069> ci pin no =>+000000092> returned jno-1=>+6388> returned jno-2=>+0000< **************** error code=>-0028> js ind =>+0001> job number=>+000000005> jsmain pin=>+000000000> ci pin no =>+000000000> returned jno-1=>+6389> returned jno-2=>+0000< **************** error code=>-0028> js ind =>+0001> job number=>+000000006> jsmain pin=>+000000000> ci pin no =>+000000000> returned jno-1=>+6390> returned jno-2=>+0000< **************** The error code of zeroes show me the subroutine worked fine, and the error codes of -0028 indicates the job/session number I passed the subroutine does not exist on the system. This is fine. However, I am doing this call to the Pascal subroutine in a COBOL perform loop 16383 times. 16383 is the maximum allowable sessions on my box. *** My question is this: With the use of either a regular MPEiX intrinsic or an AIF intrinsic how can I figure out what the highest session is that is logged on the box without having to do this Perform loop 16383 times? If I can figure out this max count (n) I can do the PERFORM (n) times and not have to do it 16383 times to make sure I have captured all active sessions. Here is a SHOWJOB example of all sessions logged on the box: JOBNUM STATE IPRI JIN JLIST JOBQ INTRODUCED JOB NAME #S1 EXEC 20 20 SAT 3:43P BRIAN,MANAGER.SYS #S2 EXEC QUIET 8 8 SAT 3:44P BRIAN,MGR.E3K #S3 EXEC 9 9 SAT 3:44P TINA,MGR.E3K #S4 EXEC 11 11 SAT 6:59P BRIANWT,MANAGER.SYS 4 JOBS (DISPLAYED): 0 INTRO 0 WAIT; INCL 0 DEFERRED 4 EXEC; INCL 4 SESSIONS 0 SUSP JOBFENCE= 3; JLIMIT= 10; SLIMIT= 10 Hope someone can give me an answer to this one. TIA, Brian Donaldson. * To join/leave the list, search archives, change list settings, * * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *