TFIND	X0015 - FIND NEXT FILE 	MACRO M1110  21-AUG-78 21:06  PAGE 3





      1	000000					$BEGIN	TFIND,0015,<FIND NEXT FILE ON TAPE>

						.TITLE	TFIND	X0015 - FIND NEXT FILE ON TAPE

						.IDENT	"X0015"

      2

      3					;

      4					; COPYRIGHT (C) 1976 BY DIGITAL EQUIPMENT CORPORATION,

      5					; MAYNARD, MASSACHUSETTS

      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 IN-

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

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

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

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

     13					; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL  TIMES  REMAIN

     14					; IN DIGITAL.

     15					;

     16					; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITH-

     17					; OUT  NOTICE  AND  SHOULD NOT BE CONSTRUED AS A COMMITMENT BY

     18					; DIGITAL EQUIPMENT CORPORATION.

     19					;

     20					; DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY  FOR

     21					; THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT WHICH IS

     22					; NOT SUPPLIED BY DIGITAL.

     23					;

     24					; ANDREW C. GOLDSTEIN  17-AUG-76  23:11

     25					; GEORGE RITTENBURG  7-APR-77  MODIFIED FOR VFY/CMP DISK TO/FROM TAPE

     26

     27

     28						.MCALL	FHDL2$,ALUN$S

     29	000000					FHDL2$			; DEFINE FILE HEADER OFFSETS

TFIND	X0015 - FIND NEXT FILE 	MACRO M1110  21-AUG-78 21:06  PAGE 4





     31					;+

     32					;

     33					; *** - $TFIND	FIND NEXT FILE ON TAPE

     34					;

     35					; THIS ROUTINE READS THE ATTRIBUTE AND HEADER BLOCKS FOR THE NEXT FILE

     36					; FROM THE TAPE AND CHECKS THEM FOR CONSISTENCY. IF WE ARE OUT OF

     37					; SYNC, IT SEARCHES UNTIL THE ATTRIBUTE AND HEADER BLOCKS ARE FOUND.

     38					;

     39					; INPUTS:

     40					;

     41					;	INLUN ASSIGNED TO TAPE

     42					;	$INDEV POINTING AT DEVICE TABLE ENTRY

     43					;

     44					; OUTPUTS:

     45					;

     46					;	CC - C	CLEAR IF ALL OK

     47					;		SET IF ERROR

     48					;	IF OK, $BUF1 CONTAINS ATTRIBUTE BLOCK,

     49					;	AND $BUF2 AND $IHBF CONTAIN FILE HEADER

     50					;	R5 = ADDRESS OF HEADER READ

     51					;	IF ERROR, R4 POINTS AT BCB OF OFFENDING BUFFER

     52					;

     53					;-

     54

     55	000000				$RDHTO::

     56	000000						LET $FLAG1 := $FLAG1 SET.BY #KY.NIP	;FLAG O.P.

     57	000006						LET R0 := $OUDEV

     58	000012						ALUN$S  #INLUN,(R0),2(R0)		;ASGN LUN TO O.P.

     59	000032						LET $B1HD+B.STAT := #0		;RELEASE BUFFR

     60	000036				$TFIND::

     61

     62	000036					  $CALL $RDWAT <,#2048.+P.SIZ,,,#$B1HD>	; READ ATTR BLOCK

     63	000052					  ON.ERROR

     64	000054					    IFB (R4) EQ #IE.EOF THEN RETURN ERROR ; END OF DATA

     65	000066					    IF #KY.VFY SET.IN $FLAG1 OR #KY.CMP SET.IN $OFLAG

     66	000106						ERROR ER.RAT

     67	000110					    ELSE

     68	000112						    ERRP ER.RAT			; PRINT MESSAGE

     69	000114					    END

     70	000114					  ELSE				; IF NO I/O ERROR

     71	000116					    IF P.FLAG(R5) NE #PF.ATR	; CHECK IF ATTR BLOCK

     72	000126						IF #KY.LOS OFF.IN $IFLAG ;IF WE WERE IN SYNC

     73	000136						   ERRP ER.PH1		; LOSS OF SYNC MESSAGE

     74	000140						END

     75	000140					    ELSE			; YES, THIS IS AN ATTRIBUTE BLOCK

     76	000142					      LET $FISIZ := $B1DAT+A$ALQ ; SET TOTAL FILE SIZE

     77	000150					      LET $FISIZ+2 := $B1DAT+A$ALQ+2

     78					;

     79					; NOW READ THE FILE HEADER, WHICH SHOULD FOLLOW

     80					;

     81

     82	000156					      LET $FNU := P.FID(R5)	; SET FILE NUMBER

     83	000164					      $CALL $RDWAT <,#512.+P.SIZ,,,#$B2HD>

     84	000200					      ON.ERROR

     85	000202						IF #KY.VFY SET.IN $FLAG1 OR #KY.CMP SET.IN $OFLAG

     86	000222							ERROR ER.RHT  ;ABORT ON ERROR

     87	000224						ELSE

