GETPUT	MACRO M1110  22-AUG-78 02:35  PAGE 1





      1						.TITLE	GETPUT

      2						.IDENT	/01/

      3					;

      4					; COPYRIGHT (C) 1976

      5					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      6					;

      7					; THIS SOFTWARE IS FURNISHED UNDER  A LICENSE FOR USE ONLY  ON  A

      8					; SINGLE COMPUTER SYSTEM AND MAY BE  COPIED ONLY WITH  THE INCLU-

      9					; SION OF  THE  ABOVE  COPYRIGHT NOTICE.  THIS SOFTWARE,  OR  ANY

     10					; OTHER COPIES THEREOF, MAY NOT BE  PROVIDED  OR  OTHERWISE  MADE

     11					; AVAILABLE TO ANY OTHER PERSON EXCEPT  FOR  USE  ON  SUCH SYSTEM

     12					; AND TO  ONE WHO AGREES  TO  THESE LICENSE  TERMS.  TITLE TO AND

     13					; OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

     14					;

     15					; THE INFORMATION IN THIS SOFTWARE  IS  SUBJECT TO CHANGE WITHOUT

     16					; NOTICE AND SHOULD NOT BE CONSTRUED  AS  A COMMITMENT BY DIGITAL

     17					; EQUIPMENT CORPORATION.

     18					;

     19					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS

     20					; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     21					;

     22					; VERSION 01

     23					;

     24					; K. D. MORSE 1-AUG-76

     25					;

     26					; MACRO LIBRARY CALLS

     27					;

     28						.MCALL GCML$,GCMLB$,CSI$1,CSI$2,CSI$,CSI$SW,CSI$ND

     29						.MCALL OPEN$R,OPEN$W,FDAT$R,CLOSE$,DELET$,PRINT$,GET$,PUT$

     30						.MCALL WAIT$,READ$,WRITE$

