%BEGIN
%INTEGER I,J
%OWNSTRING(15)FAILED="TEST OK"
%RECORDFORMAT F(%INTEGER I,J)
%ROUTINESPEC INTERCHANGE(%RECORD(F)%ARRAYNAME A,%INTEGER I,J)
%RECORD(F)%ARRAY A(0:3)
%RECORD(F)%ARRAY B(1:4)
      %CYCLE I=0,1,3
         A(I)_I=I
         B(I+1)_I=I+1
      %REPEAT
      INTERCHANGE(A,1,3)
      Failed="***BUG FOUND" %UNLESS A(1)_I=3 %AND A(3)_I=1
      INTERCHANGE(B,1,3)
      Failed="***BUG FOUND" %UNLESS B(1)_I=3 %AND B(3)_I=1
       printstring(failed)
%ROUTINE INTERCHANGE(%RECORD(F)%ARRAYNAME R,%INTEGER P,Q)
%RECORD(F) TEMP
      TEMP=R(P)
      R(P)=R(Q)
      R(Q)=TEMP
%END
%ENDOFPROGRAM
