cat > script.ff <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
	program trans1
EXEC SQL INCLUDE SQLCA;
	integer error,comp
EXEC SQL BEGIN DECLARE SECTION ;
        character *25 name,date *20,amount *8
        character *25 name1,date1 *20,amnt1 *8
        character *20 date2 ,amnt2 *8
EXEC SQL END DECLARE SECTION ;
EXEC SQL INIT;
EXEC SQL DATABASE IS "DATABASE";
EXEC SQL SELECT name,date,amount FROM loans INTO :name,:date,:amount 
   WHERE name = "Kilroy";
        if(SQLRET.NE.0) then
	error=1
	goto 10
	endif
        print *,'select 1 ok'
	date2=date
	amnt2=amount
EXEC SQL START TRANSACTION;
        if(SQLRET.NE.0) then
	error=2
	goto 10
	endif
        print *,'start transaction ok'
EXEC SQL INSERT INTO loans SET name,date,amount VALUES "DATAWARE",:date2,:amnt2;
        if(SQLRET.NE.0) then
	error=3
	goto 10
	endif
        print *,'insert ok'
EXEC SQL COMMIT TRANSACTION;
        if(SQLRET.NE.0) then
	error=4
	goto 10
	endif
        print *,'commit transaction ok'
EXEC SQL SELECT name,date,amount FROM loans INTO :name1,:date1,:amnt1 
   WHERE name = "DATAWARE";
        if(SQLRET.NE.0) then
	error=5
	goto 10
	endif
        print *,'select 2 ok'
	if(comp('DATAWARE',name1,8).EQ.0 .AND. comp(date,date1,20).EQ.0
     x	 .AND. comp(amount,amnt1,8).EQ.0) then
	  print *,'test ok'
	 else 
	print *,'bad results'
	endif
EXEC SQL EXIT ;
	stop
10 	print *,'error number ',error
	print *,'SQLRET number ',SQLRET
EXEC SQL EXIT ;
	stop
	end

	integer function comp(st1,st2,length)
	character*(*) st1,st2
	integer length
	comp=0
	do 20 i=1,length
		if(st1(i:i).NE.st2(i:i)) comp=comp+1
20	continue
	return
	end
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 script.ff
cat > stdout <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
select 1 ok
start transaction ok
insert ok
commit transaction ok
select 2 ok
test ok
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout
cat > tag <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
Transaction (1)
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 tag
