Implementing Methods

Each programming language may implement methods in its own way. For example, C++ and Java implement class methods as discrete code modules and have a syntax to declare an entry reference (or label) as a method. Like a function or subroutine, the source code within a method determines the behavior and characteristics of the method. Methods contain various levels of visibility and can be referenced by other methods through a look-up process resolved either at compile time or run time.

PSL implements methods as records within the Class Methods database table (OBJECTMET). The records include an M subroutine reference that is called by the PSL compiler when it encounters a method reference in the source code. For example, to implement the Db.getRecord method, the compiler executes the subroutine, getRecord^UCDB.

The subroutine acts as an extension to the PSL compiler by generating M code to implement the method. The PSL compiler processes the PSL input source code top to bottom and left to right. When the PSL compiler calls the method-implementing subroutine, its symbol table contains state information that can be utilized by the subroutine.

Method implementing subroutines may just generate straight code, or they may generate code that depends on the target database (Oracle or M) or on surrounding code (database load optimization).

Special rules and guidelines apply to method implementing subroutines. Please see the appropriate documentation.

For additional information concerning implementing methods, refer to the following sections:

Method Return Expressions

Organization of Method-Building Subroutines

Variables Used within Method Subroutines

Functions that Support Method Coding

Optimizing Method Code

Using DATA-QWIK Column Protection in Db.select and ResultSet