FORTRAN IV-PLUS V02-51D		02:40:42    22-AUG-78		PAGE 1   

FILBUF.FTN   	/TR:BLOCKS/WR


        C

        C

        C	FILBUF -- FILL BUFFER WITH INPUT OR OUTPUT LINES

        C

        C

        C

        C	COPYRIGHT (C) 1976

        C	DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

        C

        C	THIS SOFTWARE IS FURNISHED UNDER  A LICENSE FOR USE ONLY  ON  A

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

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

        C	OTHER COPIES THEREOF, MAY NOT BE  PROVIDED  OR  OTHERWISE  MADE

        C	AVAILABLE TO ANY OTHER PERSON EXCEPT  FOR  USE  ON  SUCH SYSTEM

        C	AND TO  ONE WHO AGREES  TO  THESE LICENSE  TERMS.  TITLE TO AND

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

        C

        C	THE INFORMATION IN THIS SOFTWARE  IS  SUBJECT TO CHANGE WITHOUT

        C	NOTICE AND SHOULD NOT BE CONSTRUED  AS  A COMMITMENT BY DIGITAL

        C	EQUIPMENT CORPORATION.

        C

        C	DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS

        C	SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

        C

        C

        C	K.D. MORSE	22-NOV-76

        C

        C

        C

        C	THIS ROUTINE FILLS THE BUFFER OF THE FILE INDICATED BY ILUN

        C	FROM BYTE IFREE TO THE END.  IT UPDATES ARRAY IHOLD WHICH CONTAINS

        C	THE LENGTHS OF THE RECORDS IN THE BUFFER.  THE VARIABLE LAST IS

        C	UPDATED TO THE RECORD NUMBER OF THE LAST RECORD IN THE BUFFER.

        C	DIF CAN HOLD UP TO 15 RECORDS OF 512 BYTES OR UP TO 30 RECORDS

        C	OF A SHORTER LENGTH AT A TIME.

        C

        C

        C

        C

        C

FORTRAN IV-PLUS V02-51D		02:40:42    22-AUG-78		PAGE 2   

FILBUF.FTN   	/TR:BLOCKS/WR


         

0001    	SUBROUTINE FILBUF(ILUN,RECORD,LENINP,ISTAT,INPNAM,INMLNG,

        	1ITYPE)

         

0002    	COMMON MAP(100,2),NUMLIN,MAPTOP(2),LSTMAP(2),MLUN,

        	1IHOLD(30,2),NINCOR,IFREE(2),IFIRST(2),LAST(2),MAXBUF,

        	2BUFR,ISWTCH,COMCHR,NSWVAL(10),LSTMAT(2),IRECSZ,

        	3MRKPNT(4,2),INOUT,MAPEND(2),LINSIZ,MAPNAM,MNMLNG,MTYPE,MSTAT

        	4,IERR1,IERR2,IKIND,OLUN,MAPMRK(3,2),MPRINT,BARCHR

         

0003    	INTEGER OLUN

0004    	BYTE RECORD(1),BUFR(7680,2),COMCHR(16),INPNAM(1),MAPNAM(12)

0005    	BYTE BARCHR

         

        C

        C	DECIDE WHICH FILE WAS INDICATED. 

        C		COMPARE:	ILUN=3	ISUB=2

        C		INPUT:		ILUN=1	ISUB=1

        C

0006    	ISUB=1

0007    	IF (ILUN .EQ. 3) ISUB=2

        C

        C	SET UP POINTERS TO THE NEXT RECORD IN THE FILE TO BE READ,  IN CASE

        C	CMP NEEDS TO REPOSITION THE FILE HERE, I.E., IF THERE'S NO ROOM

        C	TO PUT THE RECORD IN THE BUFFER.

        C

0008    10	CALL MRKREC(ILUN,MRKPNT(1,ISUB),IERR2)

0009    	IF (IERR2 .LT. 0) GOTO 94

0010    	IF (IERR2 .EQ. 0) GOTO 100

0011    	MRKPNT(4,ISUB)=LAST(ISUB) + 1

        C

        C	GET THE LINE AND EDIT IT.  THEN CHECK IF IT'LL FIT IN THE BUFFER.

        C	INOUT TELLS IF LINE SHOULD BE EDITTED FOR INPUT OR OUTPUT.

        C

0012    	IF (INOUT .EQ. 0) CALL INEDIT(ILUN,RECORD,LENINP)

0013    	IF (INOUT .GT. 0) CALL OUTEDT(ILUN,RECORD,LENINP)

0014    	IF (IERR2 .EQ. 0) GOTO 70

0015    	IF (IERR1 .LT. 0) GOTO 100

0016    	IF (IFREE(ISUB)+LENINP-1 .GT. MAXBUF) GOTO 70

0017    	IF ((LAST(ISUB)-IFIRST(ISUB)+2) .GT. NINCOR) GOTO 70

        C

        C	STORE RECORD IN BUFFER AND RECORD ITS LENGTH.  UPDATE LAST RECORD

        C	INDICATOR.

        C

0018    	IF (LENINP .EQ. 0) GOTO 60

0019    	DO 50 I=IFREE(ISUB),IFREE(ISUB)+LENINP-1

0020    50	BUFR(I,ISUB)=RECORD(I-IFREE(ISUB)+1)

