OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 1





      1		000001 				R$$OPF = 1

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 8





						.TITLE	OPFNB 0130S, OPEN FILE ROUTINE

						.IDENT	/0130S/

      2					; ALTERED:

      3					; E. H. MARISON	14-FEB-78 (HANDLE TEMP FILE CREATION WHEN NO DIR ON DEV.)

      4					; E, H. MARISON 19-JAN-78 (INIT F.SEQN TO 0 SO OPEN CAN BE DONE TO REC DEV.)

      5					; E. H. MARISON	8 JUN 77  10:52 ( PROTECT RMS FILES FROM FCS)

      6					; BRIAN O'CONNELL  26 APR 77 11:45

      7					; ANDREW C. GOLDSTEIN  24 MAR 76  11:31

      8					; ALTERED THRU 20-FEB-75 11:15 BY E. MARISON

      9					; ALTERED WED 17-SEP-75 09:03 BY E. MARISON

     10					; ALTERED TUES 28-OCT-75 4:30 BY P.H. LIPMAN

     11					; ALTERED 4-FEB-76 ELLEN R SIMICH

     12					;ALTERED ELLEN R SIMICH 9-APR-76

     13					;ALTERED ELLEN R SIMICH 15-APR-76

     14					;

     15					; COPYRIGHT (C) 1973,1977,1978 DIGITAL EQUIPMENT CORP., MAYNARD MASS.

     16					;

     17					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

     18					; ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSION

     19					; OF DEC'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     20					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     21

     22					; THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

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

     24					; EQUIPMENT CORPORATION.

     25

     26					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

     27					; OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     28					;

     29					; PETER H. LIPMAN 13-JULY-73

     30					;

     31					;+

     32					; OPEN A FILE

     33					; CALLING SEQUENCE:

     34					;	CALL	.OPEN

     35					; INPUTS:

     36					;	R0=FDB

     37					; OUTPUTS:

     38					;	ALL REGISTERS PRESERVED

     39					;	C=0 IF SUCCESSFULL, C=1 IF FAILED TO OPEN, F.ERR SET TO WHY

     40					;	FDB SET UP

     41					; OPERATION:

     42					;	USES THE GET INFORMATION PER LUN DIRECTIVE TO GET THE

     43					; DEVICE NAME AND UNIT NUMBER AND SET UP THE BLOCK SIZE AND

     44					; DEVICE DEPENDENT BITS IN F.RCTL.  INITIALIZES SOME OF THE FDB, AND

     45					; THEN DOES EITHER A PARSE, FIND SEQUENCE ON AN EXISTING FILE OR

     46					; A PARSE, ENTER SEQUENCE ON A NEW FILE.

     47					;  FINALLY THE BLOCK BUFFER IS ALLOCATED,

     48					; THE REST OF THE FDB INITIALIZED, AND THE FILE ACCESSED.

     49					;-

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 9





     51						.IF	EQ,R$$OPF	;NORMAL OPEN

     52					.OPEN::

     53						.SAVR1			; SAVE REGISTERS R1 - R5

     54						.IF	EQ,R$$11M	; RSX11D CODE

     55						.IF	GT,R$$RSL

     56						CLR	-(SP)		; PUT NORMAL OPEN BY FILE NAME FLAG ON STACK

     57						BR	OPCOM		; JOIN COMMON CODE

     58					.OPFNB::

     59						.SAVR1			; SAVE REGISTERS R1 - R5

     60						MOV	PC,-(SP)	; PUT OPEN BY FNB FLAG ON STACK

     61					OPCOM:

     62						.ENDC

     63						.ENDC

     64						.ENDC

     65					;

     66					;

     67						.IF	EQ,R$$OPF-1	;OPEN BY FILE NAME BLOCK

     68						.IF	EQ,R$$11M	; RSX11D CODE

     69						.IF	EQ,R$$RSL

     70					.OPFNB::

     71						.SAVR1			; SAVE REGISTERS R1 - R5

     72						.ENDC

     73						.IFF			; RSX11M CODE

     74	000000				.OPFNB::

     75	000000					.SAVR1

     76						.ENDC

     77						.ENDC

     78					;

     79						.IF	EQ,R$$OPF-2	;OPEN BY FILE ID

     80					.OPFID::

     81						.SAVR1			; SAVE REGISTERS R1 - R5

     82						.ENDC

     83					;

     84	000004	013701 	000000G			MOV	@#.FSRPT,R1	;SEE IF ALLOC CONTROL BLOCK HAS BEEN INITED

     85	000010	001002 				BNE	5$		;BRANCH IF POINTER IS GOOD

     86	000012	000167 	001040 			JMP	NOBUF		;OUT - USER FORGOT FSRSZ$ MACRO

     87	000016	005761 	000102 		5$:	TST	A.DFUI(R1)	;UIC WORD SHOULD BE NON ZERO

     88	000022	001002 				BNE	10$		;BRANCH IF IT IS

     89	000024					CALL	..FINI		;INIT THE FILE SYSTEM

     90	000030				10$:				; REF TAG

     91						.IF	EQ,R$$OPF

     92						.IF	GT,R$$RSL

     93						.IF	EQ,R$$11M	; RSX11D CODE

     94						MOV	(SP)+,R5	; GET OPEN CALL FLAG

     95						.ENDC

     96						.ENDC

     97						.ENDC

     98	000030	005760 	000070 			TST	F.BDB(R0)	; IS FILE ALREADY OPEN?

     99	000034	001402 				BEQ	20$		;BRANCH IF NO

    100	000036	000167 	001002 			JMP	BADOPN		;ALREADY OPEN - ERROR

    101	000042	132760 	177760 	000016 	20$:	BITB	#^C<FD.RWM!FD.RAN!FD.PLC!FD.INS>,F.RACC(R0)

    102	000050	001402 				BEQ	24$		;BRANCH IF LEGAL

    103	000052	000167 	001064 			JMP	BADRAC		;ILLEGAL RECORD ACCESS BITS

    104	000056	132760 	000010 	000043 	24$:	BITB	#FA.CRE,F.FACC(R0) ;IF CREATING NEW FILE

    105	000064	001426 				BEQ	40$

    106	000066	132760 	000001 	000016 		BITB	#FD.RWM,F.RACC(R0) ;IF READ/WRITE MODE

    107	000074	001022 				BNE	40$		;IGNORE RECORD TYPE AND ATTR

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 9-1





    108	000076	132760 	177764 	000001 		BITB	#^C<FD.FTN!FD.CR!FD.BLK>,F.RATT(R0)

    109	000104	001402 				BEQ	26$		;BRANCH IF OK

    110	000106	000167 	001040 			JMP	BADRAT		;ILLEGAL RECORD ATTRIBUTES

    111	000112	116004 	000000 		26$:	MOVB	F.RTYP(R0),R4	; VALIDATE RECORD TYPE

    112	000116	003403 				BLE	31$		; MUST BE R.FIX - R.SEQ INCLUSIVE

    113	000120					ASSUME	R.FIX,1

    114	000120					ASSUME	R.VAR,2

    115	000120					ASSUME	R.SEQ,3

    116	000120	122704 	000003 			CMPB	#R.SEQ,R4

    117	000124	103002 				BHIS	32$		; BRANCH IF OK

    118	000126				31$:				; REF TAG

    119	000126	000167 	001000 			JMP	BADTYP		; NOT AN FCS FILE GET OUT

    120					;

    121	000132					ASSUME	R.FIX,1

    122	000132	005304 			32$:	DEC	R4		;IF NOT FIXED

    123	000134	001402 				BEQ	40$

    124	000136	005060 	000002 			CLR	F.RSIZ(R0)	;INIT LARGEST RECORD IN FILE

    125	000142	012760 	000001 	000052 	40$:	MOV	#1,F.ERR(R0)	;INIT ERROR INDICATION TO SUCCESSFUL

    126	000150	005060 	000100 			CLR	F.SEQN(R0)	; INIT F.SEQN IN CASE DEV IS A REC DEVICE

    127	000154	005060 	000004 			CLR	F.HIBK(R0)	;INIT LAST BLOCK ALLOCATED

    128	000160	005060 	000006 			CLR	F.HIBK+2(R0)

    129	000164	005060 	000010 			CLR	F.EFBK(R0)	;INIT THE END OF FILE BLOCK NO.

    130	000170	012760 	000001 	000012 		MOV	#1,F.EFBK+2(R0)

    131	000176	005060 	000014 			CLR	F.FFBY(R0)	;ZERO THE FIRST FREE BYTE POINTER

    132	000202	005060 	000064 			CLR	F.VBN(R0)	;ZERO THE INITIAL VBN

    133	000206	005060 	000066 			CLR	F.VBN+2(R0)

    134	000212	142760 	177577 	000051 		BICB	#^C<FD.SPL>,F.BKP1(R0) ; CLEAR ALL BUT SPOOL INDCATOR

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 10





    136	000220				OPDIR:				; RESET LOCAL SYMBOL TABLE

    137						.IF	EQ,R$$OPF	;REGULAR OPEN (BY FILE NAME)

    138						.IF	EQ,R$$11M	; RSX11D CODE

    139						.IF	EQ,R$$RSL

    140						CALL	..STFN		;PARSE INTO FNB UNLESS ALREADY SET UP

    141						.ENDC

    142						.IFF			; RSX11M CODE

    143						CALL	..STFN		;PARSE INTO FNB UNLESS ALREADY SET UP

    144						.ENDC

    145						.ENDC

    146					;

    147						.IF	EQ,R$$OPF-1	;OPEN BY FILE NAME BLOCK

    148						.IF	EQ,R$$11M	; RSX11D CODE

    149						.IF	EQ,R$$RSL

    150						MOV	R0,R1

    151						ADD	#F.FNB,R1	;R1=ADDR OF FNB

    152						CALL	..ALUN

    153						.ENDC

    154						.IFF			; RSX11M CODE

    155	000220	010001 				MOV	R0,R1

    156	000222	062701 	000102 			ADD	#F.FNB,R1	;R1=ADDR OF FNB

    157	000226					CALL	..ALUN

    158						.ENDC

    159						.ENDC

    160					;

    161						.IF	EQ,R$$OPF	; RESLBR OPEN  AND OPFNB

    162						.IF	GT,R$$RSL

    163						.IF	EQ,R$$11M	; RSX11D CODE

    164						TST	R5		; TEST CALL FLAG

    165						BNE	5$		; BRANCH IF OPFNB

    166						CALL	..STFN		; PARSE INTO FNB

    167						BR	10$

    168					;

    169					5$:	MOV	R0,R1		; OPFNB SETUP TO CALL ..ALUN

    170						ADD	#F.FNB,R1

    171						CALL	..ALUN

    172					10$:				; REF TAG

    173						.ENDC

    174						.ENDC

    175						.ENDC

    176						.IF	LE,R$$OPF-1 ;OPEN BY NAME OR FNB

    177						.IF	NE,P$$ARS-1	; PARSE DIRECTIVE SUPPORT

    178									; NO

    179						BCS	26$

    180						.IFF

    181									; YES

    182						.IF	EQ,R$$OPF-1	; OPEN BY FNB

    183	000232	103435 				BCS	26$

    184						.IFF			; FULL OPEN

    185					;

    186					; IF ERROR AND ERROR IS NO SUCH FILE (IE DIRECTORY) THEN

    187					; IGNORE ERROR IF WE ARE CREATING A TEMP FILE

    188					;

    189						BCC	15$		; BRANCH IF NO ERROR

    190						CMPB	#IE.NSF,F.ERR(R0)

    191						BNE	26$		; BRANCH IF NOT NO SUCH FILE

    192						BITB	#FA.TMP,F.FACC(R0)

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 10-1





    193						BEQ	26$		; BRANCH IF NOT A TEMP FILE

    194						BITB	#FA.CRE,F.FACC(R0) ;AND

    195						BEQ	26$		; OR WE ARE NOT CREATING ONE

    196						CALL	..ALUN		; ASSIGN THE LUN

    197						BCS	26$		; BRANCH IF DEVICE PROBLEMS

    198						.ENDC

    199						.ENDC

    200	000234				15$:	CALL	OVBFSZ		;USE OVERIDE BUFFER SIZE IF SPECIFIED

    201	000240	005761 	000000 			TST	N.FID(R1)	;IS FILE ID ALREADY SET?

    202	000244	001123 				BNE	80$		;BRANCH IF YES

    203	000246	132760 	000010 	000043 		BITB	#FA.CRE,F.FACC(R0) ;CREATING A NEW FILE?

    204	000254	001004 				BNE	20$		;BRANCH IF YES

    205					; OPENING AN EXISTING FILE

    206	000256					CALL	..FIND

    207	000262	103421 				BCS	26$

    208	000264	000513 				BR	80$

    209

    210					; OPENING A NEW FILE

    211	000266	132760 	000040 	000017 	20$:	BITB	#FD.SQD,F.RCTL(R0) ;IF SEQUENTIAL DEVICE

    212	000274	001431 				BEQ	40$

    213	000276	122760 	000001 	000000 		CMPB	#R.FIX,F.RTYP(R0) ;AND FIXED LENGTH RECORDS

    214	000304	001025 				BNE	40$

    215	000306	016003 	000002 			MOV	F.RSIZ(R0),R3	;CHECK RECORD SIZE

    216					;

    217					; REMOVE THE LOWER BOUNDS CHECK WHEN FCP ENFORCES IT

    218	000312	020327 	000022 			CMP	R3,#18.

    219	000316	103005 				BHIS	30$		;BRANCH IF SIZE IS OK

    220	000320	112760 	177730 	000052 	25$:	MOVB	#IE.RBG,F.ERR(R0)

    221	000326	000167 	000504 		26$:	JMP	BADOP2

    222					;

    223					; CALCULATE NEW BLOCK SIZE. INTEGER MULTIPLE OF RECORD SIZE

    224						.IF	GT,R$$EIS

    225	000332	005004 			30$:	CLR	R4

    226	000334	016005 	000062 			MOV	F.BBFS(R0),R5

    227	000340	071403 				DIV	R3,R4		;R4=RECORDS / BLOCK

    228	000342	001001 				BNE	35$

    229	000344	005204 				INC	R4		;AT LEAST 1

    230	000346	070403 			35$:	MUL	R3,R4

    231						.IFF

    232					30$:	CLR	R5		;START AT 0

    233					35$:	ADD	R3,R5		;NOW ADD IN RECORD SIZE

    234						CMP	R5,F.BBFS(R0)	;OVER LIMIT?

    235						BLO	35$		;NOPE

    236						SUB	R3,R5		;YES, SO CORRECT DOWN

    237						BNE	36$		;NON-ZERO

    238						MOV	R3,R5		;MAKE AT LEAST 1

    239					36$:

    240						.ENDC

    241	000350	010560 	000060 			MOV	R5,F.VBSZ(R0)

    242	000354	010560 	000062 			MOV	R5,F.BBFS(R0)	;STORE NEW BLOCK SIZE

    243					; ISSUE THE QI/O TO CREATE THE NEW FILE

    244	000360				40$:	CALL	..CREA		;CREATE THE NEW FILE

    245	000364	103760 				BCS	26$

    246	000366	132760 	000020 	000043 		BITB	#FA.TMP,F.FACC(R0) ;IF CREATING TEMP FILE

    247	000374	001047 				BNE	80$		;SKIP THE ENTER

    248	000376	005760 	000120 			TST	F.FVER(R0)

    249	000402	001003 				BNE	45$

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 10-2





    250	000404	152760 	000020 	000051 		BISB	#FD.DVR,F.BKP1(R0) ;CREATING DEFAULT VERSION NUMBER

    251	000412				45$:	CALL	..ENTR		;MAKE THE DIRECTORY ENTRY

    252	000416	103036 				BCC	80$		;BRANCH IF NO ERROR FROM ..ENTR

    253					; IF THE ENTER ERROR WAS THAT FILE ALREADY EXISTS BY THAT NAME, THEN DELETE IT

    254	000420	132760 	000100 	000043 		BITB	#FA.NSP,F.FACC(R0) ;SUPERSEDE INHIBITED?

    255	000426	001027 				BNE	60$		;BRANCH IF YES,INDICATE OPEN FAILURE

    256	000430	122760 	177707 	000052 		CMPB	#IE.DUP,F.ERR(R0)

    257	000436	001023 				BNE	60$		;OTHER KIND OF ERROR, REAL ERROR

    258	000440	012760 	000001 	000052 		MOV	#1,F.ERR(R0)	;RESET THE ERROR CONDITION

    259	000446					ASSUME	N.FID,0

    260	000446	011146 				MOV	(R1),-(SP)	;SAVE THE FILE ID

    261	000450	016146 	000002 			MOV	2(R1),-(SP)

    262	000454	016146 	000004 			MOV	4(R1),-(SP)

    263	000460					CALL	..DEL1		;DELETE THE FILE

    264	000464	012661 	000004 			MOV	(SP)+,4(R1)

    265	000470	012661 	000002 			MOV	(SP)+,2(R1)

    266	000474	012611 				MOV	(SP)+,(R1)

    267	000476	103403 				BCS	60$		;BRANCH IF DELETE FAILED

    268	000500					CALL	..ENTR		;REISSUE THE ..ENTR, NOW IT SHOULD WORK

    269	000504	103003 				BCC	80$		;BRANCH IF OK

    270	000506	005002 			60$:	CLR	R2		;DON'T DO A REMOVE WHEN CLEANING UP

    271	000510	000167 	000362 			JMP	BADOP4		;SOME OTHER ERROR THIS TIME

    272						.ENDC

    273					;

    274						.IF	EQ,R$$OPF-2	;OPEN BY FILE ID

    275						MOV	R0,R1

    276						ADD	#F.FNB,R1

    277						CALL	..ALUN

    278						BCC	65$

    279						JMP	BADOP2

    280					65$:	CALL	OVBFSZ		;USE OVERRIDE BUF SIZE IF SPECIFIED

    281						TST	N.FID(R1)	;FILE ID MUST BE NON ZERO

    282						BNE	75$

    283						BITB	#FD.REC,F.RCTL(R0) ;UNLESS RECORD DEVICE

    284						BNE	67$

    285						JMP	NOFID

    286					67$:	INC	N.FID(R1)	;IN WHICH CASE MAKE IT 1

    287					75$:

    288						.ENDC

    289					;

    290	000514				80$:

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 11





    292	000514	132760 	000001 	000016 	OPALOC:	BITB	#FD.RWM,F.RACC(R0) ;READ/WRITE MODE?

    293	000522	001407 				BEQ	10$		;BRANCH IF PUT/GET MODE

    294					; PUT ADDRESS OF SCRATCH I/O STATUS BLOCK IN F.BDB

    295	000524	013760 	000000G	000070 		MOV	@#.FSRPT,F.BDB(R0)

    296	000532	062760 	000044 	000070 		ADD	#A.IOST,F.BDB(R0)

    297	000540	000420 				BR	60$

    298					;

    299					; ALLOCATE BLOCK BUFFER

    300	000542				10$:

    301						.IF	EQ,R$$MBF	;IF NO MULTIPLE BUFFERING

    302	000542	016001 	000062 			MOV	F.BBFS(R0),R1	;R1=BLOCK SIZE FOR THIS DEVICE

    303	000546	010046 				MOV	R0,-(SP)	;SAVE THE FDB ADDRESS

    304	000550	013700 	000000G			MOV	@#.FSRPT,R0	;ALLOCATION CONTROL BLOCK FOR FSR

    305	000554	062701 	000020 			ADD	#S.BFHD,R1	;ADD IN BUFFER HEADER

    306	000560					CALL	$RQCB		;REQUEST A CORE BLOCK

    307	000564	010001 				MOV	R0,R1		;ADDRESS ALLOCATED TO R1

    308	000566	012600 				MOV	(SP)+,R0	;RESTORE FDB FROM STACK

    309	000570	103532 				BCS	NOBUF		;BRANCH IF NO BUFFER SPACE

    310	000572	010160 	000070 			MOV	R1,F.BDB(R0)	;SET UP BUFFER DESCRIPTOR BLOCK POINTER

    311	000576	010161 	000012 			MOV	R1,B.NXBD(R1)	;CHAIN BUFFER TO ITSELF

    312						.ENDC

    313					;

    314						.IF	GT,R$$MBF	;IF MULTIPLE BUFFERING

    315					; ALLOCATE NUMBER OF BUFFERS SPECIFIED IN F.MBCT, AND

    316					; SET UP THE BUFFER RING

    317						MOV	R0,R4		;PRESERVE THE FDB ADDRESS

    318						CLR	R3		;NO BUFFERS ALLOCATED YET

    319						CLR	R5

    320						BISB	F.MBCT(R0),R5	;R5=NO. OF BUFFERS DESIRED

    321						BNE	20$

    322						MOV	@#.FSRPT,R5

    323						MOVB	A.DFBC(R5),R5	;USE DEFAULT NO. OF BUFFERS FROM FSR2

    324					20$:	CLRB	F.MBC1(R0)

    325						CMP	#1,R5		;IF SINGLE BUFFERING

    326						BGE	23$		;DON'T SET READ AHEAD, WRITE BEHIND

    327						BITB	#FD.RAH!FD.WBH,F.MBFG(R0) ;IF USER SET THESE

    328						BNE	23$		;DON'T CHANGE THEM

    329						MOV	#FD.RAH,R1	;DEFAULT TO READ AHEAD IF READ ONLY

    330						BITB	#FA.RD,F.FACC(R0)

    331						BNE	22$

    332						MOV	#FD.WBH,R1	;OTHERWISE USE WRITE BEHIND

    333					22$:	BISB	R1,F.MBFG(R0)

    334					23$:	MOV	@#.FSRPT,R0	;POINTER TO ALOOCATION CONTROL BLOCK

    335						MOV	F.BBFS(R4),R1

    336						ADD	#S.BFHD,R1	;R1=NO. OF BYTES TO ALLOCATES

    337						CALL	$RQCB		;REQUEST A CORE BLOCK

    338						BCS	58$		;BRANCH IF NO MORE MEMORY AVAILABLE

    339						TST	R3		;FIRST BUFFER?

    340						BNE	35$		;BRANCH IF NO

    341						MOV	R0,F.BDB(R4)	;YES, SET UP  F.BDB

    342						BR	47$

    343					35$:	MOV	R0,B.NXBD(R3)	;LINK THE BUFFERS

    344					47$:	MOV	R0,R3

    345						MOV	#1,@R3		;INIT THE BUFFER DESCRIPTOR

    346						MOVB	#BD.FRE,B.BFST(R3) ;NOTE BUFFER AVAILABLE

    347						INCB	F.MBC1(R4)	;COUNT THE BUFFERS ALLOCATED

    348						SOB	R5,23$		;ALLOCATE THE NEXT ONE

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 11-1





    349					58$:	MOV	R4,R0		;RESTORE FDB ADDRESS

    350						TST	R3		;ANY BUFFERS ALLOCATED?

    351						BEQ	NOBUF		;BRANCH IF NO

    352						MOV	F.BDB(R0),B.NXBD(R3) ;CLOSE THE BUF RING

    353						.ENDC

    354					;

    355	000602				60$:	CALL	ACCESS

    356	000606	103526 				BCS	BADOP3

    357	000610	005060 	000034 			CLR	F.RCNM(R0)	;DON'T INIT BEFORE ACCESS

    358	000614	012760 	000001 	000036 		MOV	#1,F.RCNM+2(R0)	;INIT RECORD NUMBER TO 1

    359					;

    360					; SET UP NRBA AND NRBS BASED ON PARTIAL LOCATE MODE OR MOVE MODE

    361	000622	132760 	000001 	000016 		BITB	#FD.RWM,F.RACC(R0) ;READ/WRITE MODE?

    362	000630	001043 				BNE	80$		;BRANCH IF YES

    363	000632	016060 	000020 	000024 		MOV	F.URBD(R0),F.NRBD(R0) ;ASSUME MOVE MODE

    364	000640	016060 	000022 	000026 		MOV	F.URBD+2(R0),F.NRBD+2(R0)

    365	000646	116004 	000000 			MOVB	F.RTYP(R0),R4	; GET RECORD TYPE

    366	000652	001417 				BEQ	65$		; IF UDF REC MAKE R.FIX (FOR COMPAT. WITH PAST)

    367	000654					ASSUME	R.FIX,1

    368	000654					ASSUME	R.VAR,2

    369	000654					ASSUME	R.SEQ,3

    370	000654	122704 	000003 			CMPB	#R.SEQ,R4	; IS THIS AN FCS FILE

    371	000660	101007 				BHI	62$		; YES CONTINUE

    372	000662	103431 				BLO	BADRTY		; NO -- GET OUT

    373	000664	116004 	000101 			MOVB	F.SEQN+1(R0),R4	; MAYBE IF FIXED SIZE = 0 OR 2

    374	000670	001421 				BEQ	75$		; 0 -- OK CONTINUE

    375	000672	122704 	000002 			CMPB	#2,R4

    376	000676	001023 				BNE	BADRTY		; NO -GET OUT

    377					; WE WILL FALL THRU TO 62$ BUT R4 = 2 SO WILL END UP AT 75$

    378					; THIS SAVES ONE WORD. IF YOU DON'T LIKE THIS PUT

    379					; A BR	75$ HERE.

    380

    381	000700				62$:				; REF TAG

    382	000700					ASSUME	R.FIX,1

    383	000700	105304 				DECB	R4

    384	000702	001014 				BNE	75$		;BRANCH IF NOT FIXED

    385	000704	005760 	000002 			TST	F.RSIZ(R0)	;IF FIXED LENGTH SIZE=0

    386	000710	001006 				BNE	70$

    387	000712	112760 	000001 	000000 	65$:	MOVB	#R.FIX,F.RTYP(R0) ;FORCE FIXED LENGTH RECORDS

    388	000720	016060 	000060 	000002 		MOV	F.VBSZ(R0),F.RSIZ(R0) ;USE THE VIRTUAL BLOCK SIZE

    389	000726	016060 	000002 	000024 	70$:	MOV	F.RSIZ(R0),F.NRBD(R0) ;SET NXT REC BUF SIZ TO FIXED SIZE

    390	000734				75$:	CALL	..RTAD		;RETURN ADDRESS FOR NEXT RECORD TO USER

    391	000740	005060 	000100 		80$:	CLR	F.SEQN(R0)	; CLEAN UP F.SEQN AND CLEAR C-BIT

    392	000744					RETURN

    393					;

    394					; CLEAN UP ACCESS FILE WHICH IS NOT AN FCS FILE

    395					;

    396	000746				BADRTY:					; REF TAG

    397	000746					CALL	DEACCS			; DEACCESS FILE

    398	000752	112760 	177725 	000052 		MOVB	#IE.BTP,F.ERR(R0)	; SET ERROR CODE

    399	000760	000426 				BR	BADOP2			; AND GET OUT

    400					;

    401					; SUBROUTINE TO DEACCESS FILE AND WRITE ATTR IF NEEDED

    402					;

    403					; INPUT:	R0 = FDB

    404					; OUTPUTS:	FILE IS DEACCESS

    405					;		F.SEQN(R0) = 0

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 11-2





    406					;

    407	000762	005060 	000100 		DEACCS:	CLR	F.SEQN(R0)		; CLEAN UP F.SEQN

    408	000766					CALL	..IDPB			; INIT DPB

    409	000772	010604 				MOV	SP,R4			; SAVE STACK RESET VALUE

    410	000774	132760 	000001 	000043 		BITB	#FA.RD,F.FACC(R0)	; IS FILE WRITE ACCESSED

    411	001002	001006 				BNE	40$			; NO - GO DEACCESS FILE

    412	001004	005046 				CLR	-(SP)			; BUILD ATTR LIST ON STACK

    413	001006	010046 				MOV	R0,-(SP)		; ATTR ADDR TO LIST

    414	001010	012746 				MOV	(PC)+,-(SP)		; ATTR CODE/SIZE TO LIST

    415	001012	   004 	   016 			.BYTE	HA.UAT,S.FATT

    416	001014	010665 	000002 			MOV	SP,2(R5)		; ADDR OF ATTR LIST TO DPB

    417	001020	010446 			40$:	MOV	R4,-(SP)		; SAVE STACK RESET VALUE

    418	001022	012704 	010000 			MOV	#IO.DAC,R4		; ISSUE DEACCESS QIO

    419	001026					CALL	..QIOW

    420	001032	012606 				MOV	(SP)+,SP		; POP STACK

    421	001034					RETURN

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 12





    423					;

    424						.IF	EQ,R$$OPF-2	;OPEN BY FILE ID

    425					NOBUF:	MOVB	#IE.NBF,F.ERR(R0)	; NO BUFFER SPACE

    426					BADOP3:

    427						.ENDC

    428					;

    429					; ERROR EXITS FROM OPEN

    430	001036				BADOP2:	CALL	..RFDB		;RESET THE FDB, RELEASING BUFFER IF NECESSARY

    431	001042	000403 				BR	BADOP1		;AND EXIT REPORTING AN ERROR CONDITION

    432					; ATTEMPTED TO OPEN ALREADY OPEN FILE

    433	001044	112760 	177713 	000052 	BADOPN:	MOVB	#IE.FOP,F.ERR(R0)

    434	001052	000261 			BADOP1:	SEC

    435	001054					RETURN

    436					; NO FILE ID SPECIFIED TO OPEN BY FILE ID ROUTINE

    437						.IF	EQ,R$$OPF-2	;OPEN BY FILE ID

    438					NOFID:	MOVB	#IE.NFI,F.ERR(R0)

    439						BR	BADOP2

    440						.ENDC

    441						.IF	NE,R$$OPF-2	;OPEN OR OPFNB

    442					;

    443					; NO BUFFER SPACE AVAILABLE FOR THE FILE

    444	001056	112760 	177731 	000052 	NOBUF:	MOVB	#IE.NBF,F.ERR(R0)

    445					;

    446					; MARK FOR DELETE IF CREATING NEW FILE

    447	001064	132760 	000010 	000043 	BADOP3:	BITB	#FA.CRE,F.FACC(R0)

    448	001072	001761 				BEQ	BADOP2		;BRANCH IF EXISTING FILE

    449	001074	010702 				MOV	PC,R2		;REMOVE FROM DIR. IF R2 IS NOT ZERO

    450	001076	116046 	000052 		BADOP4:	MOVB	F.ERR(R0),-(SP)	;SAVE ERROR CODE

    451	001102	010001 				MOV	R0,R1

    452	001104	062701 	000102 			ADD	#F.FNB,R1

    453	001110	005702 				TST	R2

    454	001112	001402 				BEQ	10$

    455	001114					CALL	..RMOV		;REMOVE FROM DIRECTORY

    456	001120				10$:	CALL	..MKDL		;DELETE THE EMBRYONIC FILE

    457	001124	112660 	000052 			MOVB	(SP)+,F.ERR(R0)	;RESTORE ERROR CODE

    458	001130	000742 				BR	BADOP2

    459						.ENDC

    460					;

    461					; ILLEGAL RECORD TYPE

    462	001132	112760 	177725 	000052 	BADTYP:	MOVB	#IE.BTP,F.ERR(R0)

    463	001140	000744 				BR	BADOP1

    464					; ILLEGAL RECORD ACCESS CODE - UNUSED BITS MUST BE ZERO

    465	001142	112760 	177724 	000052 	BADRAC:	MOVB	#IE.RAC,F.ERR(R0)

    466	001150	000740 				BR	BADOP1

    467					; ILLEGAL RECORD ATTRIBUTES BITS SET - UNDEFINED BITS MUST BE ZERO

    468	001152	112760 	177723 	000052 	BADRAT:	MOVB	#IE.RAT,F.ERR(R0)

    469	001160	000734 				BR	BADOP1

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 13





    471					;+

    472					; ACCESS THE FILE

    473					; CALLING SEQUENCE:

    474					;	CALL	ACCESS

    475					; INPUTS:

    476					;	R0=FDB

    477					;	F.VBN,F.VBN+2=0

    478					;	F.SHAR,F.STBK SET UP AS APPROPRIATE

    479					;

    480					;

    481					;

    482					;

    483					; OUTPUTS:

    484					;	C=0 IF SUCCESSFUL, C=1 IF ERROR F.ERR SET

    485					;	R0 PRESERVED, R1-R5 ALTERED

    486					;	F.VBN SET

    487					;	F.NREC,F.EOBB SET

    488					;	F.SEQN = 8'TH ATTR WORD

    489					;		LOW BYTE = BUCKET SIZE (NOT USED)

    490					;		HI BYTE = SIZE OF FIXED HEADERFOR VFC RECORDS (R.SEQ)

    491					;

    492					;

    493					;

    494					;

    495					; OPERATION:

    496					; ISSUES QIO ACCESS WITH READ OF RECORD ATTRIBUTES

    497					; FOR EXISTING BLOCK ORIENTED FILE, SETS UP RECORD

    498					; ATTRIBUTES FOR EXISTING RECORD ORIENTED FILE. IF CREATING

    499					; NEW FILE, RECORD ATTRIBUTES WERE ALL SET. IF ACCESSING

    500					; AN EXISTING BLOCK ORIENTED FILE READS THE 1ST

    501					; OR LAST (FOR APPEND) VIRTUAL BLOCK. NO READ INITIATED

    502					; FOR RECORD ORIENTED DEVICE.

    503					;-

    504	001162				ACCESS:

    505	001162	132760 	000001 	000017 		BITB	#FD.REC,F.RCTL(R0) ;IF RECORD ORIENTED

    506	001170	001402 				BEQ	5$

    507	001172	000167 	000520 			JMP	70$		;SKIP THE ACCESS QI/O

    508	001176				5$:

    509					;

    510					; ISSUE THE ACCESS QI/O

    511					;

    512	001176					CALL	..IDPB		;INIT THE DPB AND SET R5 TO PARAM BLOCK

    513	001202	010015 				MOV	R0,(R5)

    514	001204	062725 	000102 			ADD	#F.FNB,(R5)+	;STORE THE ADDRESS OF THE FILE ID

    515						.IF	GT,R$$DPB

    516	001210	162706 	000012 			SUB	#12,SP		;MAKE ROOM ON STACK FOR READ ATT LIST

    517	001214	010625 				MOV	SP,(R5)+	;STORE ADDRESS OF ATT LIST

    518	001216	062705 	000004 			ADD	#4,R5		;INDEX TO ACCESS CONTROL WORD

    519	001222	016004 	000076 			MOV	F.ACTL(R0),R4	;GET CONTROL WORD FROM FDB

    520	001226	100402 				BMI	7$		; BRANCH IF ENABLED

    521	001230	012704 	100000 			MOV	#FA.ENB,R4	; GET BASIC DEFAULT VALUE

    522	001234	010415 			7$:	MOV	R4,(R5)		; STORE ACCESS VALUE

    523	001236	005205 				INC	R5		;R5 POINTS TO ACCESS CONTROL BITS

    524						.ENDC

    525	001240	132760 	000040 	000043 		BITB	#FA.SHR,F.FACC(R0) ;SHARED ACCESS DESIRED?

    526	001246	001002 				BNE	10$		;BRANCH IF YES

    527	001250	152715 	000001 			BISB	#WI.LCK,(R5)	;NO, REQUEST LOCKED ACCESS

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 13-1





    528	001254	012704 	006400 		10$:	MOV	#IO.ACR,R4	;ASSUME ACCESS FOR READ

    529	001260	132760 	000001 	000043 		BITB	#FA.RD,F.FACC(R0) ;READ ONLY ACCESS DESIRED?

    530	001266	001030 				BNE	25$		;YES, R4 ALL SET

    531					;

    532					; WRITE ACCESS DESIRED

    533					;

    534	001270	012704 	000002 			MOV	#WI.DLK,R4	; GET DEACCESS LOCK BIT

    535	001274	141504 				BICB	(R5),R4		; PERFORM XOR OF BIT WITH ACCESS VALUE

    536	001276	142715 	000002 			BICB	#WI.DLK,(R5)

    537	001302	150415 				BISB	R4,(R5)

    538	001304	012704 	007400 			MOV	#IO.ACE,R4	;ASSUME ACCESS FOR EXTEND DESIRED

    539	001310	132760 	000004 	000043 		BITB	#FA.EXT,F.FACC(R0) ;EXTEND ACCESS REQUESTED?

    540	001316	001002 				BNE	20$		;BRANCH IF YES, R4 ALL SET

    541	001320	012704 	007000 			MOV	#IO.ACW,R4	;ACCESS IS FOR READ, WRITE

    542	001324				20$:

    543						.IF GT,R$$ANI

    544	001324	132760 	000040 	000017 		BITB	#FD.SQD,F.RCTL(R0)	;ERS A SEQUENTIAL DEVICE

    545	001332	001406 				BEQ	25$			;ERS NO

    546	001334	132760 	000110 	000043 		BITB	#FA.APD!FA.CRE,F.FACC(R0)	;ERS CREATE OR APPEND

    547	001342	001002 				BNE	25$			;ERS YES

    548	001344	152715 	000100 			BISB	#WI.UPD,(R5)		;ERS NO SET UPDATE MODE IN CONTROL BYTE

    549						.ENDC

    550	001350				25$:

    551						.IF GT,R$$DPB

    552						.IFF

    553						TST	(R5)+		;POINT TO PLACE TO PUT RECORD ATT ADDRESS

    554						BITB	#FA.CRE,F.FACC(R0) ;UNLESS CREATING A NEW FILE

    555						BNE	30$

    556						MOV	R0,(R5)		;READ RECORD ATTRIBUTE TO FDB

    557					30$:	TST	(R5)+		;POINT TO STATISTICS BLOCK ADDRESS

    558						MOV	F.STBK(R0),(R5)	;READ STATISTICS BLOCK IF DESIRED

    559						.IFT

    560	001350	010605 				MOV	SP,R5		;GET POINTER TO ATT LIST

    561	001352	016046 	000016 			MOV	F.RACC(R0),-(SP)	; GET SPACE FOR 8'TH ATTR WORD

    562	001356	005060 	000016 			CLR	F.RACC(R0)		; AND INIT 8'TH WORD (IN CASE FA.CRE)

    563	001362	132760 	000010 	000043 		BITB	#FA.CRE,F.FACC(R0) ;READ ATT UNLESS CREATING

    564	001370	001003 				BNE	30$

    565	001372	012725 				MOV	(PC)+,(R5)+	;SET READ REC I/O CODE

    566	001374	   374 	   020 			.BYTE	-HA.UAT,S.FATT+2 ; READ 8 WORDS

    567	001376	010025 				MOV	R0,(R5)+	;TO THIS ADDRESS

    568	001400	016015 	000036 		30$:	MOV	F.STBK(R0),(R5)	;ADDRESS OF STATISTICS BLOCK IF DESIRED

    569	001404	001405 				BEQ	33$		;NOT DESIRED...

    570	001406	012725 				MOV	(PC)+,(R5)+	;DESIRED, SET THE CODE

    571	001410	   367 	   012 			.BYTE	-11,12

    572	001412	016025 	000036 			MOV	F.STBK(R0),(R5)+

    573	001416	005015 				CLR	(R5)

    574	001420				33$:

    575						.IFTF

    576	001420					CALL	..QIOW		;ISSUE THE ACCESS QI/O AND WAIT

    577						.IFT

    578					;

    579					; THIS CODE MUST NOT ALTER THE C-BIT

    580					;

    581	001424	103403 				BCS	34$		; DON'T SAVE 8'TH WORD IS ACCESS FAILED

    582	001426	016060 	000016 	000100 		MOV	F.RACC(R0),F.SEQN(R0)

    583	001434	012660 	000016 		34$:	MOV	(SP)+,F.RACC(R0) ; RESTORE F.RACC WORD

    584					;

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 13-2





    585	001440	006005 				ROR	R5		; SAVE C-BIT

    586	001442	062706 	000012 			ADD	#12,SP		;POP STACK ITEMS

    587	001446	006105 				ROL	R5		; GET BACK THE C-BIT

    588						.IFTF

    589	001450	103551 				BCS	95$		; EXIT IF FAILED TO ACCESS

    590	001452	005260 	000066 			INC	F.VBN+2(R0)	;VBN=1

    591	001456	132760 	000040 	000017 		BITB	#FD.SQD,F.RCTL(R0) ;SEQUENTIAL DEVICE?

    592	001464	001421 				BEQ	35$		;BRANCH IF NOT

    593	001466	012760 	077777 	000004 		MOV	#77777,F.HIBK(R0) ;FAKE LARGE ALLOCATION

    594	001474	132760 	000010 	000043 		BITB	#FA.CRE,F.FACC(R0) ;AND IF OPENING EXISTING FILE

    595	001502	001024 				BNE	38$

    596	001504	012760 	000001 	000012 		MOV	#1,F.EFBK+2(R0)	; FAKE EOF AT BEGINNING IF APPENDING

    597	001512	132760 	000100 	000043 		BITB	#FA.APD,F.FACC(R0)

    598	001520	001003 				BNE	35$		; ELSE

    599	001522	012760 	037777 	000010 		MOV	#37777,F.EFBK(R0) ;FAKE EOF SHORT OF ALLOCATED SPACE

    600	001530	132760 	000100 	000043 	35$:	BITB	#FA.APD,F.FACC(R0) ;IF APPENDING

    601	001536	001406 				BEQ	38$

    602	001540	016060 	000010 	000064 		MOV	F.EFBK(R0),F.VBN(R0) ;SET NEXT VBN

    603	001546	016060 	000012 	000066 		MOV	F.EFBK+2(R0),F.VBN+2(R0)

    604	001554	132760 	000001 	000016 	38$:	BITB	#FD.RWM,F.RACC(R0) ;IF READ/WRITE ALL DONE

    605	001562	001102 				BNE	90$

    606	001564	132760 	000010 	000043 		BITB	#FA.CRE,F.FACC(R0) ;SKIP READ OF VBN

    607	001572	001072 				BNE	80$		;IF NEW FILE

    608						.IF	GT,R$$ANI

    609	001574	132760 	000040 	000017 		BITB	#FD.SQD,F.RCTL(R0)	;ERS IF SEQUENTIAL DEVICE

    610	001602	001415 				BEQ	40$			;ERS NO

    611	001604	132760 	000101 	000043 		BITB	#FA.RD!FA.APD,F.FACC(R0)  ;ERS AND READ ONLY OR APPEND

    612	001612	001011 				BNE	40$			;ERS GO READ VBN

    613	001614	152760 	000100 	000051 		BISB	#FD.INV,F.BKP1(R0)	;ERS SET INVALID BUFFER TO INDICATE NO READ OCCURED

    614	001622	005060 	000010 			CLR	F.EFBK(R0)		;ERS SET EOF FOR PUT FIRST

    615	001626	012760 	000001 	000012 		MOV	#1,F.EFBK+2(R0)

    616	001634	000451 				BR	80$			;ERS SET UP BUFFER DESCRIPTORS

    617						.ENDC

    618					;

    619					; EXISTING BLOCK ORIENTED FILE, READ VBN 1 OR LAST VBN IF

    620					; OPEN FOR APPEND. THIS WILL INIT BUFFER AND RECORD POINTERS

    621					;

    622	001636				40$:	CALL	..RWAC		;READ THE 1ST OR LAST BLOCK

    623	001642	103015 				BCC	60$		;BRANCH IF SUCCESSFUL

    624	001644	012746 	000001 			MOV	#1,-(SP)	;ASSUME EOF ERROR

    625	001650	122760 	177766 	000052 		CMPB	#IE.EOF,F.ERR(R0) ;IF EOF ERROR, DELAY THE REPORT

    626	001656	001404 				BEQ	50$

    627	001660	016016 	000052 			MOV	F.ERR(R0),(SP)	;OTHERWISE SAVE THE ERROR CODE

    628					;

    629					; NOW DEACCESS THE FILE

    630					;

    631	001664					CALL	DEACCS

    632	001670	012660 	000052 		50$:	MOV	(SP)+,F.ERR(R0)	;RESTORE SAVED ERROR CODE

    633	001674	000435 				BR	90$

    634	001676	132760 	000100 	000043 	60$:	BITB	#FA.APD,F.FACC(R0) ;IF APPENDING

    635	001704	001431 				BEQ	90$

    636	001706	066060 	000014 	000030 		ADD	F.FFBY(R0),F.NREC(R0) ;SET NEXT RECORD POINTER TO EOF

    637	001714	000425 				BR	90$

    638						.ENDC

    639					;

    640					; RECORD ORIENTED DEVICE MUST SET UP RECORD ATTRIBUTES IF

    641					; READING AN EXISTING FILE.

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 13-3





    642	001716	132760 	000010 	000043 	70$:	BITB	#FA.CRE,F.FACC(R0) ;IF NEW FILE

    643	001724	001011 				BNE	75$		;DON'T SET ATTRIBUTES

    644	001726	112760 	000002 	000000 		MOVB	#R.VAR,F.RTYP(R0) ;ASSUME VARIABLE LENGTH

    645	001734	112760 	000002 	000001 		MOVB	#FD.CR,F.RATT(R0) ;CARRIAGE RETURNS BETWEEN RECS

    646	001742	016060 	000062 	000002 		MOV	F.BBFS(R0),F.RSIZ(R0) ;MAX RECORD SIZE

    647	001750	132760 	000001 	000016 	75$:	BITB	#FD.RWM,F.RACC(R0)	;IF READ/WRITE MODE THEN EXIT

    648	001756	001004 				BNE	90$

    649					; INIT BUFFER DESCRIPTOR AND RECORD POINTERS FOR 1ST GET, PUT

    650	001760	016001 	000070 		80$:	MOV	F.BDB(R0),R1

    651	001764					CALL	..BDRC

    652	001770				90$:	CALL	..FCSX

    653	001774				95$:	RETURN

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 14





    655					; USE OVERRIDE BUFFER SIZE IF SPECIFIED

    656					; DESTROYS R4,R5, R0-R3 PRESERVED

    657	001776	016005 	000030 		OVBFSZ:	MOV	F.OVBS(R0),R5

    658	002002	001414 				BEQ	50$		;BRANCH IF NO OVERRIDE SPECIFIED

    659					;

    660						.IF	EQ,R$$BBF	;NO BIG BUFFERS ALLOWED

    661	002004	132760 	000041 	000017 		BITB	#FD.REC!FD.SQD,F.RCTL(R0)

    662	002012	001410 				BEQ	50$		;NO OVERRIDE FOR BLOCK DEVICE

    663						.ENDC

    664					;

    665						.IF	GT,R$$BBF	;BIG BUFFERS ALLOWED

    666						BITB	#FD.REC!FD.SQD,F.RCTL(R0) ;IF RECORD DEVICE

    667						BNE	40$		;ALLOW THE OVERRIDE

    668						.IF	GT,R$$EIS

    669						CLR	R4

    670						DIV	F.VBSZ(R0),R4	;NO. OF VIRT BLOCKS IN BUFFER

    671						TST	R4

    672						BNE	20$

    673						INC	R4		;AT LEAST ONE

    674					20$:	MOVB	R4,F.BGBC(R0)	;SAVE VB/BUFFER

    675						MUL	F.VBSZ(R0),R4	;R5=SIZE OF BUFFER

    676						.IFF

    677						CLRB	F.BGBC(R0)	;START AT 0

    678						CLR	R4		;START AT 0

    679					20$:	ADD	F.VBSZ(R0),R4	;ADD

    680						INCB	F.BGBC(R0)	;AND INC

    681						CMP	R4,R5		;AGAIN?

    682						BLO	20$		;YES

    683						DECB	F.BGBC(R0)	;CORRECT

    684						SUB	F.VBSZ(R0),R4	;CORRECT OTHER

    685						BNE	25$		;O.K.

    686						INCB	F.BGBC(R0)	;CORRECT

    687						ADD	F.VBSZ(R0),R4	;CORRECT ALSO

    688					25$:	MOV	R4,R5		;MATCH CONVENTIONS

    689						.ENDC

    690						BISB	#FD.BGB,F.MBFG(R0) ;NOTE USING BIG BUFFERS

    691						BR	45$

    692					40$:

    693					.ENDC

    694					;

    695	002014	132760 	000040 	000017 		BITB	#FD.SQD,F.RCTL(R0)

    696	002022	001402 				BEQ	45$

    697	002024	010560 	000060 			MOV	R5,F.VBSZ(R0)	;SET VIRTUAL BLOCK SIZE TOO IF SEQ DEV

    698	002030	010560 	000062 		45$:	MOV	R5,F.BBFS(R0)

    699	002034				50$:	RETURN

    700					;

    701					;

    702	002036					$END	OPEN

    703					;

    704					;

    705		000001 				.END

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 14-1

