Previous Topic: LU2()

Next Topic: MLWTO()

MEMORY()

Use the MEMORY() function to fetch or store memory contents.

Note: If you are not using the appropriate address space ID and storage protection key, the MEMORY() function fails.

Syntax

The MEMORY() function has this syntax:

Form 1:

result = MEMORY({Fetch|FetchN|FetchNX|FetchX},loc,bytes)

Form 2:

MEMORY(STORE,loc,bytes,value,[verify])

Arguments

The MEMORY() function takes these arguments:

result

Returned data (on a successful fetch operation), null string (on a successful store operation), or error text.

FETCH

Retrieves a character string from memory. No data conversion is performed. May be abbreviated to F.

FETCHX

Retrieves a character string from memory with the high-order bit always turned off. Use FETCHX to access a hexadecimal address. May be abbreviated to FX.

FETCHN

Retrieves a value from memory and converts it to a decimal value. This value will be positive or negative, depending upon the high-order bit in the source string. May be abbreviated to FN.

FETCHNX

Retrieves a value from memory, discards the high-order bit, and returns the remaining positive value as a decimal number. May be abbreviated to FNX.

STORE

Stores the specified string in memory. The stored string is not converted but is stored as is.

loc

Memory address of the storage area to be accessed.

bytes

Number of bytes to retrieve or store. The maximum number is 256 for a binary string (no conversion). FETCHX, FETCHN, and FETCHNX have a limit of 8 bytes.

value

Value to replace the current storage contents. The length must be the same as specified by the bytes argument. No type conversion is performed; value is assumed to specify data in the same format that it is to be stored.

verify

Memory location's current binary value. If the value you specify does not match the actual value, the store operation is not carried out.

Return Codes

The MEMORY() function produces these return codes:

101 - 109 ARG n MISSING OR INVALID

124 VERIFY FAILED

125 FETCHN INVALID FOR SPECIFIED LENGTH

126 EXCESS ARGUMENTS

Example

memory('f',16,4)  == '80FD7508'x    /* A data string, no 
                                       conversion */
memory('fx',16,4) == '00FD7508'x    /* A data string, high bit
                                       off */
memory('fn',16,4) == '-2164094216'  /* A signed decimal
                                       conversion */
memory('fnx',16,4)== '16610568'     /* Decimal conversion, high
                                     bit off*/