	.title	DISCQ  CONNECT MESSAGE ID QUEUE TO TASK
	.IDENT	/1.0/
;.begin.doc ************************** begin.doc
;  
; .c ;MODULE
; .c ;^&DISCQ\&
; .nf
; .x DISCQ>Defined
; Source:DISCQ.MAC
; TO BECOME PART OF LIBRARY:QUEUE.OLB
; Designer           :EARL LAKIA
; Author             :EARL LAKIA
;             Inland Steel
;             Process Automation Department
;             3210 Watling St.  MS 2-465
;             East Chicago, IN  46312
;  
; Date of last update: 15-DEC-86
; Revision level     :1.0
;  
; .C ;Formal Parameter List
; Receives:
;  
;    LUN                        INTEGER*2
;                               LOGICAL UNIT NUMBER ASSIGNED TO ZQ1:
;     
;  
; Returns:
;  
;    DISCQ                      INTEGER*2                               
;                               FUNCTION VALUE RETURN STATUS OF THE 
;                               CONNECT
;  
; Accesses common(s):
;  
; Accesses file(s):
;  
; Other modules referenced:
; .SK
; .fill
; .SK
; Description:
; .sk    
; 	This subroutine cancels the outstanding I/O normally
; set up by the INITQ subroutine.   This subroutine
; need not be called if the user doesn't mind the message:
; "Task exit with outstanding I/O".
;
; .x DISCQ>Referenced
; .sk
; .tp 40
; .nofill
; 	INTEGER*2 STATUS     ! RETURN STATUS
; 	BYTE STATB(2)
; 	EQUIVALENCE(STATUS,STATB) ! BYTE ADDRESSABLE STATUS
; 	INTEGER*2 LUN	     ! LUN ASSIGNED TO ZQ0:
;       INTEGER*2 QUESUC     ! SUCCESSFUL QUEUE STATUS
; C
;       DATA LUN/1/	     ! LOGICAL UNIT NUMBER
;       DATA QUESUC/1/	      
; C
; C
; C ASSIGN A LUN TO THE PSEUDO DEVICE FOR THE QUEUE
; C
; 	CALL ASSIGN(LUN,'ZQ0:')
; C
; 	STATUS=INITQ(LUN)
; C
; 	IF(STATUS .NE. QUESUC)THEN
; 		TYPE *,' BAD QUEUE  STATUS ON INIT'
; 		TYPE *,' DIRECTIVE STATUS: ',STATB(1)
; 		CALL EXIT
; 	ELSE
; 		TYPE *,' INIT SUCCESSFUL'
; 	ENDIF
; 
;    **** ACCESS THE QUEUE *******
; 
; 	STATUS=DISCQ(LUN)  ! NO NEED TO TEST STATUS, IF IT
; 			! FAILS, THEN NOTHING ELSE TO DO ANYWAY
; .FILL
; .SK
; 	Possible error codes:
; .LIST 1,' '
; .le;Bad directive status (possibly device not mounted, etc.)
; (upper byte will be zero)
; .els
; end.doc ****************************** end.doc  
	.PAGE
	.MCALL	DIR$
	.MCALL	QIO$
;
;	 0(R5)= NUMBER OF ARGUMENTS
;	 2(R5)= LUN
;
; 	STATUS=DISCQ(LUN)
;
;
	.PSECT	Q$CODE,RO,I,CON
DISCQ::
	CMP	#1,(R5)+	; CORRECT NUMBER OF ARGUMENTS
	BEQ	10$		; YES
	TRAP	<128.+80.>	; FORTRAN OTS TRAP FOR ILLEGAL NUMBER
				; OF ARGUMENTS
	RETURN
10$:
	MOVB	@(R5)+,DOIO+Q.IOLU	; GET LOGICAL UNIT NUMBER
;
; NOW DO THE QIO 
;
	DIR$	#DOIO		; DO THE I/O
	MOVB	$DSW,R0		; SIGN EXTEND BAD DIRECTIVE STATUS
	RETURN
	.PAGE
	.PSECT	Q$DATA,RW,CON,D
;
DOIO:
	QIO$	IO.KIL,,,,,,
	.END