SYMBOL TABLE



ACCESS  001162R     002	FD.F11= 040000   	F.HIBK= 000004   	IE.DFU= 177750   	IE.PNS= 177642

A.BFSR= 000004   	FD.INS= 000010   	F.LUN = 000042   	IE.DNA= 177771   	IE.PRI= 177760

A.DFBC= 000100   	FD.INV= 000100   	F.MBCT= 000054   	IE.DNR= 177775   	IE.PTS= 177775

A.DFDR= 000050   	FD.ISP= 002000   	F.MBC1= 000055   	IE.DUN= 177767   	IE.RAC= 177724

A.DFUI= 000102   	FD.MNT= 100000   	F.MBFG= 000056   	IE.DUP= 177707   	IE.RAT= 177723

A.DPB = 000014   	FD.OER= 000040   	F.NRBD= 000024   	IE.EOF= 177766   	IE.RBG= 177730

A.EFSR= 000006   	FD.OSP= 004000   	F.NREC= 000030   	IE.EOT= 177702   	IE.RBS= 177761

A.FIPR= 000012   	FD.PLC= 000004   	F.OVBS= 000030   	IE.EOV= 177765   	IE.RCN= 177722

A.IOST= 000044   	FD.PRN= 000004   	F.RACC= 000016   	IE.EXP= 177665   	IE.RER= 177740

