Using a SQL template and a datalink  Defining I/O file objects

Chapter 3: Using MSG-IDE

Defining function objects

Within a control flow, a function object defines the actions to take, either on the data itself or because of the data presence. When not within a control flow, a function object defines the actions to take to service a DFC command. Function objects are user provided routines within which you may perform all kinds of data manipulation and actions in the Object Definition Language (ODL).

When you select Function in the MSG-IDE object list and click Add, the Edit Function window displays.

When you add a function, you select the type of function you want to create by clicking one of the buttons on the top of the window. The following table lists the available function types:

Function type

Description

Initialize

Specifies any actions the ODL application must perform when initialized by executing clinit(). Start your protocol object in this function.

Acquire

Executes the clacquire().

Deinitialize

Specifies any action the ODL application must perform when deinitialized. The program executes this function after calling clQuit().

DBCallback

Builds a function that manipulates the data received from each result row of a SQL statement object. The function executes after each result row has gathered events and data in the new row.

Custom

Specify the actions to take on application data or on other objects in the AIM that you want to manipulate based on data content. You can call custom functions from within a control flow object. If necessary, you can use the same custom function in multiple control flows.

Callback

Acts as a control object. You can assign the function name, but you cannot modify the return value or arguments received. Attach the function to a control object by assigning it to the Callback Function property for that control. You can have multiple callback functions in an application, but each must have a unique name.

Validation

Used to perform validation on the data beyond normal content checking. For example, a validation function could check for a range of numbers rather than just check for numeric data entered into a numeric field.

StepsDefining function objects

  1. Select Function from the Classes list and click Add

    The Edit Function window appears.

  2. Select File | Update to check the syntax of the ODL in the function.

    If MSG-IDE finds no errors, it adds the function to the current domain, or updates it if editing an existing function, and returns focus to the Browse dialog box. If it finds an error, it displays a Syntax Errors window that lists the line(s) that contain syntax errors, along with a description of the error. Click Done in the Syntax Errors window to return to the Edit Function dialog box and fix the detected error.

  3. Select File | Exit to exit the Edit Function dialog box without checking syntax or adding the function.





Copyright © 2005. Sybase Inc. All rights reserved. Defining I/O file objects

View this book as PDF