PEEKLONG Function

Stores the contents of a memory address in a numeric variable on 32-bit and 64-bit platforms.

Category: Special
See: PEEKLONG Function: Windows in SAS Companion for Windows
PEEKLONG Function: UNIX in SAS Companion for UNIX Environments
PEEKLONG Function: z/OS in SAS Companion for z/OS

Syntax

PEEKLONG(address<,length> )

Required Argument

address

specifies a character constant, variable, or expression that contains the binary pointer address.

Optional Argument

length

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

Default 4 on 32-bit computers; 8 on 64-bit computers.
Range 1-4 on 32-bit computers; 1-8 on 64-bit computers.

Details

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

Comparisons

The PEEKLONG function stores the contents of a memory address in a numeric variable. It assumes that the input address refers to an integer in memory.
The PEEKCLONG function stores the contents of a memory address in a character variable. It assumes that the input address refers to character data.

Examples

Example 1: Example for a 32-bit Platform

The following example returns the pointer address for the numeric variable Z.
data _null_;    
   length y $4; 
   y=put(1,IB4.);    
   addry=addrlong(y);
   z=peeklong(addry,4);
   put z=; 
run;
SAS writes the following output to the log: z=1

Example 2: Example for a 64-bit Platform

The following example, specific to the z/OS operating environment, returns the pointer address for the numeric variable X.
data _null_;
   x=peeklong(put(16,pib4.));
   put x=hex8.;
run;
SAS writes the following output to the log: x=00FCFCB0

See Also

Functions: