%begin
%owninteger swopped =0
%recordformat f1(%integer i %or %byte b0,b1,b2,b3 %or %string(3)s)
%recordformat f2(%integer i,%record(f1)f)
%recordformat f3(%integer k,%record(f2)f)
%integer i,fail,j,k
%routine test(%integer exp,swexp,act)
%if swopped=0 %start
      %if exp=act %then swopped=-1
      %if swexp=act %then swopped=1
%finish
%if swopped=-1 %and exp=act %then %return
%if swopped=1 %and swexp=act %then %return
      printstring("expected="); write(exp,5)
      printstring(" actual="); write(act,5); newline
      fail=fail+1
      %monitor
%end
%conststring(11) %array tx(-1:1)="","","(swopped)";
%record(f1) r1
%record(f2) r2
%record(f3) r3
fail=0
      j=0
l1:
r1_i=0
k=r1_I+j
r1_b3=5
test(5,X'05000000',r1_i)
test(5,x'05000000',r1_i+j)
r2_f_i=1
r2_f_b3=6
test(6,x'06000001',r2_f_i)
r3_f_f_i=1
r3_f_f_b3=6
test(6,x'06000001',r3_f_f_i)
%if fail=0 %then printstring("Test ok ".tx(swopped))
%endofprogram
