How to use Persistent Global Variables.

Document ID : KB000050140
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

This document explains the concept of persistent Global variables and how you can create, update and delete them.

Solution:

In general, if you want to retain a value across a restart of the NetMaster region you need to use the concept of "Persistent Global Variables". You can save selected NCL global variables to preserve data between restarts of the region. Saved global variables are known as persistent global variables (PGVs). They are automatically loaded at restart.

This concept is described in the section titled 'Persistent Global Variables' on page 65 of the NetMaster NCL Programmer Guide.

You can create, update and delete persistent global variables in three ways:

  1. Use the GLBLSAVE process macro in processes created in Automation Services (/ASADMIN).

  2. Maintain persistent global variables online in the 'Persistent Variables List' (/PVAR). There you can create, update and delete these variables.

  3. Use procedure $CAGLBL in NCL-procedures. Details on the different Options available in that procedure can be found in "Chapter 10: Persistent Global Variables Interface" of the Network Control Language Reference Guide. Here is an example:
     ...                                                                        
     &CALL PROC=$CAGLBL PARMS=(OPT=SAVE,NAME=ADDRSRV1,DATA=192.168.10.34)
     &IF .&ZFDBK NE .0 &THEN &DO
        error-processing
     &DOEND
     ...

This piece of code creates persistent global variable &&000ADDRSRV1 (or &GLBLADDRSRV1, if &000 is not changed from its default value GLBL). That variable contains the value '192.168.10.34'. Make sure to check the value in system variable &ZFDBK (Feedback) for successful execution which will be 0 for successful creation and higher for any error appearing.

After successful execution of that above NCL you can see the variable in menu /PVAR:

NM01--------------------- Persistent Variables List ---------------------------
Command ===>                                                   Scroll ===> CSR 
 
           B/S=Browse P=Purge R=Reload SAV=Save UG=Update Global UB=Update Both
    Name        Global Variable Value           Saved Value                    
    ADDRSRV1    192.168.10.34                   192.168.10.34                  
    **END**               
-------------------------------------------------------------------------------