PEEKC Function

Stores the contents of a memory address in a character variable on a 32-bit platform.

Category: Special
Restriction: Use on 32-bit platforms only.

Syntax

PEEKC(address<,length> )

Required Argument

address

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

Optional Argument

length

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

Default 8, unless the variable length has already been set (by the LENGTH statement, for example)
Range 1–32,767

Details

If you do not have access to the memory storage location that you are requesting, the PEEKC function returns an "Invalid argument" error.
You cannot use the PEEKC 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 PEEKC, change the applications and use PEEKCLONG instead. You can use PEEKCLONG on both 32–bit and 64–bit platforms.

Comparisons

The PEEKC function stores the contents of a memory address into a character variable. The PEEK function stores the contents of a memory address into a numeric variable.
Note: SAS recommends that you use PEEKCLONG instead of PEEKC because PEEKCLONG can be used on both 32–bit and 64–bit platforms.

Example: Listing ASCB Bytes

The following example, specific to the z/OS operating environment, uses both PEEK and PEEKC, and prints the first four bytes of the Address Space Control Block (ASCB).
data _null_;
   length y $4;
      /* 220x is the location of the ASCB pointer */
   x=220x; 
   y=peekc(peek(x));
   put 'y= ' y;
run;

See Also

CALL Routines: