Previous Topic: RHDCEVBFNext Topic: Changing Invocation Names


#EFUNMOD

Purpose

Defines a model XDE module and the model XDE tables within the module.

Each model XDE table describes one function. During process compilation of a built-in function, the dialog compiler uses the appropriate model XDE table to convert the built-in function into a series of XDEs, which represents the function at runtime.

Syntax

►►─── #EFUNMOD TYPE = ──┬─ INITIAL, NAME = model-xde-module-name ────┬────────►◄
                        │                                            │
                        ├─ HDR, hdr-options──────────────────────────┤
                        │                                            │
                        ├─ XDE, DECS = decimal-options ──────────────┤
                        │                                            │
                        ├─ DATA, CONV = ( conv-options ) ────────────┤
                        │                                            │
                        └─ FINAL ────────────────────────────────────┘

Expansion of hdr-options

►►─── FUNCNAM = function-name ── , ───────────────────────────────────────────►

 ►─── PROGRAM = processing-program-name ── , ─────────────────────────────────►

 ►─── FUNCNBR = function-number ── , ─────────────────────────────────────────►

 ►─── WORKLNG = work-area-length ── , ────────────────────────────────────────►

 ►─── FIXOPND = fixed-operands-count ── , ────────────────────────────────────►

 ►─┬─────────────────────────────┬────────────────────────────────────────────►
   └─ VAROPND = ─┬─ YES ──┬── , ─┘
                 └─ NO ◄ ─┘

 ►─── RESLNG = ──┬─ CALC────────────┬── , ────────────────────────────────────►
                 ├─ OPND ───────────┤
                 └─ result-length ──┘

 ►─── RESDATP = ──┬─ OPND ───────┬── , ───────────────────────────────────────►
                  └─ data-type ──┘

 ►─── RESDEC = ───┬─ OPND ──────────────────┬─────────────────────────────────►◄
                  └─ result-decimal-places ─┘

Expansion of decimal-options

►►─┬─ SOURCE ─────────┬─ , ────────┬────────────────────────┬─────────────────►
   └─ decimal-places ─┘            └─ OPT = ─┬─ YES ──┬─ , ─┘
                                             └─ NO ◄ ─┘

 ►─┬──────────────────────────┬────┬───────────────────────────┬──────────────►
   └─ ROUND = ─┬─ YES ◄ ─┬ , ─┘    └─ RESLCAL = ─┬─ ADD ──┬ , ─┘
               └─ NO ────┘                       └─ SUBT ─┘

 ►─┬────────────────────────┬─────────────────────────────────────────────────►◄
   └─ RESDEFL = ─┬─ YES ──┬─┘
                 └─ NO ◄ ─┘

Expansion of source-specification

►►─── source-data-type ── , ─┬─ SOURCE ───────────┬─┬──────────────────┬──────►◄
                             └─ target-data-type ─┘ ├─ ,SOURCE ────────┤
                                                    └─ ,target-length ─┘
Expansion of hdr-options
Expansion of decimal-options
Expansion of source-specification

Parameters

INITIAL, NAME = model-xde-module-name

Specifies the 1- to 8-character model XDE module name.

The TYPE=INITIAL macro is coded first and only once in the assembler program.

HDR, hdr-options

Defines the beginning of a model XDE table and specifies function XDE information.

One TYPE=HDR macro is coded for each model XDE table.

See expansion of hdr-options below.

XDE, DECS = decimal-options

Specifies operand XDE information that describes a target parameter.

The TYPE=XDE macro describes a function parameter. One TYPE=XDE macro is coded for each parameter in the order that the parameter is to appear in the parameter list.

DECS = decimal-options is used to specify the number of decimal places in the target parameter being described.

See the expansion of decimal-options below.

DATA, CONV = (conv-options)

Specifies the data type and length of the target parameter (that is, the parameter as it is stored in the IRA for use by the processing program), based on the data type of the source parameter (that is, the parameter as it is coded in the parameter list).

See expansion of conv-options below.

