Source (High Level Language HLA):

Form Definition

Program TransactionsApproval File Name: MM0319.Hfm

 

...

010 Field1 - Customer ID

011 Field2 - Customer First Name

012 Field3 - Customer Last Name

013 Field4 (list) - Account Number

014 Field5 (list) - Account Type

015 Field6 (list) - Account Balance

...

Program

Program TransactionsApproval File Name: MM0245.HLa

 

Program begin

.....

100 // Definitions of variables mapable to the form fields

101 Define Cust_ID(Char 20)

102 Define Cust_FName (Char 25)

103 Define Cust_LName (Char 35)

104 Define Acc_Numb(Char 12)[10]

105 Define Acc_Type(Char 2)[10]

106 Define Acc_Balance(Currency)[10]

107

108 // Definition of other variables

109 Define Bal(Currency)

110 Define Ind(Integer)

111 Define AdjustedBal(Currency)

112 Define ApproveTrans(Boolean)

113 Define Allowance(Currency)

.....

 

150 // Populating variables entered in the form

151 Field1 -> Cust_ID

152 Field2 -> Cust_FName

153 Field3 -> Cust_LName

154 Field4[1] -> Acc_Numb[0]

155 Field5[1] -> Acc_Type[0]

156 Field6[1] -> Acc_Balance[0]

...

200 // Processing

201 Allowance = $100.00 // The allowance shall be calculated for each customer

202 Ind =1

203 Bal = Acc_Balance[Ind - 1]

204 AdjustedBal = Bal + Allowance

...

240 If(AdjustedBal > $1000.00)

241 Then ApproveTrans = True

242 Else ApproveTrans = False

 

...

Program end

 

<?xml version="1.0" encoding="UTF-8"?>
<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:action="http://kdm.omg.org/action"

xmlns:code="http://kdm.omg.org/code" xmlns:conceptual="http://kdm.omg.org/conceptual" xmlns:kdm="http://kdm.omg.org/kdm"

xmlns:source="http://kdm.omg.org/source"

xmlns:ui="http://kdm.omg.org/ui"

