Hilmas User's Guide
Back Language Basics Next

Functions.

We call Function every Hilmas instruction that is implemented as function in other languages as Pascal, C, or REXX; really there is not any change in Hilmas syntax.

There are numerous "functions" in Hilmas, that we can divide in:

Usually, the first parameter of a so-called Hilmas function is the output variable, and others are input variables, similarly to a sintax like r = F(x,y); an exception is for conversion function (that have a '2' inside the name) in which there are two argument and the first is the input and the second is the output, like x => y.

 

String management

Near every REXX string management function has been translated into Hilmas and syntax also is (as far as possible) similar to REXX.
Is possible to insert, superimpose, extract a string from/into another; to search a word, to translate, delete or search characters from a string.

Remember that in LENGTH function the defined variable length is not returned; returned length is the position of the first space character after the last non-space character, that is, the "intuitive" length of a word or of a sentence.

 

Numeric functions

The strictly necessary (and more simple) numeric functions are implemented; to do things like Square Root or reckon SIN or TAN an external library must be used.

Note VALIDPAC statement, that determines if a packed number is valid: this allows to avoid some data exceptions in a program.

 

Conversion functions

The majority of these functions are numeric conversion, from/to packed, zoned, float and binary integer. There are also an hexadecimal conversion, that can be useful for debugging; but the most used of these functions will be EDIT2NUM and NUM2EDIT that allow to transform a number in characters and vice-versa: essential functions to acquire and display numbers from/to the user.

 

Miscellaneous functions

Other not classified functions: RANDOM and RANDSEED are useful to produce pseudo-random numbers (for games); TIMEDATE and CONVDATE to obtain system date and time and to transform it; SLEEP is useful to wait a number of seconds.

There are some statements that interact with operating sistem to obtain/release dynamically memory, as MEMALLOC and MEMFREE; and statements that communicate with a particular environment like REXX or system stack.

 

 


Back Start Next
Basic I/O Top File access