A.OWUI= 000010   	FD.PSE= 010000   	F.RATT= 000001   	IE.FEX= 177717   	IE.RNM= 177715

BADOPN  001044R     002	FD.RAH= 000001   	F.RCNM= 000034   	IE.FHE= 177705   	IE.RSU= 177757

BADOP1  001052R     002	FD.RAN= 000002   	F.RCTL= 000017   	IE.FIX= 177767   	IE.SDP= 177635

BADOP2  001036R     002	FD.REC= 000001   	F.RSIZ= 000002   	IE.FLN= 177657   	IE.SNC= 177735

BADOP3  001064R     002	FD.RWM= 000001   	F.RTYP= 000000   	IE.FOP= 177713   	IE.SPC= 177772

BADOP4  001076R     002	FD.SDI= 000020   	F.SEQN= 000100   	IE.HFU= 177744   	IE.SQC= 177734

BADRAC  001142R     002	FD.SPL= 000200   	F.SPDV= 000072   	IE.HWR= 177772   	IE.SRE= 177762

BADRAT  001152R     002	FD.SQD= 000040   	F.SPUN= 000074   	IE.IBS= 177647   	IE.STK= 177706

BADRTY  000746R     002	FD.TTY= 000004   	F.STBK= 000036   	IE.IDU= 177644   	IE.TCH= 177765

