Instrinsic M Functions

Most intrinsic M functions are supported as instrinsic methods of a primitive class (e.g., String, Number, Date, Boolean, Time). The parameter list for the methods is the same as it was for the M functions, except that the first parameter is eliminated as it is now the object identifier. For example,

// M function

      set x = $P(y,"|",2)

 

//is the same as PSL method

set x = y.piece("|",2)

However, you may need to add explicit typecasting to prevent method mismatch warnings. Use the following PSL intrinsic methods instead of the associated M intrinsic function. No other M intrinsic functions are supported by PSL.

Replace M Instrinsic Function...

With PSL Instrinsic Method...

$ASCII

String.ascii()

$CHAR

Copied.(*)

$DATA

Consider recoding into Object.exists(), unless the code explicitly or implicitly uses the values 10 and 11.

$EXTRACT

String.extract

$FIND

String.find()

$FNUMBER

Number.fnumber()

$GET

Primitive.get()

$JUSTIFY

String.justify() or Number.roundDec()

$LENGTH

String.length()

$ORDER

Object.order()

$PIECE

String.piece()

$QUERY

Object.query()

$RANDOM

Number.random()

$SELECT

Copied.

$TRANSLATE

String.translate()

$ZDATE

Although this function is copied, consider replacing by Date.toString().

$ZJOBEXAM

Copied.

(*) Copied indicates that the function is not part of the official PSL specification. However, you can simply copy the code from the PSL source to the M target routine.