	PROGRAM INCSAN
C
C	FUNCTION:
C		TO LOCATE SA ON LINE N-1 AND TO INCREMENT MATRIX BY ONE
C
C
	INTEGER ICNT(256),STRLIN(10)
	LOGICAL*1 BCNT(512),ERR,BYT1,BYT2,BYT3
	EQUIVALENCE (ICNT,BCNT,FILE)
	REAL*8 GAMMAL
	DATA GAMMAL/12RSY0GAMMALSYS/
	DATA STRLIN/2,53,104,155,206,257,308,359,410,461/
C
C	OPEN SAVE AREA ZERO TO CURRENT LINE
C
	CALL SAVOP(0,ISAVE0,ICNT,IERR)
	ITP = 33
	CALL READW(256,ICNT,ITP,ISAVE0)
	LINE  = ICNT(39) - 1
C
C	OPEN GAMMAL.SYS TO INCREMENT SA N
C
1	CALL CRTFIL(GAMMAL,53,IGAMML,1)
	ITP = 0
	CALL READW(256,BCNT,ITP,IGAMML)
	DO 5 I = STRLIN(LINE),STRLIN(LINE)+49
C
C	END OF CURRENT LINE ??
C
	IF (BCNT(I).EQ."200) GOTO 7
C
C	SEARCH FOR SM
C
	IF (BCNT(I).EQ.'S'.AND.BCNT(I+1).EQ.'A') GOTO 4
	GOTO 5
C
C	SEARCH FOR LINE SM2
C
4	IF (BCNT(I+3).EQ."200) GOTO 10
C
C	SEARCH FOR LINE SM20
C
	IF (BCNT(I+4).EQ."200) GOTO 30
5	CONTINUE
7	WRITE(7,29)
29	FORMAT(' ERROR IN MACRO - FORMAT MUST BE',//
	1,'??????;SA2',/
	2,' RU INCSMN;????')
	STOP 'INCSMN'
	GOTO 20
10	BCNT(I+2) = BCNT(I+2) + 1
	IF (BCNT(I+2).NE."72) GOTO 11
C
C	SET UP TO GOTO SVAR10
C
	BYT1 = BCNT(I+3)
	BYT2 = BCNT(I+4)
	BYT3 = BCNT(I+5)
	BCNT(I+2) = "61
	BCNT(I+3) = "60
	BCNT(I+4) = BYT1
	BCNT(I+5) = BYT2
	BCNT(I+6) = BYT3

	GOTO 11
C
C	SET UP TO INCREMENT 2 DIGIT SVAR'S
C
30	BCNT(I+3) = BCNT(I+3) + 1
	IF (BCNT(I+3).NE."72) GOTO 11
	BCNT(I+2) = BCNT(I+2) + 1
	BCNT(I+3) = "60
11	ITP = 0
	CALL WRITW(256,BCNT,ITP,IGAMML)
C
C	CLOSE ALL CHANNELS
C
20	DO 15 J = 1,10
	I = J - 1
	CALL CLOSEC(I)
15	CALL IFREEC(I)
	CALL BGAMMA('CA')
	END