BADTYP  001132R     002	FD.WBH= 000002   	F.UNIT= 000136   	IE.IEF= 177637   	IE.TMM= 177671

BD.FRE= 000001   	FD.WRT= 000001   	F.URBD= 000020   	IE.IES= 177656   	IE.TMO= 177666

BL.SZ = 000013   	FF.CHR= 000005   	F.VBN = 000064   	IE.IFC= 177776   	IE.ULK= 177653

B.BBFS= 000010   	FF.NV = 000003   	F.VBSZ= 000060   	IE.IFU= 177747   	IE.ULN= 177773

B.BFST= 000015   	FF.POE= 000002   	HA.CHU= 000003   	IE.ILL= 177726   	IE.UNS= 177774

B.NXBD= 000012   	FF.RWD= 000001   	HA.FP = 000002   	IE.ILU= 177640   	IE.UPN= 177777

B.VBN = 000004   	FF.RWF= 000006   	HA.NAM= 000005   	IE.ILV= 177755   	IE.VER= 177774

CH.AND= 000001   	FF.SPC= 000004   	HA.TYP= 000006   	IE.INS= 177776   	IE.WAC= 177743

DEACCS  000762R     002	FO.APD= 000106   	HA.UAT= 000004   	IE.IOP= 177655   	IE.WAT= 177741

