Z-GLOBAL

This document covers the following topics:


Description

Return the contents of global variables in the Con-nect global data area GL-STD.

Z-GLOBAL must be in the same library as the Con-nect modules.

Z-GLOBAL is a Natural subroutine. Therefore, you must use the PERFORM statement to invoke it.

In the parameter Variable-list, you must specify the number of each variable of which you want to return the contents.

Number Variable Name Description
01 G-CURRENT-CABINET Name of the cabinet in which user is currently working.
02 G-USER-ID Name of the private cabinet that was accessed using a password.
03 G-USER-NAME Last name and first name of the user.
04 G-CURR-ISN Adabas ISN of current Con-nect object.
05 G-LAST-ISN Adabas ISN of last used Con-nect object.
06 G-COMMAND Con-nect command that the user issued in the command line.
07 G-LAST-COMMAND Last Con-nect command (this corresponds to the Con-nect command *= which is by default assigned to PF11).
08 G-COMMAND-SEQ Blank for command sequence "command object name". An X for alternative command sequence "object name command".*
09 G-CURRENT-MAP Name of the current map.
10 G-LANGUAGE Language code.*
11 G-DEFAULT-FOLDER Name of the default folder.*
12 G-DEFAULT-FILE Name of the default file in the default folder.*
13 G-PRINT-TID Terminal ID of the printer or "PC".*
14 G-PRINT-DEST Name of the logical printer.*
15 G-PRINT-PROFILE-NAME Name of the printer profile.*
16 G-FMT-PROFILE-NAME Name of the formatting profile.*
17 G-PRINT-PS Page length.*
18 G-PRINT-LS Line width.*
19 G-S-SUBJECT-LINE Subject of the mail item.
20 G-S-SEND-ISN Adabas ISN of the original mail item.
21 G-S-OUTISN Adabas ISN of the mail item in the Outbasket.

Note:
An asterisk (*) in the above list indicates a value that is defined in the profile of the current cabinet or that is defined with the OUTPUT command for the current session.

After you have performed Z-GLOBAL, the parameter Output-area contains the contents of the variables you specified.

When the contents of all variables exceeds 250 bytes - which is indicated by return code 99 - you must specify the number of each variable for which no output occurred once more in the parameter Variable-list and then perform Z-GLOBAL again to return the contents of the remaining variables.

Each variable that is returned in the parameter Output-area is preceded by a 6 byte long header:

Byte Number Description
1 and 2 Variable number (see the above list).
3 Format of the variable: A or N.
4 to 6 Length of the variable.

For example, when you specify 01 in the parameter Variable-list and the current contents of G-CURRENT-CABINET (format A8) is LS, the following is returned in the parameter Output-area:

01A008LS

In the above example, the output is followed by 6 blanks since LS is only 2 bytes long.

Parameters

Parameter Format In Out Remarks
Return-code N2   X  
Variable-list N2/1:10 R   The number of each variable of which the contents is to be returned. See the above list.
Output-area A250   X The contents of each variable preceded by a 6 byte long header.

Return Codes

00 Success
99 Output-area not large enough for request

Subprograms

None

Example

0010 DEFINE DATA LOCAL
0020 01 RETURN-CODE          (N2)
0030 01 VARIABLE-LIST        (N2/10) INIT <01,19,21>
0040 01 OUTPUT-AREA          (A250)
0050 01 REDEFINE OUTPUT-AREA
0060    02 OUTPUT-AREA-ARRAY (A1/250)
0070 01 OUT-INDEX (P3) INIT <1> /* points to position within OUTPUT-AREA-ARRAY
0080 *
0090 01 I         (P3)          /* loop count
0100 01 J         (P3)          /* loop count
0110 01 K         (P3)          /* loop count
0120 *
0130 01 HEADER    (A1/6)
0140 01 REDEFINE HEADER
0150    02 VAR-NUM    (N2)
0160    02 VAR-FMT    (A1)
0170    02 VAR-LENGTH (N3)
0180 *
0190 01 VAR-CONTENT   (A1/60)
0200 01 REDEFINE VAR-CONTENT
0210    02 ALPHA      (A60)
0220 01 REDEFINE VAR-CONTENT
0230    02 NUMERIC    (N12)
0240 END-DEFINE
0250 *
0260 PERFORM Z-GLOBAL  RETURN-CODE VARIABLE-LIST(*) OUTPUT-AREA
0270 *
0280 FOR I 1 TO 3
0290 *
0300   IF RETURN-CODE EQ 99  /* output area not large enough
0310      AND
0320      OUTPUT-AREA-ARRAY(OUT-INDEX) EQ ' ' /* space instead of number
0330      OR
0340      OUT-INDEX  >  250  /* last variable ended with byte 250
0350     WRITE '* Perform again to return contents of remaining variables *'
0360     ESCAPE BOTTOM
0370   END-IF
0380 *
0390   FOR  J      1  TO 6                /* move number of variable and format
0400     MOVE OUTPUT-AREA-ARRAY(OUT-INDEX) TO HEADER (J)
0410     ADD  1       TO OUT-INDEX
0420   END-FOR
0430 *
0440   IF VAR-FMT  EQ   'A'
0450     PERFORM MOVE-ALPHA
0460   ELSE                               /* if 'N'
0470     PERFORM MOVE-NUMERIC
0480   END-IF
0490 *
0500   IF VAR-NUM = 1
0510     WRITE ' Cabinet      : ' ALPHA
0520   END-IF
0530   IF VAR-NUM = 19
0540     WRITE ' Subject line : ' ALPHA
0550   END-IF
0560   IF VAR-NUM = 21
0570     WRITE ' Outbasket ISN: ' NUMERIC
0580   END-IF
0590 *
0600 END-FOR
0610 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0620 DEFINE SUBROUTINE MOVE-ALPHA  /* left-aligned
0630   RESET ALPHA
0640   FOR  K  1 TO VAR-LENGTH
0650     MOVE OUTPUT-AREA-ARRAY(OUT-INDEX) TO VAR-CONTENT(K)
0660     ADD  1  TO OUT-INDEX
0670   END-FOR
0680 END-SUBROUTINE
0690 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0700 DEFINE SUBROUTINE MOVE-NUMERIC /* move ALL numeric values into N12
0710   RESET NUMERIC
0720   COMPUTE  J = 12 - VAR-LENGTH
0730   FOR  K   1 TO VAR-LENGTH
0740     MOVE OUTPUT-AREA-ARRAY(OUT-INDEX) TO VAR-CONTENT(J+K)
0750     ADD  1   TO OUT-INDEX
0760   END-FOR
0770 END-SUBROUTINE
0780 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0790 END