//SubProg1
01: addRule(_,number,equals,B2,rule2)
02: select(branch,rs1)
03: filter_2(rs1,rule2)
04: Select(account,rs2)
05: addRule(_,number,equals,A2,rule1)
06: filter_2(rs2,rule1)
07: relate(rs2,rs1)
08: setValue(balance,V,+,rs2)
//SubProg3
09: clearEnvironment()
10: addRule(_,number,equals,B1,rule2)
11: addRule(_,number,equals,A1,rule1)
12: select(branch,rs4)
13: filter_2(rs4,rule2)
14: select(account,rs3)
15: relate(rs3,rs4)
16: filter_2(rs3,rule1)
17: setValue(balance,V,-,rs3)
//SubProg2
18: clearEnvironment()
19: addRule(_,number,equals,B1,rule1)
20: addRule(_,number,equals,A1,rule2)
21: select(account,rs4)
22: select(branch,rs2)
23: filter_2(rs4,rule2)
24: filter_2(rs2,rule1)
25: relate(rs4,rs2)
26: createRelation(transaction,rs2,rs4)
27: setValue(operation,send,=,rs2)
29: setValue(value,V,=,rs2)
30: setValue(id,transID,=,rs2)
31: //SubProg4
32: clearEnvironment()
33: addRule(_,number,equals,A2,rule1)
34: addRule(_,number,equals,B2,rule2)
35: select(branch,rs3)
36: select(account,rs4)
37: filter_2(rs4,rule1)
38: filter_2(rs3,rule2)
39: relate(rs4,rs3)
40: createRelation(transaction,rs1,rs4)
41: setValue(operation,recv,=,rs1)
42: setValue(id,transID,=,rs1)
43: setValue(value,V,=,rs1)
Algorithm 1: Final program that model the task F1. The four subprograms were induced separately and them concatenated.