DIRTYP= 015172   	FO.MFY= 000002   	HA.UI = 000001   	IE.IPR= 177641   	IE.WCK= 177652

D.DFDV= 000024   	FO.RD = 000001   	HA.VER= 000007   	IE.ISQ= 177703   	IE.WER= 177737

D.DFID= 000016   	FO.UPD= 000006   	IE.ABO= 177761   	IE.ITI= 177643   	IE.WLK= 177764

D.DFUN= 000026   	FO.WRT= 000016   	IE.ACT= 177771   	IE.ITP= 177650   	IE.WOV= 177653

FA.APD= 000100   	F.ACTL= 000076   	IE.ADP= 177636   	IE.ITS= 177770   	IE.2DV= 177720

FA.CRE= 000010   	F.ALOC= 000040   	IE.ALC= 177654   	IE.IUI= 177645   	IO.ACE= 007400

FA.DLK= 001000   	F.BBFS= 000062   	IE.ALG= 177654   	IE.LCK= 177745   	IO.ACR= 006400

FA.ENB= 100000   	F.BDB = 000070   	IE.ALN= 177736   	IE.LNL= 177646   	IO.ACW= 007000

FA.EXC= 002000   	F.BGBC= 000057   	IE.AST= 177660   	IE.MAP= 177657   	IO.APC= 014000