At least one TYPE=DATA macro must be coded following a TYPE=XDE macro. If two or more are specified, the dialog compiler uses the TYPE=DATA macro whose source-data-type specification matches the data type of the source parameter. If no source-data-type specification matches, the last TYPE=DATA macro is used.

Note: During process compilation, any combination of source and target parameter data types is accepted. At runtime, the runtime system attempts to make any required data type conversions; if it cannot, the dialog aborts.

FINAL

Defines the end of the model XDE module.

Expansion of hdr-options

FUNCNAM= function-name

User-defined parameter specifying the 1- to 8-character real (generic) function name.

The real function name associates a master function table entry with the model XDE table.

PROGRAM= processing-program-name

User-defined parameters specifying the 1- to 8-character name of the processing program module that contains the processing program for the function.

FUNCNBR= function-number

User-supplied numeric literal specifying a number from 0 to 255 that uniquely identifies the associated processing program within the processing program module.

WORKLNG= work-area-length

User-supplied numeric literal specifying the number of bytes of work area required by the processing program module for the function.

The WORKLNG specification should not include work space required by the runtime system, which is automatically added by the macro.

Note: Work-area-length must be at least 80.

FIXOPND= fixed-operands-count

User-supplied numeric literal specifying the number of fixed parameters for the function.

A fixed parameter is a parameter that can be specified only once in a parameter list. A function can have from 0 to 50 fixed parameters.

VAROPND=YES/NO

Specifies whether one parameter in the parameter list is variable.

A variable parameter can be specified repeatedly in a parameter list. (An example of a variable parameter is 'string' or string-variable in the concatenate function.)

A function can have only one variable parameter and it must follow all fixed parameters.

The default VAROPND specification is NO.

RESLNG=

Clause introducing the length, in bytes, of the function's result field,

CALC

Specifies that the result field length is calculated from the lengths of the function parameters, based on the RESLNG specification of each parameter's TYPE=XDE macro.

If CALC is specified, the result field length is calculated as the sum of the lengths of the function parameters whose RESLNG specification is ADD, minus the sum of the lengths of the function parameters whose RESLNG specification is SUBT. Parameters without a RESLNG specification are not included in the calculation.

OPND

Specifies that the result length is equal to the length of the function parameter whose RESDEFL specification is YES.

result-length

Specifies a result length, in bytes, from 1 to 32767.

RESDATP=

Clause introducing the data type of the function's result field of the function.

OPND

Specifies that the result data type is the same as the data type of the function parameter whose RESDEFL specification is YES.

data-type

User-defined parameter specifying the result field data type.

Data-type is one of the three-character data type abbreviations shown in the table under Usage below.

RESDEC=

Clause introducing the number of decimal places in the function's result field.

OPND

Specifies that the number of decimal places is equal to the number of decimal places in the function parameter whose RESDEFL specification is YES.

result-decimal-places

Specifies the number of result decimal places, from 0 to 32.

Expansion of decimal-options

SOURCE

Specifies that the number of decimal places equals the number of decimal places in the source parameter.

decimal-places

Specifies the number of decimal places, from 0 to 32.

OPT=YES/NO

Specifies whether the parameter is optional and can be omitted from the coded parameter list.

NO is the default when neither YES or NO is specified.

ROUND=YES/NO

Specifies whether rounding or truncation is used when converting from the source parameter to the target parameter. NO indicates truncation.

YES is the default when neither YES or NO is specified.

RESLCAL=

Clause introducing the action to be taken to the parameters length in the calculation of the length of the result field.

ADD

Specifies that the parameter's length is added in the calculation of the length of the result field.

SUBT

Specifies that the parameter's length is subtracted in the calculation of the length of the result field.

The RESLCAL specification should be included only if the RESLNG specification of the preceding TYPE=HDR macro is CALC. If the RESLCAL specification is omitted, the parameter's length is not considered in the calculation of the length of the result field.

RESDEFL=YES/NO

Specifies whether the parameter is used to determine result field characteristics that are specified in the associated TYPE=HDR macro as OPND.

Only one TYPE=XDE macro for a function can specify RESDEFL=YES.

The default RESDEFL specification is NO.

Expansion of conv-options

source-data-type

