Function 2

160 Views


There are two ways that a function can be implemented:

· External - the function is implemented as a separate HLL program.

· Internal - the function is implemented as source code within that of the calling function.

There are a number of different function types which fall into the four classes listed below.

· Standard functions · Built-In functions · Function fields · Message functions

Database Functions

Database functions specify basic routines for updating the database. There are four different database functions, each defining a subroutine to either create, change, delete, or retrieve data. Database functions are implemented as part of an external standard function. All database functions are internal functions

· Create Object (CRTOBJ)

· Change Object (CHGOBJ)

· Delete Object (DLTOBJ)

· Retrieve Object (RTVOBJ)

Device Functions

Device functions specify interactive programs of a number of types, and also report programs. These programs consist of either a panel design or report design and an action diagram. Device functions are external functions.

You implement device functions as programs that operate over databases. The device functions are:

· Display Record (DSPRCD) · Display Record 2 panels (DSPRCD2) · Display Record 3 panels (DSPRCD3) · Prompt Record (PMTRCD) · Edit Record (EDTRCD) · Edit Record 2 panels (EDTRCD2) · Edit Record 3 panels (EDTRCD3) · Display File (DSPFIL) · Edit File (EDTFIL) · Select Record (SELRCD) · Display Transaction (DSPTRN) · Edit Transaction (EDTTRN) · Print File (PRTFIL) · Print Object (PRTOBJ)

User Functions

User functions specify additional building blocks of user-written processing. User functions provide a means of incorporating user programs and subroutines into Synon/2E generated applications. Their processing steps can be specified with action diagrams or user-written HLL.

· Execute Internal Function (EXCINTFUN)

· Execute External Function (EXCEXTFUN)

· Execute User Program (EXCUSRPGM)

· Execute User Source (EXCUSRSRC)

Built-In Functions

Built-in functions execute common low-level functions such as arithmetic operations, character string manipulations, and control operations such as commitment control and program exit.

Built-in functions are specified within action diagrams and are implemented as inline source code within calling functions.

The built-in functions are:

*ADD Add
*COMMIT Commit
*COMPUTE Compute 
*CONCAT Concatenation 
*CVTVAR Convert Variable 
*DATE DETAILS Date Details 
*DATE INCREMENT Date Increment 
*DIV Divide 
*DIV WITH REMAINDER Divide with Remainder 
*DURATION Date Duration 
*ELAPSED TIME Elapsed Time 
*EXIT PROGRAM Exit Program 
*MODULO Modulo 
*MOVE Move 
*MOVE ALL Move All 
*MULT Multiply 
*QUIT Quit 
*ROLLBACK Rollback 
*RTVCND Retrieve Condition 
*SET CURSOR Set Cursor 
*SUB Subtract 
*SUBSTRING Substring 
*TIME DETAILS Time Details 
*TIME INCREMENT Time Increment

Function Fields

A function field is a field whose value is not physically stored in the database, but is derived from other fields or files.

Function fields are always associated with only one result parameter, the derived field itself, along with a variable number of input parameters that are used to derive the calculation.

Synon/2E also provides a number of ready-made function fields such as summing or counting that can be called within a function.

Once the function field is defined, Synon/2E automatically incorporates its associated processing logic when it is used.

The function fields are: · Sum (SUM) · Maximum (MAX) · Minimum (MIN) · Count (CNT) · Derived (DRV) · User (USR)

Message Functions

Message functions define messages that you want to appear at a workstation using special Synon/2E facilities, or they define other variables for use by the function.

The message functions are:

· Send Error Message (SNDERRMSG)

· Send Information Message (SNDINFMSG)

· Send Complete Message (SNDCMPMSG)

· Send Status Message (SNDSTSMSG)

· Retrieve Message (RTVMSG)

· Execute Message (EXCMSG)

Basic Properties of Functions

Synon/2E functions have the following properties.

Function Names:The name of each function can contain up to 25 characters including any embedded blanks, and must be unique within a given file. Function Components Functions generally consist of the following components: function options, parameters, device designs, and action diagrams. Function Options Function options allow you to customize the features of your functions including database changes, display features, exit control, commitment control, exception routines, generation options, and environment options.

Parameters: Parameters specify which field values are to be passed into the function at execution and which fields are to be returned from the function on completion. In addition, parameters are used to define local variables for the function.

Device Designs: Device designs specify the visual presentation of the two types of devices used by the functions, which are

· Panel (display)

· Report

Action Diagrams: Action diagrams specify the processing steps for the program function logic. This is a combination of default (Synon/2E supplied) logic and optional user-defined processing logic. The following table shows which component applies to each function type:

Post Comments