FA.EXT= 000004   	F.BKDN= 000026   	IE.BAD= 177777   	IE.MOD= 177753   	IO.APV= 014010

FA.NSP= 000100   	F.BKDS= 000020   	IE.BBE= 177710   	IE.NBF= 177731   	IO.ATT= 001400

FA.POS= 010000   	F.BKEF= 000050   	IE.BCC= 177676   	IE.NBK= 177727   	IO.CLN= 003400

FA.RD = 000001   	F.BKP1= 000051   	IE.BDI= 177714   	IE.NDR= 177670   	IO.CRE= 012000

FA.RWD= 004000   	F.BKST= 000024   	IE.BDR= 177716   	IE.NFI= 177704   	IO.DAC= 010000

FA.SEQ= 040000   	F.BKVB= 000064   	IE.BDV= 177711   	IE.NFW= 177673   	IO.DEL= 012400

FA.SHR= 000040   	F.CHR = 000075   	IE.BHD= 177700   	IE.NLK= 177661   	IO.DET= 002000

FA.TMP= 000020   	F.CNTG= 000034   	IE.BLB= 177672   	IE.NLN= 177733   	IO.ENA= 006000

FA.WCK= 020000   	F.DFNB= 000046   	IE.BLK= 177754   	IE.NNC= 177663   	IO.EXT= 011400