User-defined parameters specifying the three-character abbreviation of the data type of the source parameter; these abbreviations are listed in the table under Usage below.

During process compilation, if the data type of the source parameter is source-data-type, then the target parameter is assigned a data type of SOURCE/target-data-type and a length of SOURCE/target-length. The target parameter's data type and length are stored in the parameter's operand XDE.

SOURCE

Specifies that the data type of the target parameter is the same as the data type of the source parameter.

target-data-type

User-defined parameters specifying the three-character abbreviation of the data type of the target parameter; these abbreviations are listed in the table under Usage below.

SOURCE

Specifies that the length of the target parameters is the same as the length of the source parameter.

target-length

Specifies the length of the target parameter in bytes.

If neither is specified, a length is generated based on the data type of the target parameter, if possible.

Usage

Considerations

Data Type Abbreviations

Data type

Abbreviation

Display floating point

DFL

Doubleword binary

DWB

EBCDIC

EBD

Fullword binary

FWB

Group

GRP

Halfword binary

HWB

Long floating point

LFL

Multibit binary

MBB

Short floating point

SFL

Signed packed decimal

SPK

Signed zoned decimal

SZN

Unsigned packed decimal

UPK

Unsigned zoned decimal

UZN

Varying character

VCH

Note: Only target parameters and the result field can have the varying character data type. A varying character field consists of a halfword binary field that specifies the length of the varying character string, followed by a fixed field that contains the string itself.

Model XDE Modules

The model XDE modules for the CA ADS supplied built-in functions are defined by the source assembler programs called RHDCEV51, RHDCEV52, and RHDCEV53. Segments of RHDCEV51 are shown below. An installation should not change these modules, but can reference them as guides for creating user-defined built-in functions.

Segments of Source Assembler Program RHDCEV51

RHDCEV51 TITLE 'EVAL - BUILT-IN STRING FUNCTIONS - MODEL XDE TBL'
* RHDCEV51 EP=RHDCEV51                    06/29/90 14:05:40
         SPACE 3
RHDCEV51 AMODE ANY
RHDCEV51 RMODE 24
         #EFUNMOD TYPE=INITIAL,NAME=RHDCEV51
         EJECT
**********************************************************************
*        FUNCTION = LENGTH                                           *
**********************************************************************
         SPACE 3
LENGTH   #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=LENGTH,                                         X
               FUNCNBR=0,                                              X
               PROGRAM=RHDCEV01,                                       X
               WORKLNG=148,                                            X
               FIXOPND=1,                                              X
               RESLNG=2,                                               X
               RESDATP=HWB,                                            X
               RESDEC=0
         SPACE 1
         #EFUNMOD TYPE=XDE,DECS=0,OPT=NO
         SPACE 1
         #EFUNMOD TYPE=DATA,CONV=(EBD,VCH,SOURCE)
         EJECT
**********************************************************************
*        FUNCTION = SUBSTRING                                        *
**********************************************************************
         SPACE 3
SUBSTRNG #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=SUBSTRNG,                                       X
               FUNCNBR=1,                                              X
               PROGRAM=RHDCEV01,                                       X
               WORKLNG=148,                                            X
               FIXOPND=3,                                              X
               RESLNG=CALC,                                            X
               RESDATP=VCH,                                            X
               RESDEC=0
         SPACE 1
         #EFUNMOD TYPE=XDE,DECS=0,OPT=NO,RESLCAL=ADD
         SPACE 1
         #EFUNMOD TYPE=DATA,CONV=(EBD,VCH,SOURCE)
         SPACE 1
         #EFUNMOD TYPE=XDE,DECS=0,OPT=NO
         SPACE 1
         #EFUNMOD TYPE=DATA,CONV=(EBD,HWB,2)
         SPACE 1
         #EFUNMOD TYPE=XDE,DECS=0,OPT=YES
         SPACE 1
         #EFUNMOD TYPE=DATA,CONV=(EBD,HWB,2)
         EJECT
    ...
         #EFUNMOD TYPE=FINAL
         SPACE 2
         END   RHDCEV51                                    *CRM84199*