0021    60	IHOLD(LAST(ISUB)-IFIRST(ISUB)+2,ISUB)=LENINP

0022    	LAST(ISUB)=LAST(ISUB)+1

0023    	IFREE(ISUB)=IFREE(ISUB)+LENINP

0024    	GOTO 10

        C

        C	BUFFER FULL.  NOW REPOSITION FILE SO LAST RECORD READ WILL BE THE

        C	FIRST ONE TO READ NEXT TIME.

        C

0025    70	IERR1=1

FORTRAN IV-PLUS V02-51D		02:40:42    22-AUG-78		PAGE 3   

FILBUF.FTN   	/TR:BLOCKS/WR


0026    	CALL CLSFIL(ILUN,ISTAT,IERR2)

0027    	IF (IERR2 .LT. 0) GOTO 92

0028    	CALL OPNFIL(INPNAM,INMLNG,ILUN,RECORD,IRECSZ,ITYPE,IERR2)

0029    	IF (IERR2 .LE. 0) GOTO 93

0030    	CALL PNTREC(ILUN, MRKPNT(1,ISUB),IERR2)

0031    	IF (IERR2 .LT. 0) GOTO 94

0032    	GOTO 100

        C

        C	ERROR RETURNS

        C

0033    92	IERR1=-12

0034    	GOTO 99

0035    93	IERR1=-13

0036    	GOTO 99

0037    94	IERR1=-15

0038    99	IF (ILUN .EQ. 3) IERR1=IERR1-8

0039    100	RETURN

0040    	END

FORTRAN IV-PLUS V02-51D		02:40:42    22-AUG-78		PAGE 4   

FILBUF.FTN   	/TR:BLOCKS/WR


PROGRAM SECTIONS



NUMBER	 NAME	    SIZE		ATTRIBUTES



  1	$CODE1	001130   300		RW,I,CON,LCL

  3	$IDATA	000064    26		RW,D,CON,LCL

  4	$VARS	000004     2		RW,D,CON,LCL

  5	$TEMPS	000004     2		RW,D,CON,LCL

  6	.$$$$.	037222  8009		RW,D,OVR,GBL





ENTRY POINTS



 NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS   



 FILBUF	      1-000000





VARIABLES



 NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS    NAME   TYPE  ADDRESS   



 BARCHR	L*1   6-037220	 I	I*2   4-000002	 IERR1	I*2   6-037172	 IERR2	I*2   6-037174	 IKIND	I*2   6-037176

 ILUN	I*2   F-000002*	 INMLNG	I*2   F-000014*	 INOUT	I*2   6-037140	 IRECSZ	I*2   6-037116	 ISTAT	I*2   F-000010*

 ISUB	I*2   4-000000	 ISWTCH	I*2   6-037044	 ITYPE	I*2   F-000016*	 LENINP	I*2   F-000006*	 LINSIZ	I*2   6-037146

 MAXBUF	I*2   6-001042	 MLUN	I*2   6-000632	 MNMLNG	I*2   6-037164	 MPRINT	I*2   6-037216	 MSTAT	I*2   6-037170

 MTYPE	I*2   6-037166	 NINCOR	I*2   6-001024	 NUMLIN	I*2   6-000620	 OLUN	I*2   6-037200





ARRAYS



 NAME   TYPE  ADDRESS	    SIZE 	DIMENSIONS



 BUFR	L*1   6-001044	036000  7680	(7680,2)

 COMCHR	L*1   6-037046	000020     8	(16)

 IFIRST	I*2   6-001032	000004     2	(2)

 IFREE	I*2   6-001026	000004     2	(2)

 IHOLD	I*2   6-000634	000170    60	(30,2)

 INPNAM	L*1   F-000012*	000001     0	(1)

 LAST	I*2   6-001036	000004     2	(2)

 LSTMAP	I*2   6-000626	000004     2	(2)

 LSTMAT	I*2   6-037112	000004     2	(2)

 MAP	I*2   6-000000	000620   200	(100,2)

 MAPEND	I*2   6-037142	000004     2	(2)

 MAPMRK	I*2   6-037202	000014     6	(3,2)

 MAPNAM	L*1   6-037150	000014     6	(12)

 MAPTOP	I*2   6-000622	000004     2	(2)

 MRKPNT	I*2   6-037120	000020     8	(4,2)

 NSWVAL	I*2   6-037066	000024    10	(10)

 RECORD	L*1   F-000004*	000001     0	(1)





LABELS



 LABEL   ADDRESS 	 LABEL   ADDRESS 	 LABEL   ADDRESS 	 LABEL   ADDRESS 	 LABEL   ADDRESS 	



FORTRAN IV-PLUS V02-51D		02:40:42    22-AUG-78		PAGE 5   

FILBUF.FTN   	/TR:BLOCKS/WR


 10	 1-000102	 50	    **   	 60	 1-000542	 70	 1-000626	 92	 1-001032

 93	 1-001050	 94	 1-001066	 99	 1-001102	 100	 1-001126





FUNCTIONS AND SUBROUTINES REFERENCED



 CLSFIL	 INEDIT	 MRKREC	 OPNFIL	 OUTEDT	 PNTREC





TOTAL SPACE ALLOCATED = 040446  8339



NO FPP INSTRUCTIONS GENERATED



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