FA.WRT= 000002   	F.DSPT= 000044   	IE.BNM= 177712   	IE.NNL= 177662   	IO.FNA= 004400

FCSEFN= 000040   	F.DVNM= 000134   	IE.BTF= 177664   	IE.NNN= 177674   	IO.KIL= 000012

FD.BLK= 000010   	F.EFBK= 000010   	IE.BTP= 177725   	IE.NOD= 177751   	IO.LOV= 001010

FD.CCL= 000002   	F.EFN = 000050   	IE.BVR= 177701   	IE.NSF= 177746   	IO.LTK= 000050

FD.COM= 020000   	F.EOBB= 000032   	IE.BYT= 177755   	IE.NST= 177660   	IO.RAT= 013000

FD.CR = 000002   	F.ERR = 000052   	IE.CKP= 177766   	IE.NSW= 177756   	IO.RDN= 000022

FD.DIR= 000010   	F.FACC= 000043   	IE.CKS= 177742   	IE.NVR= 177652   	IO.RLB= 001000

FD.DVR= 000020   	F.FFBY= 000014   	IE.CLO= 177732   	IE.NVW= 177651   	IO.RNA= 005400

FD.EFB= 000004   	F.FNAM= 000110   	IE.CNR= 177667   	IE.OFL= 177677   	IO.RTK= 000060

