TAL Programmer's Guide
Using Extended Data Segments
Managing Addressing
B–14 096254 Tandem Computers Incorporated
Accessing Data in an Extended Segment
After you declare a pointer and store an address in the pointer, you can use an
assignment or move statement to place an item at the location pointed to by the
pointer.
For example, you can declare a structure, declare and initialize an INT extended
structure pointer, and then access byte-addressed structure items in the current
extended data segment. In this case, a move statement copies a character string into an
array in the structure:
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (
? SEGMENT_ALLOCATE_, SEGMENT_USE_)
PROC xsegment MAIN;
BEGIN
DEFINE error = ! ...! #; !Error handling routine
STRUCT name_rec (
*
); !Declare template structure
BEGIN
STRING name[0:25];
END;
INT .EXT ext_seg(name_rec); !Pointer for base address
! of extended segment
INT s;
!Lots of code
s := SEGMENT_ALLOCATE_ (0, 4096D, , , , , ext_seg);
!Allocate extended segment 0;
! assign status value to S;
! request 2 pages of extended
! memory; store base address
! in EXT_SEG
IF s <> 0 THEN error; !Continue if segment 0 is
!allocated; else return error
s := SEGMENT_USE_ (0, , ext_seg);
!Make segment 0 the current
! extended segment
IF s <> 0 THEN error; !Continue if segment 0 is
!current; else return error
ext_seg.name[0] ':=' "Octavius Q. Pumpernickle";
!Copy data into array
END;