Sample HLC application
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
This topic explains how to use the Tank sample application. This application is shipped with OpenEdge that you can use to verify that your HLC environment is set up correctly. The C code and sample output for this sample application are provided in the following directories:
$DLC/oebuild/hlc/examplesOn
Windows%DLC%\oebuild\hlc\examplesThe Tank sample application uses OpenEdge to keep track of oil storage tanks. The ABL procedure calls a C program, AVCALC, to calculate the available capacity for a given oil storage tank. The following figure shows that the tanks are cylindrical, with their axes parallel to the level ground.

To calculate the available capacity (empty portion) of the tank, you need to know the diameter, length, and current level of oil for the tank.

Where
- r
- Radius of the tank
- length
- Length of the tank
- level
- Level of oil in the tank
For this example, assume there is a tank table for this sample application that contains the following decimal fields:
- radius
- Radius of tank
- tlength
- Length of tank
- depth
- Level of oil—must be between 0 and (2 . radius)
- tavail
- Available volume in tank
In addition to these fields, the tank-id character field
is used as the primary index.
The following example shows the Data Dictionary report for the Tank sample application.
Data Dictionary report for the Tank sample application
|
A C function calculates the tavail field from the other
three decimal fields (radius, tlength,
depth). The following example shows the ABL procedure that invokes the C
function by calling the HLC routine, AVCALC.
ABL procedure calling HLC routine AVCALC
|
Make a copy of the HLC dispatch routine, hlprodsp.c, and name it tankdsp.c. Modify the
routine so an entry appears for AVCALC which calls the C
subroutine hlvcalc.
The hlprodsp.c example shows the
modifications to the tankdsp.c routine.
hlprodsp.c
|
The following procedure shows the code for the demo program hlvcalc.c. The program extracts the radius, length, and level
fields from the shared buffer tank, calculates the available volume, and updates the
tavail field in the shared buffer tank with the number calculated.
hlvcalc.c
|