FD.EF1= 000010   	F.FNB = 000102   	IE.CON= 177752   	IE.ONP= 177773   	IO.RVB= 010400

FD.EOF= 000002   	F.FTYP= 000116   	IE.DAA= 177770   	IE.OVR= 177756   	IO.SET= 000030

FD.FTN= 000001   	F.FVER= 000120   	IE.DAO= 177763   	IE.PES= 177655   	IO.ULK= 005000

OPFNB 0130S, OPEN FILE ROUTINE	MACRO M1110  22-AUG-78 01:21  PAGE 14-2

SYMBOL TABLE



IO.UNL= 000042   	NB.DEV= 000200   	N.FTYP= 000014   	R$$VMS= 000001   	$$MSG = 000000

IO.WAT= 013400   	NB.DIR= 000100   	N.FVER= 000016   	R$$11M= 000001   	.FSRPT= ****** GX

IO.WLB= 000400   	NB.DOT= 100000   	N.NEXT= 000022   	R.FIX = 000001   	.OPFNB  000000RG    002

IO.WVB= 011000   	NB.NAM= 000004   	N.STAT= 000020   	R.SEQ = 000003   	.SAVR1= ****** GX

IQ.Q  = 000002   	NB.SD1= 000400   	N.UNIT= 000034   	R.VAR = 000002   	..ALUN= ****** GX

IQ.S  = 000004   	NB.SD2= 001000   	OPALOC  000514R     002	SYDEV = 054523   	..BDRC= ****** GX

IQ.UMD= 000004   	NB.SMI= 040000   	OPDIR   000220R     002	SYUNIT= 000000   	..CREA= ****** GX

IQ.X  = 000001   	NB.SNM= 000040   	OVBFSZ  001776R     002	S.BFHD= 000020   	..DEL1= ****** GX

IS.BV = 000005   	NB.STP= 000020   	PP.SEP= 000002   	S.FATT= 000016   	..ENTR= ****** GX

IS.CC = 001401   	NB.SVR= 000010   	PP.ZER= 000001   	S.FDB = 000140   	..FCSX= ****** GX

IS.CLR= 000000   	NB.TYP= 000002   	P$$ARS= 000001   	S.FNAM= 000006   	..FIND= ****** GX

IS.CR = 006401   	NB.VER= 000001   	R$$ANI= 000001   	S.FNB = 000036   	..FINI= ****** GX

IS.EOT= 002001   	NOBUF   001056R     002	R$$BBF= 000000   	S.FNBW= 000017   	..IDPB= ****** GX

IS.ESC= 015401   	N.DID = 000024   	R$$DPB= 000001   	S.FNTY= 000004   	..MKDL= ****** GX

IS.ESQ= 115401   	N.DRPT= 000006   	R$$EIS= 000001   	S.FSR2= 000104   	..QIOW= ****** GX

IS.PES= 100001   	N.DRSZ= 000004   	R$$LCL= 000001   	S.FTYP= 000002   	..RFDB= ****** GX

IS.PND= 000000   	N.DVNM= 000032   	R$$MBF= 000000   	S.NFEN= 000020   	..RMOV= ****** GX

IS.RDD= 000002   	N.DVPT= 000002   	R$$MUL= 000000   	WI.DLK= 000002   	..RTAD= ****** GX

IS.SET= 000002   	N.DVSZ= 000000   	R$$OPF= 000001   	WI.LCK= 000001   	..RWAC= ****** GX

IS.SPD= 000002   	N.FID = 000000   	R$$RSL= 000001   	WI.SPL= 000020   	...CTL= 000003

IS.SUC= 000001   	N.FNAM= 000006   	R$$SEQ= 000000   	WI.UPD= 000100   	...GBL= 000000

IS.TAB= 004401   	N.FNPT= 000012   	R$$SPL= 000000   	$RQCB = ****** GX	...TPC= 000030

IS.TMO= 000002   	N.FNSZ= 000010



. ABS.	000000	   000

      	000000	   001

$$RESL	002036	   002

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  5049 WORDS  ( 20 PAGES)

DYNAMIC MEMORY:  5940 WORDS  ( 22 PAGES)

ELAPSED TIME:  00:00:39

OBJ$:OPNFNB,LIS$:OPNFNB/-SP=SRC$:OPNFNB,FCSPRE,OPEN

