Previous Page | Next Page

Functions and CALL Routines

PEEK Function



Stores the contents of a memory address in a numeric variable on a 32-bit platform.
Category: Special
Restriction: Use on 32-bit platforms only.

Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

PEEK(address<,length>)


Arguments

address

is a numeric constant, variable, or expression that specifies the memory address.

length

is a numeric constant, variable, or expression that specifies the data length.

Default: a 4-byte address pointer
Range: 2 to 8

Details

If you do not have access to the memory storage location that you are requesting, the PEEK function returns an "Invalid argument" error.

You cannot use the PEEK function on 64-bit platforms. If you attempt to use it, SAS writes a message to the log stating that this restriction applies. If you have legacy applications that use PEEK, change the applications and use PEEKLONG instead. You can use PEEKLONG on both 32-bit and 64-bit platforms.


Comparisons

The PEEK function stores the contents of a memory address into a numeric variable. The PEEKC function stores the contents of a memory address into a character variable.

Note:   SAS recommends that you use PEEKLONG instead of PEEK because PEEKLONG can be used on both 32-bit and 64-bit platforms.   [cautionend]


Examples

The following example, specific to the z/OS operating environment, returns a numeric value that represents the address of the Communication Vector Table (CVT).

data _null_;
      /* 16 is the location of the CVT address */
   y=16; 
   x=peek(y);
   put 'x= ' x hex8.;
run;


See Also

Functions:

ADDR Function

PEEKC Function

CALL Routine:

CALL POKE Routine

Previous Page | Next Page | Top of Page