TFIND	X0015 - FIND NEXT FILE 	MACRO M1110  21-AUG-78 21:06  PAGE 4-1





     88	000226							ERRP ER.RHT		; PRINT I/O ERROR MESSAGE

     89	000230							IFB (R4) EQ #IE.EOF THEN RETURN ERROR

     90	000242						END

     91	000242					      ELSE

     92	000244						IF P.FLAG(R5) NE #PF.HDR ; CHECK IF HEADER BLOCK

     93	000254						  IF #KY.VFY SET.IN $FLAG1 OR #KY.CMP SET.IN $OFLAG

     94	000274							ERROR ER.NXT   ;ABORT IF NOT HDR

     95	000276						  ELSE

     96	000300							  ERRP ER.NXT		; FAILED TO FIND HEADER

     97	000302							  JUMPTO RESYN1		; INITIATE RESYNC PROCESSING

     98	000306						  END

     99	000306						END

    100	000306						LET $FID := P.FID(R5)	; GET FILE ID OF FILE

    101	000314						LET $FID+2 := P.FID+2(R5)

    102	000322						LET $FID+4 := P.FID+4(R5)

    103	000330						LET R5 := R5 + #P.SIZ	; POINT TO HEADER DATA

    104	000334						$CALL $VFYHD <,,,,,R5>	; SEE IF REAL FILE HEADER

    105	000340						ON.NOERROR

    106	000342						  IF #KY.LOS SET.IN $IFLAG THEN ERRP ER.RSY

    107	000354						  LET $IFLAG := $IFLAG OFF.BY #KY.LOS ; WE ARE IN SYNC

    108	000362						  JUMPTO FINDA		; YOU WIN

    109	000366						ELSE

    110	000370						   IF #KY.VFY SET.IN $FLAG1 OR #KY.CMP SET.IN $OFLAG

    111	000410						      ERROR ER.NXT

    112	000412						  END

    113	000412					      END

    114	000412					      LET $B2HD+B.STAT := #0	; INVALIDATE BUFFER FOR RETRY

    115	000416					    END

    116	000416					  END

    117	000416				      END

    118					;

    119					; WE ARE OUT OF SYNC, DUE TO AN I/O ERROR OR DATA MISMATCH.

    120					;

    121	000416					  LET $IFLAG := $IFLAG SET.BY #KY.LOS ; NOTE THE FACT

    122	000424					  LET $B1HD+B.STAT := #0	; INVALIDATE BUFFER FOR RETRY

    123	000430					JUMPTO $TFIND			; AND PROCEED TO SEARCH

    124

    125	000434				FINDA:	LET $TESQN := #0		; INIT SEGMENT NUMBER

    126	000440					IF #KY.NIP SET.IN $FLAG1

    127	000450						LET $FLAG1 := $FLAG1 OFF.BY #KY.NIP ; RESET TO I.P.

    128	000456						$CALL $FILSZ  <,,,,,#$B2DAT>

    129	000466						LET $OHVBN := R1

    130	000472						LET $OHVBN+2 := R0

    131	000476						LET $WVBN := #1

    132	000504						LET $WVBN+2 := #0

    133	000510						LET $TVBN := #1

    134	000516						LET $TVBN+2 :=  #0

    135	000522						LET $OHHD+B.STAT := #1

    136	000530						LET R0 := $INDEV

    137	000534						ALUN$S #INLUN,(R0),2(R0)	;RE-ASGN LUN TO I.P.

    138	000554						LET R0 := #$OHBF	;COPY HDR INTO OHBF

    139	000560					ELSE

    140	000562						$CALL $FILSZ <,,,,,#$B2DAT>  ;GET HDR.SIZE

    141	000572						LET $IHVBN := R1		; AND SAVE

    142	000576						LET $IHVBN+2 := R0

    143	000602						LET $TVBN := #1			; INIT TAPE VBN TO 1

    144	000610						LET $TVBN+2 := #0

TFIND	X0015 - FIND NEXT FILE 	MACRO M1110  21-AUG-78 21:06  PAGE 4-2





    145	000614						$CALL $BUFCK <,,,,#$IHHD>	; GET INDEX FILE HEADER BUFFER

    146	000624						LET B.STAT(R4) := #1		; MARK IT BUSY

    147	000632						LET R0 := #$IHBF		; COPY HEADER INTO IHBF

    148	000636					END

    149	000636					THRU R1 := #256.

    150	000642					  LET (R0)+ := (R5)+

    151	000644					END LOOP

    152	000650					RETURN NOERROR			; HEADER SUCCESSFULLY READ

    153

    154

    155

    156		000001 				.END