name="Conceptual Example">
<model xmi:id="id.0" xmi:type="code:CodeModel">
<codeElement xmi:id="id.1" xmi:type="code:CodeAssembly">
<codeElement xmi:id="id.2" xmi:type="code:StorableUnit" name="Cust_ID" type="id.127" ext="Char 20" size="20">
<comment xmi:id="id.3" text="// Definitions of variables mapable to the form fields"/>
</codeElement>
<codeElement xmi:id="id.4" xmi:type="code:StorableUnit" name="Cust_FName" type="id.127" ext="Char 25" size="25"/>
<codeElement xmi:id="id.5" xmi:type="code:StorableUnit" name="Cust_LName" type="id.127" ext="Char 35" size="35"/>
<codeElement xmi:id="id.6" xmi:type="code:StorableUnit" name="Acc_Numb" type="id.7" ext="" size="1">
<codeElement xmi:id="id.7" xmi:type="code:ArrayType" size="10">
<itemUnit xmi:id="id.8" name="Acc_Numb[]" type="id.127" ext="Char 12" size="12"/>
</codeElement>
</codeElement>
<codeElement xmi:id="id.9" xmi:type="code:StorableUnit" name="Acc_Type" type="id.10" ext="" size="1">
<codeElement xmi:id="id.10" xmi:type="code:ArrayType" size="10">
<itemUnit xmi:id="id.11" name="Acc_Type[]" type="id.127" ext="Char 2" size="2"/>
</codeElement>
</codeElement>
<codeElement xmi:id="id.12" xmi:type="code:StorableUnit" name="Acc_Balance" type="id.13" ext="" size="1">
<codeElement xmi:id="id.13" xmi:type="code:ArrayType" size="10">
<itemUnit xmi:id="id.14" name="Acc_Balance[]" type="id.128" ext="Currency" size="2"/>
</codeElement>
</codeElement>
<codeElement xmi:id="id.15" xmi:type="code:StorableUnit" name="Bal" type="id.128" ext="" size="1" kind="local">
<comment xmi:id="id.16" text="// Definition of other variables"/>
</codeElement>
<codeElement xmi:id="id.17" xmi:type="code:StorableUnit" name="Ind" type="id.129" ext="" size="1" kind="local"/>
<codeElement xmi:id="id.18" xmi:type="code:StorableUnit" name="AdjustedBal" type="id.128" ext="" size="1" kind="local"/>
<codeElement xmi:id="id.19" xmi:type="code:StorableUnit" name="ApprovedTrans" type="id.130" ext="" size="1" kind="local"/>
<codeElement xmi:id="id.20" xmi:type="code:StorableUnit" name="Allowance" type="id.128" ext="" size="1" kind="local"/>
<codeElement xmi:id="id.21" xmi:type="action:ActionElement" name="i1" kind="Assign">
<source xmi:id="id.22" language="Hla" snippet="Field1 -> Cust_ID"/>
<comment xmi:id="id.23" text="// Populating variables entered in the form"/>
<codeElement xmi:id="id.24" xmi:type="code:StorableUnit" name="Field1" type="id.127" kind="register"/>
<actionRelation xmi:id="id.25" xmi:type="action:Reads" to="id.24" from="id.21"/>
<actionRelation xmi:id="id.26" xmi:type="action:Writes" to="id.2" from="id.21"/>
<actionRelation xmi:id="id.27" xmi:type="action:Flow" to="id.28" from="id.21"/>
</codeElement>
<codeElement xmi:id="id.28" xmi:type="action:ActionElement" name="i2" kind="Assign">
<source xmi:id="id.29" language="Hla" snippet="Field2 -> Cust_FName"/>
<codeElement xmi:id="id.30" xmi:type="code:StorableUnit" name="Field2" type="id.127" kind="register"/>
<actionRelation xmi:id="id.31" xmi:type="action:Reads" to="id.30" from="id.28"/>
<actionRelation xmi:id="id.32" xmi:type="action:Writes" to="id.4" from="id.28"/>
<actionRelation xmi:id="id.33" xmi:type="action:Flow" to="id.34" from="id.28"/>
</codeElement>
<codeElement xmi:id="id.34" xmi:type="action:ActionElement" name="i3" kind="Assign">
<source xmi:id="id.35" language="Hla" snippet="Field3 -> Cust_LName"/>
<codeElement xmi:id="id.36" xmi:type="code:StorableUnit" name="Field3" type="id.127" kind="register"/>
<actionRelation xmi:id="id.37" xmi:type="action:Reads" to="id.36" from="id.34"/>
<actionRelation xmi:id="id.38" xmi:type="action:Writes" to="id.5" from="id.34"/>
<actionRelation xmi:id="id.39" xmi:type="action:Flow" to="id.40" from="id.34"/>
</codeElement>
<codeElement xmi:id="id.40" xmi:type="action:ActionElement" name="i4" kind="ArrayReplace">
<source xmi:id="id.41" language="Hla" snippet="Field5[1] -> Acc_Type[0]"/>
<codeElement xmi:id="id.42" xmi:type="code:Value" name="0" type="id.129"/>
<codeElement xmi:id="id.43" xmi:type="code:StorableUnit" name="Field4" type="id.127" kind="register"/>
<actionRelation xmi:id="id.44" xmi:type="action:Reads" to="id.42" from="id.40"/>
<actionRelation xmi:id="id.45" xmi:type="action:Addresses" to="id.9" from="id.40"/>
<actionRelation xmi:id="id.46" xmi:type="action:Reads" to="id.43" from="id.40"/>
<actionRelation xmi:id="id.47" xmi:type="action:Writes" to="id.8" from="id.40"/>
<actionRelation xmi:id="id.48" xmi:type="action:Flow" to="id.49" from="id.40"/>
</codeElement>
<codeElement xmi:id="id.49" xmi:type="action:ActionElement" name="i5" kind="ArrayReplace">
<source xmi:id="id.50" language="Hla" snippet="Field4[1] -> Acc_Numb[0]"/>
<codeElement xmi:id="id.51" xmi:type="code:Value" name="0" type="id.129"/>
<codeElement xmi:id="id.52" xmi:type="code:StorableUnit" name="Field5" type="id.127" kind="register"/>
<actionRelation xmi:id="id.53" xmi:type="action:Reads" to="id.51" from="id.49"/>
<actionRelation xmi:id="id.54" xmi:type="action:Addresses" to="id.6" from="id.49"/>
<actionRelation xmi:id="id.55" xmi:type="action:Reads" to="id.52" from="id.49"/>
<actionRelation xmi:id="id.56" xmi:type="action:Writes" to="id.11" from="id.49"/>
<actionRelation xmi:id="id.57" xmi:type="action:Flow" to="id.58" from="id.49"/>
</codeElement>
<codeElement xmi:id="id.58" xmi:type="action:ActionElement" name="i6" kind="ArrayReplace">
<source xmi:id="id.59" language="Hla" snippet="Field6[1] -> Acc_Balance[0]"/>
<codeElement xmi:id="id.60" xmi:type="code:Value" name="0" type="id.129"/>
<codeElement xmi:id="id.61" xmi:type="code:StorableUnit" name="Field6" type="id.127" kind="register"/>
<actionRelation xmi:id="id.62" xmi:type="action:Reads" to="id.60" from="id.58"/>
<actionRelation xmi:id="id.63" xmi:type="action:Addresses" to="id.12" from="id.58"/>
<actionRelation xmi:id="id.64" xmi:type="action:Reads" to="id.61" from="id.58"/>
<actionRelation xmi:id="id.65" xmi:type="action:Writes" to="id.14" from="id.58"/>
<actionRelation xmi:id="id.66" xmi:type="action:Flow" to="id.67" from="id.21"/>
</codeElement>
<codeElement xmi:id="id.67" xmi:type="action:ActionElement" name="p1" kind="Assign">
<source xmi:id="id.68" language="Hla" snippet="Allowance = $100.00 "/>
<comment xmi:id="id.69" text="// Processing"/>
<comment xmi:id="id.70" text="// The allowance shall be calculated for each customer"/>
<codeElement xmi:id="id.71" xmi:type="code:Value" name="100.00" type="id.128"/>
<actionRelation xmi:id="id.72" xmi:type="action:Reads" to="id.71" from="id.67"/>
<actionRelation xmi:id="id.73" xmi:type="action:Writes" to="id.20" from="id.67"/>
<actionRelation xmi:id="id.74" xmi:type="action:Flow" to="id.75" from="id.67"/>
</codeElement>
<codeElement xmi:id="id.75" xmi:type="action:ActionElement" name="p2" kind="Assign">
<source xmi:id="id.76" language="Hla" snippet="Ind =1"/>
<codeElement xmi:id="id.77" xmi:type="code:Value" name="1" type="id.129"/>
<actionRelation xmi:id="id.78" xmi:type="action:Reads" to="id.77" from="id.75"/>
<actionRelation xmi:id="id.79" xmi:type="action:Writes" to="id.17" from="id.75"/>
<actionRelation xmi:id="id.80" xmi:type="action:Flow" to="id.49" from="id.75"/>
</codeElement>
<codeElement xmi:id="id.81" xmi:type="action:ActionElement" name="p3" kind="Compound">
<source xmi:id="id.82" language="Hla" snippet="Bal = Acc_Balance[Ind
1]"/>
<codeElement xmi:id="id.83" xmi:type="code:Value" name="1" type="id.129"/>
<codeElement xmi:id="id.84" xmi:type="code:StorableUnit" name="t1" type="id.129" ext="" kind="register"/>
<codeElement xmi:id="id.85" xmi:type="action:ActionElement" name="p3.1" kind="Subtract">
<actionRelation xmi:id="id.86" xmi:type="action:Reads" to="id.17" from="id.81"/>
<actionRelation xmi:id="id.87" xmi:type="action:Reads" to="id.83" from="id.81"/>
<actionRelation xmi:id="id.88" xmi:type="action:Writes" to="id.84" from="id.81"/>
<actionRelation xmi:id="id.89" xmi:type="action:Flow" to="id.90" from="id.85"/>
</codeElement>
<codeElement xmi:id="id.90" xmi:type="action:ActionElement" name="p3.2" kind="ArraySelect">
<actionRelation xmi:id="id.91" xmi:type="action:Addresses" to="id.14" from="id.90"/>
<actionRelation xmi:id="id.92" xmi:type="action:Reads" to="id.84" from="id.81"/>
<actionRelation xmi:id="id.93" xmi:type="action:Writes" to="id.15" from="id.81"/>
</codeElement>
<actionRelation xmi:id="id.94" xmi:type="action:Flow" to="id.85" from="id.81"/>
<actionRelation xmi:id="id.95" xmi:type="action:Flow" to="id.96" from="id.81"/>
</codeElement>
<codeElement xmi:id="id.96" xmi:type="action:ActionElement" name="p4" kind="Assign">
<source xmi:id="id.97" language="Hla" snippet="AdjustedBal = Bal + Allowance"/>
<actionRelation xmi:id="id.98" xmi:type="action:Reads" to="id.15" from="id.96"/>
<actionRelation xmi:id="id.99" xmi:type="action:Reads" to="id.20" from="id.96"/>
<actionRelation xmi:id="id.100" xmi:type="action:Writes" to="id.18" from="id.96"/>
<actionRelation xmi:id="id.101" xmi:type="action:Flow" to="id.49" from="id.96"/>
</codeElement>
<codeElement xmi:id="id.102" xmi:type="action:ActionElement" name="p5" kind="Assign">
<source xmi:id="id.103" language="Hla" snippet="If(AdjustedBal > $1000.00)"/>
<codeElement xmi:id="id.104" xmi:type="code:StorableUnit" name="t2" type="id.130" kind="register"/>
<codeElement xmi:id="id.105" xmi:type="action:ActionElement" name="p5.1" kind="GreaterThan">
<codeElement xmi:id="id.106" xmi:type="code:Value" name="1000.00" type="id.128"/>
<actionRelation xmi:id="id.107" xmi:type="action:Reads" to="id.18" from="id.105"/>
<actionRelation xmi:id="id.108" xmi:type="action:Reads" to="id.106" from="id.105"/>
<actionRelation xmi:id="id.109" xmi:type="action:Writes" to="id.104" from="id.105"/>
<actionRelation xmi:id="id.110" xmi:type="action:Flow" to="id.111" from="id.105"/>
</codeElement>
<codeElement xmi:id="id.111" xmi:type="action:ActionElement" name="p5.2" kind="GreaterThan">
<actionRelation xmi:id="id.112" xmi:type="action:Reads" to="id.104" from="id.111"/>
<actionRelation xmi:id="id.113" xmi:type="action:TrueFlow" to="id.115" from="id.111"/>
<actionRelation xmi:id="id.114" xmi:type="action:FalseFlow" to="id.120" from="id.111"/>
</codeElement>
<codeElement xmi:id="id.115" xmi:type="action:ActionElement" name="p6" kind="Assign">
<source xmi:id="id.116" language="Hla" snippet="Then ApproveTrans = True"/>
<codeElement xmi:id="id.117" xmi:type="code:Value" name="true" type="id.130"/>
<actionRelation xmi:id="id.118" xmi:type="action:Reads" to="id.117" from="id.115"/>
<actionRelation xmi:id="id.119" xmi:type="action:Writes" to="id.19" from="id.115"/>
</codeElement>
<codeElement xmi:id="id.120" xmi:type="action:ActionElement" name="p7" kind="Assign">
<source xmi:id="id.121" language="Hla" snippet="Else ApproveTrans = False"/>
<codeElement xmi:id="id.122" xmi:type="code:Value" name="false" type="id.130"/>
<actionRelation xmi:id="id.123" xmi:type="action:Reads" to="id.122" from="id.120"/>
<actionRelation xmi:id="id.124" xmi:type="action:Writes" to="id.19" from="id.120"/>
</codeElement>
<actionRelation xmi:id="id.125" xmi:type="action:Flow" to="id.105" from="id.102"/>
</codeElement>
</codeElement>
<codeElement xmi:id="id.126" xmi:type="code:LanguageUnit">
<codeElement xmi:id="id.127" xmi:type="code:StringType"/>
<codeElement xmi:id="id.128" xmi:type="code:DecimalType" name="Currency"/>
<codeElement xmi:id="id.129" xmi:type="code:IntegerType"/>
<codeElement xmi:id="id.130" xmi:type="code:BooleanType"/>
</codeElement>
</model>
<model xmi:id="id.131" xmi:type="source:InventoryModel">
<inventoryElement xmi:id="id.132" xmi:type="source:Directory" path="SOURCES\HLanguage">
<inventoryElement xmi:id="id.133" xmi:type="source:SourceFile" name="mm0245.Hla"/>
<inventoryElement xmi:id="id.134" xmi:type="source:SourceFile" name="mm0319.Hfm"/>
</inventoryElement>
<inventoryElement xmi:id="id.135" xmi:type="source:Directory" path="SOURCES\Hlib"/>
</model>
<model xmi:id="id.136" xmi:type="ui:UIModel">
<UIElement xmi:id="id.137" xmi:type="ui:Screen" name="Customer Information">
<UIElement xmi:id="id.138" xmi:type="ui:UIField" name="Customer ID">
<abstraction xmi:id="id.139" name="f1">
<actionRelation xmi:id="id.140" xmi:type="action:Writes" to="id.24" from="id.139"/>
</abstraction>
</UIElement>
<UIElement xmi:id="id.141" xmi:type="ui:UIField" name="Customer First Name">
<abstraction xmi:id="id.142" name="f2">
<actionRelation xmi:id="id.143" xmi:type="action:Writes" to="id.30" from="id.142"/>
</abstraction>
</UIElement>
<UIElement xmi:id="id.144" xmi:type="ui:UIField" name="Customer Last Name">
<abstraction xmi:id="id.145" name="f3">
<actionRelation xmi:id="id.146" xmi:type="action:Writes" to="id.36" from="id.145"/>
</abstraction>
</UIElement>
<UIElement xmi:id="id.147" xmi:type="ui:UIField" name="Account Number">
<abstraction xmi:id="id.148" name="f4">
<actionRelation xmi:id="id.149" xmi:type="action:Writes" to="id.43" from="id.148"/>
</abstraction>
</UIElement>
<UIElement xmi:id="id.150" xmi:type="ui:UIField" name="Account Type">
<abstraction xmi:id="id.151" name="f5">
<actionRelation xmi:id="id.152" xmi:type="action:Writes" to="id.52" from="id.151"/>
</abstraction>
</UIElement>
<UIElement xmi:id="id.153" xmi:type="ui:UIField" name="Account Balance">
<abstraction xmi:id="id.154" name="f6">
<actionRelation xmi:id="id.155" xmi:type="action:Writes" to="id.61" from="id.154"/>
</abstraction>
</UIElement>
</UIElement>
</model>
<model xmi:id="id.156" xmi:type="conceptual:ConceptualModel" name="Customer Information">
<conceptualElement xmi:id="id.157" xmi:type="conceptual:TermUnit" name="AccountBalance" implementation="id.15 id.12 id.17 id.153"/>
<conceptualElement xmi:id="id.158" xmi:type="conceptual:TermUnit" name="MaxAdjustedBalance" implementation="id.106"/>
<conceptualElement xmi:id="id.159" xmi:type="conceptual:TermUnit" name="AllowanceAmount" implementation="id.71"/>
<conceptualElement xmi:id="id.160" xmi:type="conceptual:TermUnit" name="Allowance" implementation="id.20"/>
<conceptualElement xmi:id="id.161" xmi:type="conceptual:TermUnit" name="AdjustedBalance" implementation="id.18"/>
<conceptualElement xmi:id="id.162" xmi:type="conceptual:TermUnit" name="AccountBalanceField" implementation="id.153"/>
<conceptualElement xmi:id="id.163" xmi:type="conceptual:FactUnit" name="AdjustedBalanceUnderThreshold" implementation="id.105">
<conceptualRelation xmi:id="id.164" xmi:type="conceptual:ConceptualFlow" to="id.178" from="id.163"/>
<conceptualRelation xmi:id="id.165" xmi:type="conceptual:ConceptualFlow" to="id.183" from="id.163"/>
<conceptualElement xmi:id="id.166" xmi:type="conceptual:ConceptualRole" name="Adjusted Balance" conceptualElement="id.161"/>
<conceptualElement xmi:id="id.167" xmi:type="conceptual:ConceptualRole" name="Threshold" conceptualElement="id.158"/>
</conceptualElement>
<conceptualElement xmi:id="id.168" xmi:type="conceptual:FactUnit" name="AccountBalanceCalculation" implementation="id.58 id.75 id.81">
<conceptualRelation xmi:id="id.169" xmi:type="conceptual:ConceptualFlow" to="id.172" from="id.168"/>
<conceptualElement xmi:id="id.170" xmi:type="conceptual:ConceptualRole" name="Boundary element" conceptualElement="id.162"/>
<conceptualElement xmi:id="id.171" xmi:type="conceptual:ConceptualRole" name="Account" conceptualElement="id.157"/>
</conceptualElement>
<conceptualElement xmi:id="id.172" xmi:type="conceptual:FactUnit" name="AdjustedBalanceCalculation" implementation="id.67 id.96">
<conceptualRelation xmi:id="id.173" xmi:type="conceptual:ConceptualFlow" to="id.163" from="id.172"/>
<conceptualElement xmi:id="id.174" xmi:type="conceptual:ConceptualRole" name="Account Balance" conceptualElement="id.168"/>
<conceptualElement xmi:id="id.175" xmi:type="conceptual:ConceptualRole" name="Allowance Amount" conceptualElement="id.159"/>
</conceptualElement>
<conceptualElement xmi:id="id.176" xmi:type="conceptual:FactUnit" name="TransactionApproved" implementation="id.19"/>
<conceptualElement xmi:id="id.177" xmi:type="conceptual:FactUnit" name="TransactionNotApproved" implementation="id.19"/>
<conceptualElement xmi:id="id.178" xmi:type="conceptual:RuleUnit" name="ApproveTransaction" implementation="id.105 id.111 id.115">
<source xmi:id="id.179" language="SBVR" snippet="Transaction is approved if adjusted balance is under the threshold"/>
<conceptualRelation xmi:id="id.180" xmi:type="conceptual:ConceptualFlow" to="id.176" from="id.178"/>
<conceptualElement xmi:id="id.181" xmi:type="conceptual:ConceptualRole" name="Condition" conceptualElement="id.163"/>
<conceptualElement xmi:id="id.182" xmi:type="conceptual:ConceptualRole" name="Consequence" conceptualElement="id.176"/>
</conceptualElement>
<conceptualElement xmi:id="id.183" xmi:type="conceptual:RuleUnit" name="TransactionFailedApproval" implementation="id.105 id.111 id.120">
<conceptualRelation xmi:id="id.184" xmi:type="conceptual:ConceptualFlow" to="id.177" from="id.183"/>
<conceptualElement xmi:id="id.185" xmi:type="conceptual:ConceptualRole" name="NOT condition" conceptualElement="id.163"/>
<conceptualElement xmi:id="id.186" xmi:type="conceptual:ConceptualRole" name="consequence" conceptualElement="id.177"/>
</conceptualElement>
<conceptualElement xmi:id="id.187" xmi:type="conceptual:ScenarioUnit">
<conceptualElement xmi:id="id.188" xmi:type="conceptual:BehaviorUnit" name="Calculate Balance" implementation="id.58 id.75 id.81">
<conceptualRelation xmi:id="id.189" xmi:type="conceptual:ConceptualFlow" to="id.190" from="id.188"/>
</conceptualElement>
<conceptualElement xmi:id="id.190" xmi:type="conceptual:BehaviorUnit" name="Calculate Adjusted Balance" implementation="id.67 id.96">
<conceptualRelation xmi:id="id.191" xmi:type="conceptual:ConceptualFlow" to="id.192" from="id.190"/>
</conceptualElement>
<conceptualElement xmi:id="id.192" xmi:type="conceptual:BehaviorUnit" name="Approve Transaction" implementation="id.102 id.115 id.120"/>
</conceptualElement>
<conceptualElement xmi:id="id.193" xmi:type="conceptual:BehaviorUnit" name="Input" implementation="id.21 id.28 id.34 id.40 id.49 id.58">
<conceptualRelation xmi:id="id.194" xmi:type="conceptual:ConceptualFlow" to="id.195" from="id.193"/>
</conceptualElement>
<conceptualElement xmi:id="id.195" xmi:type="conceptual:BehaviorUnit" name="Processing" implementation="id.67 id.75 id.81 id.85 id.90 id.96 id.102 id.105 id.111 id.115 id.120"/>
</model>
</kdm:Segment>