Identify legacy runtime calls

The comma-prefixed RT calls in this list are unsupported. Use this page when reading an existing application. For a new routine on APPX 5.1 or later, check the Full API List first.

  1. Identify what the old call does, such as reading an environment variable or opening a stream.
  2. Find the supported API for that task and read its PASS order, return fields and error handling before changing the caller. The calling convention may differ.

WARNING: These are UNSUPPORTED features used to call operating system functions, and they may be changed or removed at any time. Although these may give you information useful towards fulfilling your needs, APPX Software is not responsible for the maintenance or support of these functions. It is highly recommended that developers use the API's introduced in Release 5.1.

Documentation is provided below on the following OS calls:

Things to know when reading this document

Passing data into RT calls

ubyte * = PASS statement of an alpha field, TYPE=FIELD, Share=Y

uint16* = PASS of a 2 byte numeric/binary, TYPE=FIELD, Share=Y

uint32* = PASS of a 4 byte numeric/binary, TYPE=FIELD, Share=Y (uint32* can use PDF fields --- AI,BI,CI, etc., which are 4 byte binaries)

Understanding Return values

SUCCESS puts numeric value of +1 into '--- RETURN CODE'.

FAILURE puts numeric value of 0 into '--- RETURN CODE'.

Return(x) puts return value (x) into '--- RETURN CODE'.

RT_GETENV()

Purpose

This function is used to get the value of an environment variable using a CALL statement. Put the name of the environment variable in the "buf" field, and this function will check the OS environment and return the value into "buf".

Input

ubyte * buf - source/destination buffer

uint32 * len - length (input and output)

Output

returns SUCCESS if environment variable is translated, FAILURE otherwise.

example

        TRAP
        SET      --- TEMP 32         =      WINDIR
        SET      --- WORK UINT32     =      32
        PASS     --- TEMP 32         FIELD            SHARE? Y
        PASS     --- WORK UINT32     FIELD            SHARE? Y
        CALL         ,RT_GETENV      RESIDENT? Y  END? N  FAIL 0
        SET      --- TEMP 32         =  --- TEMP 32

In this example, --- TEMP 32 is set to the environment variable you want to retrieve (in this case APPXPATH).

"--- WORK UINT32" is set to the length of the first field passed (in this case 32). You can use your own field here, but it has to be defined as a 4 byte unsigned binary number.

Be user and change 'SHARE' and 'RESIDENT?' from 'N' to 'Y'.

If the CALL is successful, --- TEMP 32 will contain the value of the PASSed environment variable.

(thanks to Morgan for this example and explanatory text.)

RT_GETPARAM()

Purpose

This function is similar in working style to rt_getenv(), but instead of pulling information from the environment, data is drawn from the command line. APPX has already stripped out the parameters it has used in the BI process (actually parsed in SS), so we will only be looking at what is left.

DESCRIPTION:The App. will call rt_getparam() with a string parameter. The function will then look for that string on the command line (either alone or in the form STRING=VALUE). If it is found, in either form, SUCCESS will be returned. The value associated with the parameter will then be translated into STRING (which originally held the name of the parameter. If the parameter is found alone, then blanks will be placed in the string. A return value of SUCCESS indicates that the parameter was present on the commmand line (and that the value of the string is worth taking a look at). A return value of FAILURE indicates that the parameter was not found on the command line, and the original value of the string is maintained.

Input

ubyte * buf - source/destination buffer

uint32 * len - length (input and output)

Output

returns SUCCESS if string was found, FAILURE otherwise.

RT_GET_PROC_NAM()

Purpose

This function will return the Process Name of the PARENT process of the current process.

Input

ubyte * proc_nam - pointer for result

Output

This function will return SUCCESS and the Process Name of the current process's parent (if possible), otherwise will return FAILURE.

RT_SLEEP()

Purpose

This function will allow the App. to tap into the system sleep routine. This will cause APPX to stop running (and stop taking up CPU time) until a certain number of seconds have elapsed.

Input

uint16 * time - number of seconds to sleep

Output

This rt function will always return SUCCESS.

RT_OPEN_STREAM()

Purpose

This function opens a simple stream file using the path, filename, and mode provided. It then returns a FILE pointer to be used by rt_read_stream, rt_write_stream, & rt_close_stream.

Input

ubyte * f_name /Path/Filenameof file to open. NULL Terminate

ubyte * f_mode File Mode to Open as. NULL Terminate

uint32* f_ptr Empty field to capture file pointer

Output

This function will return SUCCESS, unless APPX has a problem opening the requested file.

RT_WRITE_STREAM()

Purpose

This function is used to write a raw text buffer to a standard unix file.

Input

ubyte * d_buff Data Buffer to write. NULL Terminate

uint32* f_ptr File pointer to open stream.

Output

This function returns SUCCESS if the bytes written match the number of bytes in the input string..

RT_READ_STREAM()

Purpose

This function is used to read a raw text buffer from a standard unix file.

Input

ubyte * data_buf Data Buffer to write into the above file

uint32* max_len Max buffer len of field passed in f_name

uint32* f_ptr Pointer to open file.

Output

This function returns SUCCESS if it reads more than 0 bytes.

READ_STREAM does not initialize 'data_buf' before reading data from the target file.

An end-of-line delimiter (hex(0a)) will terminate reading in the current READ_STREAM invocation, to be started at the character thereafter in a subsequent READ_STREAM invocation.

RT_CLOSE_STREAM()

Purpose

This function is used to close a stream file.

Input

uint32* f_ptr File pointer.

Output

returns SUCCESS if the file is successfully closed.

All we did was "wrap" the C function fgets() to get a string from a file. The fgets() function returns a string value from the characters in the file up to and including the end-of-line character(s). In unix, this is 0x0A. In Windows this is 0x0D/0x0A. Strings in C are NULL terminated with a 0x00 value.

So, if you pass in an ALPHA field with all spaces 0x20, and read a value from a file of "1234", you would wind up with an ALPHA field containing the following:

0x31 0x32 0x33 0x34 0x0A 0x00 0x20 0x20 0x20 ...

The normal way to locate the end of a C string using APPX ILF is to test if ALPHA "IN" a NULL and then back up one more character to step over the end-of-line character, or two if running under Windows.

This is why these are not openly documented or supported. They were shortcuts to satisfy an immediate need of our or a customer and are not always the perfect or easy to understand solution for everyone.

Comments:

Read what other users have said about this page or add your own comments.


 
Topic revision: r4 - 03 Dec 2026, AdminUser - This page was cached on 03 Dec 2026 - 19:42.

Powered by Foswiki. Wiki content belongs to its contributing authors.