Z-CMD

This document covers the following topics:


Description

Invoke Con-nect from a user-written program and execute the specified Con-nect command sequence. The functions then available to the user can be restricted if necessary through modifying the profile via the administration function.

You must not call Z-CMD from Con-nect (if the program which calls Z-CMD is invoked from Con-nect, Z-CMD cannot be executed).

Z-CMD supports Con-nect functions which would not otherwise be available via the API subprograms. Typical use of Z-CMD would be to access the Con-nect editor from a user-written application.

Before invoking Z-CMD, you must stack the following data (in the same sequence as listed in the table):

Stack Data Format In Out Remarks
Command A60 R   A Con-nect command sequence.
Cabinet A8 R   The cabinet to be used.
Password A8 R   The password of the above cabinet.
Program-name A8 R   The name of a user-written program to be executed upon leaving Con-nect.
CNT-library A8 R   The name of the Con-nect library. Default: SYSCNT2.

Note:
Since Z-CMD is a Natural program (and not a subprogram) you must not use the CALLNAT statement to call it.

If Z-CMD is invoked from another library than the Con-nect library, you must save any global variables that are defined in the user-written program to avoid their being lost.

To return to the user-written application, you must leave Con-nect as usual (i.e. you must return to the menu which has been defined in your profile and then issue the QUIT command). You can also skip the menu (i.e. return to the application without displaying the menu). To do so, you must use a period (.) in the last byte of the Command parameter. The period must be preceded by at least one blank.

The Con-nect global area GL-STD can be modified using Con-nect online or using Z-CMD. It cannot be modified by an API subprogram. GL-STD contains the variable G-USER-DATA (A250) which is not used by Con-nect, but is available for your user-written programs.

Con-nect does not modify or check modified values in G-USER-DATA.

Return Codes

None

Subprograms

None

Example

0010 DEFINE DATA
0020 *
0030 LOCAL
0040 1 COMMAND      (A60)  /* Direct command to be executed in Con-nect
0050 1 CABINET      (A8)   /* Cabinet to be used (usually USERID)
0060 1 PASSWORD     (A8)   /* Password, if necessary for cabinet
0070 1 PROGRAM-NAME (A8)   /* Program to be executed after RETURN
0080 1 CNT-LIBRARY  (A8)   /* Name of the Con-nect library
0090                       /* Default: 'SYSCNT2'
0100 END DEFINE
0110 / ***********************************************
0120 *
0130 *          Coding of the application program
0140 *
0150 *************************************************
0160 *
0170 MOVE 'MOD DOC DOC-NAME' TO COMMAND
0180 MOVE 'USER-ID'          TO CABINET
0190 MOVE 'PW'               TO PASSWORD
0200 MOVE 'C-EXIT'           TO PROGRAM-NAME
0210 RESET CNT-LIBRARY  
0220 *
0230 STACK TOP DATA FORMATTED
0240 COMMAND CABINET PASSWORD PROGRAM-NAME CNT-LIBRARY 
0250 *
0260 STACK TOP COMMAND 
0270   'Z-CMD'
0280 END