Previous Topic: Processing Program ModulesNext Topic: Assembler Macros


Runtime Processing of Built-In Functions

At runtime, the following processing sequence occurs for each function:

  1. The runtime system begins processing the function, as follows:
  2. The processing program continues processing the function, as follows:
  3. The runtime system finishes processing the function by checking the value returned in register 15. If register 15 equals 0, the runtime system resumes the process. The result of the function is used in the statement in which the function is coded. If register 15 is greater than 0, the runtime system aborts the dialog and displays the Dialog Abort Information screen along with the optional error message.

Internal Representation of a Function at Run Time

The internal representation of a substring function is illustrated below.

An arrow indicates that the source structure contains the address of the object structure, illustrating that the processing program module can use register 1 to gain access to all required information.

Field names containing the addresses are listed next to the arrows.

 SUBSTRING(EMP-NAME, START-POS-1)

 XDEs                       VXDEs                      INTERMEDIATE RESULT AREA
┌───────────────┐          ┌───────────────┐            ┌─────────────────────┐
│Operand XDE    │ VXDEXDEA │Operand VXDE   │ VXDEDADR   │                     │
│for first      ◄──────────┤for first      ├────────────►  │First parameter │ │
│parameter      │          │parameter      │            │  └────────────────┘ │
│(EMP-NAME)     │          │(EMP-NAME)     │            │                     │
└───────────────┘          └───────────────┘            │                     │
                                  ▲                  ┌──►  │Second parameter│ │
                                  │ VXDESNXT         │  │  └────────────────┘ │
┌───────────────┐          ┌──────┴────────┐         │  │                     │
│Operand XDE    │ VXDEXDEA │Operand VXDE   │ VXDEDADR│  │                     │
│for second     ◄──────────┤for second     ├─────────┘  │                     │
│parameter      │          │parameter      │         ┌──►  │Result field    │ │
│(START-POS-1)  │          │(START-POS-1)  │         │  │  └────────────────┘ │
└───────────────┘          └───────────────┘         │  └─────────────────────┘
                                  ▲                  │
                                  │ VXDESNXT         │
┌───────────────┐          ┌──────┴────────┐         │
│Dummy operand  │ VXDEXDEA │Dummy operand  │         │
│XDE for omitted◄──────────┤VXDE for omit─ │         │
│third parameter│          │ted third      │         │
└───────────────┘          │parameter      │         │
                           └───────────────┘         │
                                  ▲                  │
                                  │ VXDESNXT         │
┌───────────────┐          ┌──────┴────────┐ VXDEDADR│  ┌───────────────────┐
│Function XDE   │ VXDEXDEA │Function VXDE  ├─────────┘  │                   │
│for substring  ◄──────────┤for substring  ├────────────►     WORK AREA     │
│function       │          │function       │ VXDEUWKA   │                   │
└───────────────┘          └───────────────┘            └───────────────────┘
                                  ▲
                                  │
                           ┌──────┴────────┐
                           │  Register 1   │
                           │               │
                           └───────────────┘

More information:

Steps for Generating a User-Defined Built-In Function