Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 22
Accessing Data in Extended Data Segments
The program can safely create or share a selectable segment without selecting it,
instead using the MOVEX procedure to copy data between it and the normal program
environment.
Accessing Data in Extended Data Segments
You can access data in flat segments and selectable segments by using Guardian
procedures. In addition, you can access data in selectable segments by using
extended indirect arrays from an application written in TAL or other languages
supported by the TNS environment.
To access data in an extended data segment using Guardian procedures, you must
first allocate the segments you need using the SEGMENT_ALLOCATE_
procedure. If the segment is a selectable segment, you must then specify the
segment you want to use by calling the SEGMENT_USE_ procedure. (If the
segment is a flat segment, you need not call SEGMENT_USE_.) For all segments,
this method lets you allocate as many extended data segments as you need up to
a total of:
480 megabytes on G04.00 and earlier G-series releases and all D-series
releases
1120 megabytes on G05.00 and subsequent G-series releases
1536 megabytes on all H-series and J-series releases
For selectable segments, you can use only one segment at a time. For flat
segments, you can access any of the allocated segments.
To access data in a selectable segment using extended indirect arrays, you can
simply declare the array using the .EXT keyword. TAL automatically allocates an
extended data segment for your program:
INT .EXT MYDATA[0:99];
This example declares a 100-word array.
Extended indirect arrays, although easy to use, provide access to only one
selectable segment.
For a TNS C program using the Large or Wide model, or a COBOL, FORTRAN, or
Pascal program, the compiler can also place data in a selectable data segment,
which also typically contains the heap.
The native compilers do not create selectable segments. In pTAL, the preceding
example would place MYDATA in the globals segment or, for a local declaration, in
the stack frame.
When accessing selectable segments in a TNS program, you should choose one
method or the other. You should not mix the two methods.
For more details on how to use indirect extended arrays, see the TACL Reference
Manual or the pTAL Reference Manual.