GETPUT	MACRO M1110  22-AUG-78 02:35  PAGE 2





     32					;+

     33					;**-GETREC/PUTREC-READ/WRITE A RECORD

     34					;

     35					; THESE ROUTINES ARE USED TO DO I/O TO FILES OPENED BY THE MACRO

     36					; ROUTINE OPNFIL.  THE I/O BUFFER SERVES AS AN INPUT BUFFER TO HOLD THE

     37					; RECORD BEING READ OR ALTERNATELY, AS AN OUTPUT BUFFER CONTAINING THE

     38					; LINE TO BE WRITTEN.  ERROR CODES ARE RETURNED IF THE READ/WRITE FAILS.

     39					;

     40					; INPUTS:

     41					;

     42					;	2(R5) IS THE ADDRESS OF THE LUN

     43					;	4(R5) IS THE ADDRESS OF THE I/O BUFFER

     44					;	6(R5) IS THE ADDRESS OF THE SIZE OF THE I/O BUFFER

     45					;	10(R5) IS THE ADDRESS OF THE LENGTH OF THE DATA TO BE WRITTEN

     46					;	12(R5) IS THE ADDRESS OF THE SUCCESS/ERROR CODE

     47					;

     48					; OUTPUTS:

     49					;

     50					;	@12(R5) IS ONE OF THE FOLLOWING:

     51					;		>0 = SUCCESSFUL I/O ON THIS LUN

     52					;		 0 = EOF

     53					;		-1 = UNABLE TO READ AS FILE NOT OPEN

     54					;		-2 = UNABLE TO READ AS RECORD LARGER THAN BUFFER

     55					;		-3 = UNABLE TO READ DUE TO SYSTEM ERROR CODE

     56					;		-4 = UNABLE TO WRITE AS FILE NOT OPEN

     57					;		-5 = UNABLE TO WRITE TO FILE DUE TO SYSTEM ERROR CODE

     58					;	@4(R5) IS THE SYSTEM ERROR CODE FOR ERRORS -3 AND -5

     59					;	@10(R5) IS THE SIZE OF THE RECORD FOR ERROR CODE = -2

     60					;

     61					;-

     62						.ENABL	LSB

     63	000000	012775 	000001 	000012 	GETREC:: MOV	#1,@12(R5)	;ASSUME SUCCESS

     64	000006	004767 	000000G			CALL LUNFDB		;GET ADDRESS OF FDB FOR THIS LUN

     65	000012	103435 				BCS	90$		;ERROR, FILE NOT OPEN

     66	000014					GET$	R0,4(R5),@6(R5) ;READ A RECORD

     67	000034	103427 				BCS	91$		;ERROR

     68	000036	016075 	000000G	000010 		MOV	F.NRBD(R0),@10(R5) ;GET LENGTH OF RECORD

     69	000044	000466 				BR	100$		;RETURN

     70	000046	012775 	000001 	000012 	PUTREC:: MOV	#1,@12(R5)	;ASSUME SUCCESS

     71	000054	004767 	000000G			CALL LUNFDB		;GET ADDRESS OF FDB FOR THIS LUN

     72	000060	103434 				BCS	92$		;ERROR, FILE NOT OPEN

     73	000062					PUT$	R0,4(R5),@10(R5) ;WRITE A RECORD

     74	000102	103427 				BCS	93$		;ERROR

     75	000104	000446 				BR	100$		;RETURN

     76					;

     77					; ERROR CODES

     78					;

     79	000106	005475 	000012 		90$:	NEG	@12(R5)	;ERROR, FILE NOT OPEN, UNABLE TO READ

     80	000112	000443 				BR	100$		;RETURN

     81	000114	122760 	177766 	000000G	91$:	CMPB	#-10.,F.ERR(R0) ;EOF?

     82	000122	001426 				BEQ	94$		;YES, RETURN LUN=0

     83	000124	122760 	177730 	000000G		CMPB	#-40.,F.ERR(R0)	;IS RECORD TOO LARGE FOR BUFFER?

     84	000132	001025 				BNE	95$		;NO, BRANCH

     85	000134	012775 	177776 	000012 		MOV	#-2,@12(R5)	;ERROR, RECORD TOO LARGE FOR BUFFER

     86	000142	016075 	000000G	000010 		MOV	F.NRBD(R0),@10(R5) ;GET RECORD LENGTH

     87	000150	000424 				BR	100$		;RETURN

     88	000152	012775 	177774 	000012 	92$:	MOV	#-4,@12(R5)	;ERROR, FILE NOT OPEN, UNABLE TO WRITE

GETPUT	MACRO M1110  22-AUG-78 02:35  PAGE 2-1





     89	000160	000420 				BR	100$		;RETURN

     90	000162	012775 	177773 	000012 	93$:	MOV	#-5,@12(R5)	;ERROR, UNABLE TO WRITE

     91	000170	116075 	000000G	000004 		MOVB	F.ERR(R0),@4(R5) ;GET SYSTEM ERROR CODE

     92	000176	000411 				BR	100$		;RETURN

     93	000200	005075 	000012 		94$:	CLR	@12(R5)		;EOF

     94	000204	000406 				BR	100$		;RETURN

     95	000206	012775 	177775 	000012 	95$:	MOV	#-3,@12(R5)	;ERROR, UNABLE TO READ

     96	000214	116075 	000000G	000004 		MOVB	F.ERR(R0),@4(R5) ;GET SYSTEM ERROR CODE

     97	000222	000207 			100$:	RETURN			;RETURN

     98						.DSABL	LSB

     99		000001 				.END

GETPUT	MACRO M1110  22-AUG-78 02:35  PAGE 2-2

SYMBOL TABLE



F.ERR = ****** GX	F.URBD= ****** GX	LUNFDB= ****** GX	PUTREC  000046RG 	.PUT  = ****** G

F.NRBD= ****** GX	GETREC  000000RG 	PAR$$$= 000000   	.GET  = ****** G



. ABS.	000000	   000

      	000224	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  3726 WORDS  ( 15 PAGES)

DYNAMIC MEMORY:  4884 WORDS  ( 18 PAGES)

ELAPSED TIME:  00:00:06

OBJ$:GETPUT,LIS$:GETPUT/-SP=SRC$:GETPUT

