C*	QXNXE	- GET NEXT ENTRY IN SPRQUEUE.SYS LIST
C
	SUBROUTINE QXNXE (LEOL)
C
C  QXNXE WILL MOVE THE NEXT ENTRY TO THE ARRAY 'IENT(0:15)' SO THE
C  OFFSETS IN QXCM.COM WILL BE DIRECTLY APPLICABLE.  IF THE LAST
C  ENTRY WAS A CONCATENATED HEADER, THE NEXT ENTRY WILL BE THE START
C  OF THE SUBQUEUE ASSOCIATED WITH THAT HEADER.
C
C  NEXTAD	= ADDRESS OF NEXT ELEMENT IN QUEUE (IN COMMON)
C  	  	  THIS IS USED AS AN INDEX INTO ISPRQU
C  LEOL		= END OF LIST, TRUE=YES, FALSE=NO
C
	INCLUDE 'QXCM.COM/NOLIST'
C
	LBTON(IBIT) = IAND(IBIT,IENT(QFOCO/2)) .NE. 0
C
C  CHECK 'NEXTAD' FOR 0, INDICATING END OF LIST. POP OUT OF SUBQUEUE
C  IF ILEV GREATER THAN 1.
C
 10	CONTINUE
	IF (NEXTAD .GT. 0) GO TO 100
	ILEV = ILEV - 1
	IF (ILEV .GT. 0) GO TO 50
	LEOL = .TRUE.
	GO TO 400
C
C  POP OUT OF SUBQUEUE
C
 50	CONTINUE
	NEXTAD = NEXTSV
	GO TO 10
C
C  OK, GO RETREIVE THE ENTRY
C
 100	CONTINUE
	NR = NEXTAD/2 + 1
	CALL X1DR (SPRID, NR, 16, IENT)
C
C	CHECK /OW SWITCH, IF WE'RE NOT THE OWNER, GO ON TO THE NEXT ENTRY
C
	IF (LSWOW.AND.IENT(QUIC/2).EQ.IDFUIC .OR. .NOT.LSWOW) GO TO 250
	NEXTAD = IENT(QLINK/2)
	GO TO 10
C
 250	CONTINUE
	LEOL = .FALSE.
	LEMPTY = .FALSE.
C
C  GET NEW NEXTAD, IF CONCATENATED HEADER, PUSH DOWN ILEV AND SAVE
C  THE QLINK, SINCE WE'RE GOING TO RUN DOWN A SUBQUEUE
C
	IF (LBTON(QFCH)) GO TO 200
C
C	IF IN THE ACTIVE LIST AND THE ENTRY INDICATES IT'S PART OF A
C	CONCATENATED LIST, CHASE DOWN THE REMAINING ENTRIES IN THE LIST
C	POINTED TO BY THIS RECORD.
C	WE'LL CHECK IF WE'RE STILL IN THE SUB-QUEUE BY CHECKIN ILEV. IT
C	IT'S  EQUAL TO 2 THEN WE'RE STILL IN THE SUB-QUEUE.
C
	IF (LACT .AND. LBTON(QFCN) .AND. ILEV.NE.2) GO TO 300
	NEXTAD = IENT(QLINK/2)
	GO TO 400
C
C  FOR CONCATENATED HEADER
C
 200	CONTINUE
	NEXTAD = IENT(QCLNK/2)
	GO TO 350
C
C	FOR  ACTIVE LIST WITH CONCATENATED ENTRY -
C	NOTE THAT THE ACTIVE ENTRY'S SEQUENCE # POINTS TO THE NEXT CHAINED
C	ENTRY, AND THAT SUCESSIVE ENTRY'S SEQUENCE #'S POINT BACK TO THE
C	ORIGINAL CONCATENATED HEADER ENTRY!
C
 300	CONTINUE
	NEXTAD = IENT(QSEQ/2)
C
C	COMMON FOR CONCATENATED 'LIST' HEADS
C
 350	CONTINUE
	NEXTSV = IENT(QLINK/2)
	ILEV = ILEV + 1
	LHEADR = .TRUE.
	IF (LBTON(QFCE)) NEXTAD = 0		! CONCATENATED END RECORD
	GO TO 400
 400	CONTINUE
	RETURN
	END
