This section describes how to invoke and terminate the SYSMAIN utility online, in batch or by using an Application Programming Interface.
This section covers the following topics:
The following instructions describe the methods of invoking the SYSMAIN utility by using a direct command (online or batch) or menu functions.
To invoke SYSMAIN online
From any library, enter the following Natural system command:
SYSMAIN
Or:
From the Natural Main Menu, invoke the
Maintenance and Transfer Utilities menu and choose
Transfer Objects to Other Libraries.
A SYSMAIN Utility Main Menu similar to the example below appears:
10:39:24 ***** NATURAL SYSMAIN UTILITY ***** 2005-08-10 User SAG - Main Menu - Code Object Code Function A Programming Objects C Copy D Debug Environments D Delete E Error Message Texts F Find P Profiles L List R Rules M Move S DL/I Subfiles R Rename V DDMs ? Help ? Help . Exit . Exit Object Code .. A Function Code .. _ Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Help Menu Exit Copy Del Find List Move Ren |
The current setting of the system variable
*LIBRARY-ID
is passed to SYSMAIN and used as the
default source library for processing programming objects and debug
environments.
To invoke SYSMAIN in batch
Use the following direct command:
SYSMAIN
followed by one or more command strings. See also Issuing Direct Commands.
MAINUSER is an Application Programming Interface (API) that can be used to perform SYSMAIN functions directly from any user-written object (for example, from a subroutine, program or subprogram) without going through the normal steps of invoking SYSMAIN.
Upon completion of processing of the SYSMAIN functions, the utility is terminated and control is returned to the program, subprogram or subroutine from which the request was issued.
MAINUSER is supplied as a cataloged object of the type subprogram in the system library SYSMAIN. MAINUSER can be used in either online or batch mode.
Note:
MAINUSER must not be located in a user library. You must
therefore copy it to the library SYSTEM on the system file FNAT or FUSER or to
any SYS-prefixed library which is the steplib for the application.
MAINUSER is invoked with the CALLNAT
statement and its
relevant parameters (see also CALLNAT in the
Natural Statements documentation). MAINUSER must
not be invoked from within the library SYSMAIN.
To invoke MAINUSER
Issue a CALLNAT
statement that contains the following
syntax elements:
CALLNAT 'MAINUSER' command error message
library
where the variable values denote the following parameters:
Parameter | Natural Data Format/Length | Explanation |
---|---|---|
command | A250 | The direct command string to be executed by SYSMAIN. |
error | N4 | The return code issued by SYSMAIN at the end of processing to indicate a normal end of processing or an error. |
message | A72 | The message corresponding to the error given online. |
library | A8 | The library containing SYSMAIN. If not specified, the default is SYSMAIN. |
An example of a callable routine is the program MAINCALL in the library SYSMAIN.
To terminate SYSMAIN
In the Command line of any SYSMAIN screen, enter one of the following direct commands:
.
(a period)
or
END
or
QUIT
Or:
Press PF3 (Exit), if required repeatedly.
Or:
In batch mode, use the either of the following direct command:
END
or
QUIT
See also Issuing Direct Commands in the section Using Menu Functions and Commands.
Important:
Do not terminate the SYSMAIN utility with the terminal command
%%
, because the environment may not be reset
correctly.