C	GAMCA.FOR
C	FUNCTION : TO RESTART MACRO WHEN FORTRAN PROGRAM 
C		   COMPLETES
C
C	NB	LINE SET TO LINE IN MACRO TO BE RUN
C		IF LINE -VE THEN LINE IN MACRO IS NOT CHANGED
C
C
C
	SUBROUTINE GAMCA(IDATA,LINE)
	DIMENSION IDATA(256),ICBLK(4)
	LOGICAL*1 TIM(8)
	DATA LS/3RLS /,LP/3RLP /
C
C	CHECK IF LS OR LP AVAILABLE
C
	CALL IDSTAT(LS,ICBLK)
	IF (ICBLK(3).NE.0) GOTO 2
	CALL IDSTAT(LP,ICBLK)
	IF (ICBLK(3).NE.0) GOTO 2
	GOTO 5
C
C	INFORM OPERATOR OF RETURN TO BGAMMA
C
2	CALL TIME(TIM)
	WRITE(7,1)(TIM(I),I=1,8)
1	FORMAT(' RETURNING TO BGAMMA AT ',8A1,//)
C
C	OPEN SAVE AREA ZERO
C
5	CALL SAVOP(0,ISAVE0,IDATA,IERR)
C
C	SET UP FOR RETURN TO LINE
C
	IF (ILINE.EQ.-1) GOTO 10
	ITP = 33
	CALL READW(256,IDATA,ITP,ISAVE0)
	IF (LINE.EQ.-1)GOTO 10
C
C	GAMMA REQUIRES LINE - 1 IN SVAR00
C
	IDATA(39) = LINE - 1
C	IDATA(40) = 0
	ITP = 33
	CALL WRITW(256,IDATA,ITP,ISAVE0)
10	ITP = 0
	CALL READW(256,IDATA,ITP,ISAVE0)
C
C	SET GAMMA FOR MACRO CONTINUATION
C
	IDATA(95) = 1
	ITP = 0
	CALL WRITW(256,IDATA,ITP,ISAVE0)
	CALL CLOSEC(ISAVE0)
	CALL IFREEC(ISAVE0)
	CALL BGAMMA('CA')
	RETURN
	END
