When your data is stored in an external format for which ESL does not provide a default conversion, you must specify the name of your own external conversion routine. The routine must reside in a DLL. You specify a quoted string containing the name of the DLL file, a period, and the name of the external conversion routine as exported by the definition file for the DLL. For example:
# This is an example of a standard COBOL record.
#
# 01 RECORD-1.
# 05 INITIALS PIC XX.
# 05 FULLNAME PIC X(25)
# 05 SALARY PIC S9(4)V99.
# 05 AGE PIC9(7) COMP-5.
# This is the EASEL structure that corresponds to
# the COBOL record:
#
structure CobolRec is
string Initials using external size 2
"ESLCOB.COB_PICX"
string FullName using external size 25
"ESLCOB.COB_PICX"
string Salary using external size 6 format "6V2"
"ESLCOB.COB_PICS9"
string Age using external size 4 "ESLCOB.COB_COMP5"
end structure
In this example, all fields are stored in COBOL string format. The specified external conversion routines ESLCOB.COB_PICX, ESLCOB.COB-PICS9, and ESLCOB.COB_COMP5 convert a COBOL data type to an ESL data type, and vice versa.
# This is an example of a standard C structure:
#
# struct Employee {
# char Initials[3];
# char Fullname[26];
# float Salary; /* a C float is 4 bytes*/
# short Age; /* a C short is 2 bytes*/
# };
# This is the EASEL structure that corresponds
# to the C structure:
#
structure CStruct is
string Initials using external size 3
"ESLC.C_STRING"
string FullName using external size 26
"ESLC.C_STRING"
float Salary using external size 4 "ESLC.C_FLOAT"
integer Age using external size 2 "ESLC.C_INT"
end structure
#
# Because float and short are standard C data types, the
# following structure definition is also acceptable:
#
structure AnotherCStruct is
string Initials using external size 3
"ESLC.C_STRING"
string FullName using external size 26
"ESLC.C_STRING"
float Salary using float size 4
integer Age using integer size 2
end structure
The specified external conversion routines ESLC.C_STRING, ESLC.C_FLOAT, and ESLC.C_INT convert a C data type to an ESL data type, and vice versa.