Use GS

Purpose:  The USE GS command declares a Global Storage (GS) definition for use.  A maximum of ten GS’s can be active at one time.  Subsequent commands may then use the declared fields for data storage and access.  Since GS areas exist outside the framework of Data Sets (DS) and Process Modules (PM), they provide a convenient place to store data that is to be passed from one program to another, or that needs to be accessed outside of DS’s.

Syntax

USE GS \\gs_name\\ [IN DBL dbl_name]

USE NO GS \\gs_name\\

gs_name

specifies an existing GS to be used.  Up to ten GS names can be declared.  If an 11th GS is declared, ACCENT R responds with an error message.  To use a new Global Storage, one of the current GS’s must be released with the USE NO GS gs_name command, then declare the new GS.

The names of the declared GS’s are moved to @GS_NAME which OCCURS 10.

USE NO GS \\gs_name

releases a specified GS.

EXAMPLES

*USE GS NEWBOOK

This command declares the GS named NEWBOOK for use.

*USE GS NEWBOOK IN DBL BOOK, NEWLIB IN DBL BOOKS2

This command declares the GS’s named NEWBOOK and NEWLIB for use.

*USE GS NEWBOOK
*USE GS NEWLIB

These commands also declare the GS’s named NEWBOOK and NEWLIB for use and assumes they are defined in the current DBL.

*TYPE @GS_NAME(1)@',25,@GS_NAME(2)@"
NEWBOOK NEWLIB

This command list the names of the GS's just declared.

NOTES:  Initial values for GS fields can be defined with the DATA clause, which eliminates the need to SET values in a particular GS.

SEE ALSO:  DATA clause - Declared Fields