TFIND	X0015 - FIND NEXT FILE 	MACRO M1110  21-AUG-78 21:06  PAGE 4-3

SYMBOL TABLE



A$ALQ = ****** GX	H.PROG= 000074   	L1      000066R  	SC.BAD= 000100   	$INDEV= ****** GX

A3    = 000001   	H.PROJ= 000076   	L10     000416R  	SC.DIR= 000040   	$I$   = 000001

B.STAT= ****** GX	H.RPRO= 000102   	L11     000244R  	SC.MDL= 000200   	$L    = 000001

B0      000642R  	H.RSOF= 000003   	L12     000222R  	S.HDHD= 000114   	$L$   = 000000

ER.NXT= ****** GX	H.SCHA= 000065   	L13     000226R  	S.IDHD= 000202   	$OFLAG= ****** GX

ER.PH1= ****** GX	H.SEMK= 000104   	L14     000242R  	S.MPHD= 000000   	$OHBF = ****** GX

ER.RAT= ****** GX	H.SMMX= 000110   	L15     000242R  	TYPS0 = 000006   	$OHHD = ****** GX

ER.RHT= ****** GX	H.UCHA= 000064   	L16     000416R  	TYPS1 = 000000   	$OHVBN= ****** GX

ER.RSY= ****** GX	H.UFAT= 000024   	L17     000306R  	TYPS2 = 000000   	$OUDEV= ****** GX

E0      000650R  	H.USE = 000072   	L2      000106R  	TYPS3 = 000000   	$O$   = 000000

FINDA   000434R  	IE.EOF= ****** GX	L20     000274R  	TYPS4 = 000000   	$R    = 177777

FP.DEL= 000010   	IIII  = 177777   	L21     000300R  	TYPS5 = 000000   	$RDHTO  000000RG

FP.EXE= 000004   	INLUN = ****** GX	L22     000306R  	UC.CON= 000200   	$RDWAT= ****** GX

FP.RDV= 000001   	I.BKDT= 000052   	L23     000370R  	UC.DLK= 000100   	$SUPMC= 000043

FP.WRV= 000002   	I.CRDT= 000022   	L24     000354R  	$BUFCK= ****** GX	$SV$  = 000000

H.ACOF= 000002   	I.EXDT= 000042   	L25     000412R  	$B1DAT= ****** GX	$T    = 000032

H.CKSM= 000776   	I.FNAM= 000000   	L26     000410R  	$B1HD = ****** GX	$TESQN= ****** GX

H.EFNU= 000016   	I.RVDT= 000032   	L27     000412R  	$B2DAT= ****** GX	$TFIND  000036RG

H.EFSQ= 000020   	I.RVNO= 000020   	L3      000112R  	$B2HD = ****** GX	$TVBN = ****** GX

H.ERVN= 000022   	I.ULAB= 000062   	L30     000562R  	$DIDDO= 000000   	$T1   = 000006

H.FCHA= 000064   	KY.CMP= ****** GX	L31     000636R  	$EF$  = 000000   	$T2   = 000000

H.FLEV= 000006   	KY.LOS= ****** GX	L4      000114R  	$E$   = 000001   	$VFYHD= ****** GX

H.FNUM= 000010   	KY.NIP= ****** GX	L5      000416R  	$FID  = ****** GX	$WVBN = ****** GX

H.FOWN= 000074   	KY.VFY= ****** GX	L6      000142R  	$FILSZ= ****** GX	$Y$   = 000000

H.FPRO= 000100   	LBLS0 = 000000   	L7      000140R  	$FISIZ= ****** GX	$Z$   = 000000

H.FRVN= 000014   	LBLS1 = 000010   	PF.ATR= ****** GX	$FLAG1= ****** GX	$$S   = 000000

H.FSEG= 000004   	LBLS2 = 000016   	PF.HDR= ****** GX	$FNU  = ****** GX	$$T   = 000026

H.FSEQ= 000012   	LBLS3 = 000025   	P.FID = ****** GX	$IFLAG= ****** GX	$$TT  = 000027

H.IDOF= 000000   	LBLS4 = 000027   	P.FLAG= ****** GX	$IHBF = ****** GX	.$T   = 000005

H.MPOF= 000001   	LBLS5 = 000027   	P.SIZ = ****** GX	$IHHD = ****** GX	...GBL= 000000

H.PRIV= 000073   	L0      000116R  	RESYN1= ****** GX	$IHVBN= ****** GX	...TPC= 000000



. ABS.	000000	   000

      	000654	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  13250 WORDS  ( 52 PAGES)

DYNAMIC MEMORY:  14388 WORDS  ( 55 PAGES)

ELAPSED TIME:  00:02:05

EXE$:TFIND,LIS$:TFIND/-SP=SRC$:SMAC/PA:1,DSCPRE,TFIND

