All SYSMAIN functions can be performed on programming objects. Programming objects that can be maintained with SYSMAIN include the following types of Natural object: program, subprogram, subroutine, copycode, helproutine, map, local data area, global data area, parameter data area, class, text, recording, Natural command processor, dialog, function, ISPF macro, report, adapter and resource.
Programming objects are stored in the system files according to the name of the library in which they are contained: if the library begins with SYS (except for the library SYSTEM), objects are stored in the FNAT system file. In all other libraries, the objects are stored in the FUSER system file.
This section describes menu functions and selection list options provided to perform a SYSMAIN function on programming objects and the syntax that applies when using direct commands.
The Programming Objects menus contain all SYSMAIN functions required for the processing of programming objects. The fields that can be provided in a menu are described in the following table:
| Field | Explanation | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Recat: ON | Indicates that the profile parameter
                                    RECAT has been set to ON: see
                                    Using Profile Parameter
                                       RECAT.
                         |  
                               
                     ||||||||||||||||||
| Code | 
                           
  |  
                               
                     ||||||||||||||||||
| Sel. List | 
                           
  |  
                               
                     ||||||||||||||||||
| Name |  The name of the object to be processed or a range of names: see
                                    also Specifying a
                                       Range of Names. 
                                    
                            The default setting is an asterisk (*) which means that all names are selected.  |  
                               
                     ||||||||||||||||||
| New Name | The name to be given to an object when it is renamed with the rename function. | ||||||||||||||||||
| Type | The code that corresponds to the object type(s) to be processed
                                    such as P for program and M for map: see
                                    TYPE
                                       Specification - Programming Objects. 
                                    
                           You can enter one or more codes in any sequence. For example, if
                                        you enter   |  
                               
                     ||||||||||||||||||
| Set Number |  The number of the retained set created with the Predict XRef
                                    save set option of the LIST XREF command. You can
                                    apply all SYSMAIN processing functions to the objects included in this set. 
                                    
                           If any valid number is specified, SYSMAIN assumes a Predict set. If no number is specified, normal object processing is assumed. You can specify a library and a user ID for the Predict set by using the fields Set Library and Set User in the Additional Criteria window described in Specifying Additional Criteria.  |  
                               
                     ||||||||||||||||||
| XREF | 
                           
  |  
                               
                     ||||||||||||||||||
| Library | The name of a source or a target library. 
                                    
                            The source library contains the object to be processed. The target library is the library to which the object is to be copied or moved, or where the object is renamed. See also Listing and Selecting Libraries.  |  
                               
                     ||||||||||||||||||
| Database |  The database ID (DBID) of a source or a target database. 
                                    
                            The source database contains the library and system file where the object to be processed is stored. The target database contains the library and system file to which the object is to be copied or moved, or where the object is renamed. Valid database IDs are   |  
                               
                     ||||||||||||||||||
| File |  The file number (FNR) of a source or a target system file (FNAT
                                    or FUSER). 
                                    
                            Valid file numbers are  The source file contains the library where the object to be processed is stored. The target file contains the library to which the object is to be copied or moved, or where the object is renamed.  |  
                               
                     ||||||||||||||||||
| Replace | 
                           
  |  
                               
                     ||||||||||||||||||
| Criteria | 
                           
  |  
                               
                     ||||||||||||||||||
If the profile parameter RECAT has been set to
                       ON at session start, this is indicated in the
                       Programming Objects menus and on the
                       Selection screens.
               
Using SYSMAIN functions with RECAT=ON, normal
                       dynamic recatalog rules apply as described in
                       RECAT - Dynamic
                          Recataloging in the Parameter
                          Reference documentation. This means the following:
               
If an object exists as both a saved object and a cataloged object, neither the saved object nor the cataloged object can be processed independently.
If an object only exists as a cataloged object, you cannot perform a
                               SYSMAIN function that only processes cataloged objects (error message
                               Invalid request with dynamic recatalog appears) or
                               select a cataloged object from a Selection screen.
                     
When automated processing is used, any object not satisfying these rules is ignored and processing continues with the next object.
If selective processing has been activated, a selection list of all programming objects that meet the specified selection criteria is displayed on a Selection screen.
This section describes the columns and fields contained on a Selection screen and the line commands provided to further process a programming object:
The following columns and fields are displayed on a Selection screen:
| Column/Field | Explanation | 
|---|---|
| C | Input field for line commands (see below). | 
| Name | The name of the programming object that meets the specified selection criteria. | 
| Type | The code that corresponds to the type of object as listed in TYPE Specification - Programming Objects. | 
| S/C | The object that exists for the programming object: a
                                     saved/source (S) object and/or a cataloged (C)
                                     object.
                         |  
                                
                     
| Message | The message that indicates the processing status of a programming object. For possible messages, see Status Messages. | 
| Listed Library | The name of the library that contains the selected programming object(s). | 
One of the following line commands can be entered in the C (Command) column of a Selection screen:
|  
                                     
                             
                                         Line  |  
                                 
                        Function | 
|---|---|
 A 
                         |  
                                 
                         Process any object listed in the S/C
                                     (Saved/Cataloged) column; that is, saved/source (S) objects and/or
                                     cataloged (C) objects. 
                                     
                           This command does not apply to the find or the list function.  |  
                                
                     
 B 
                         |  
                                 
                         Delete the cataloged object from the Natural buffer pool.
                                     Deletion of the specified object(s) must be confirmed by entering
                                     DELETE in a window that appears once you have specified the
                                     object(s) and pressed ENTER. 
                         |  
                                
                     
 C 
                         |  
                                 
                         Process only the cataloged object, even if there is a
                                     corresponding saved object. If C is specified for an
                                     object that exists only as a saved object, an error occurs. 
                                     
                           This command does not apply to the find or the list function.  |  
                                
                     
 D 
                         |  
                                 
                         Only applies to a Library Selection
                                     screen (see also Listing and
                                        Selecting Libraries). 
                                     
                            Display a short list of the objects contained in the specified library. The information contained in the list (name, type, source/cataloged object) is identical to the information displayed on the Selection screen shown in Selective Processing in Using Menu Functions and Commands.  |  
                                
                     
 H 
                         |  
                                 
                         Produce a hardcopy of the saved (source) object. 
                                     
                            The source code of the specified object is printed and displayed on the screen.  |  
                                
                     
 I 
                         |  
                                 
                        Display directory information of an object. 
                                     
                            This command is similar to the system command   |  
                                
                     
 L 
                         |  
                                 
                         Display the source code of a saved (source) object. 
                                     
                            This command corresponds to the system command   |  
                                
                     
|  On a Library Selection screen (see also
                                     Listing
                                        and Selecting Libraries): 
                                     
                            Display an extended list of the objects contained in the library.
                                         In addition to the information displayed by using line command
                                           |  
                                
                     |
 R 
                         |  
                                 
                        Display the long name of a Natural object of the type resource. | 
| On a Library Selection
                                     screen (see also Listing and
                                        Selecting Libraries): 
                                     
                            Verify use of external subroutines: For the library and object range specified, display the objects for which a cataloged object exists and indicate whether an object references an external subroutine. For each object that references an external subroutine, display the name of the external subroutine and the name of the cataloged object that exists for this subroutine if available. For an object of the type subroutine, the name of its equivalent alias long name is displayed.  |  
                                
                     |
 S 
                         |  
                                 
                        Process only the saved (source) object, even if there is a
                                     corresponding cataloged object. If S is specified
                                     for an object which exists only as a cataloged object, an error occurs. 
                                     
                           This command does not apply to the find or the list function.  |  
                                
                     
|  On a Library Selection screen (see also
                                     Listing
                                        and Selecting Libraries): 
                                     
                            List all external subroutines contained in the specified library by their alias long names and/or the short names of their equivalent cataloged objects.  |  
                                
                     |
 X 
                         |  
                                 
                        Only applies if Natural Connection and Entire Connection are
                                     installed. 
                                     
                            Download saved (source) object(s) to a PC: see also Downloading Source Objects to a PC.  |  
                                
                     
 Z 
                         |  
                                 
                        Calculate sizes: review the sizes of the saved (source) and
                                     cataloged objects, for example, the DATSIZE, ESIZE
                                     and MCG size.
                         |  
                                
                     
The download option only applies if Natural Connection and Entire Connection are installed.
 To download one or more source objects 
Before you invoke SYSMAIN:
Define work files 6 and 7 as PC work files.
After session start, activate the PC connection by entering the following terminal command:
%+
(See also Enable/Disable Use of Natural Connection in the Terminal Commands documentation.)
Invoke any Selection screen.
Next to the object(s) you want to download, enter the following line command:
X
and press ENTER.
A PC Download Options window similar to the example below appears:
  13:23:15             ***** NATURAL SYSMAIN UTILITY *****            2005-08-10
  User SAG                   -    Copy   Selection  -
 COPY ALL * WITH XREF N FROM OLDLIB WHERE DBID 10 FNR 32 TO NEWLIB WHERE
 DBID 10 FNR 32
  C  Name     Type   S/C  Message        C  Name     Type   S/C  Message
  -  -------- ------ ---  ------------   -  -------- ------ ---  ------------
  X  SUB1     Subpgm S                   X  SUB2     Subpgm S/C
  X  SUB3     Subpgm S/C                 X  SUB4     Subpgm S
  X  SUB5     Subpgm S/C                 X  SUB6     Subpgm S/C
 +----------------- PC Download Options ------------------+ S/C
 !   Specify the relevant PC options                      ! S/C
 !                                                        ! S
 ! Drive ...... C                                         ! S/C
 ! Path ....... SOURCES/SUBPROGRAMS                       ! S/C
 ! Extension .. NS*                                       ! S
 !                                                        ! S
 !                                                        ! S
 !                                                        ! ed Library: OLDLIB
 ! Warning: This will overwrite any existing objects with !
 !          the same path, name and extension.            ! Exit) _
 +--------------------------------------------------------+ -PF10--PF11--PF12---
       Help  Menu  Exit  Copy  Del   Find  List  Move  Ren               Canc | 
                        
 In the Drive field, enter the name of the PC
                                 drive to which you want the object(s) to be downloaded. The default setting is
                                 C.
                     
In the Path field, enter the name of the PC directory/subdirectory to which you want the object(s) to be downloaded (in the example above, subdirectory SUBPROGRAMS in directory SOURCES). Enter a slash (/) as the separator between a directory and subdirectory, and between subdirectories. If the specified directory/subdirectory does not exist, you will receive an appropriate error message.
 In the Extension field, enter the extension of
                                 the text file into which the source code of the object is to be loaded. If you
                                 specify NS*, the asterisk (*) will be replaced by the specified
                                 object type (see TYPE Specification -
                                    Programming Objects).
                     
For example: a subprogram with the name SUB1 will be loaded into a file with the name SUB1.NSN.
Press ENTER to download the object(s).
A NAT4824 message appears in the message line: Requested
                                    option(s) processed successfully.
                     
 Additionally, if the Message column is
                                 displayed on the screen, the message Exported appears next to the
                                 object(s) downloaded.
                     
If desired, continue downloading other objects from this selection list.
 The PC Download Options window will not appear
                                 again for any further downloads from the current Selection
                                 screen. This window only appears when the line command
                                 X is issued for the first time after invoking a
                                 Selection screen, or after executing the direct command
                                 SET PC.
                     
The settings in the PC Download Options window remain active until you terminate SYSMAIN.
All cross-reference (XRef) data stored in the Predict system file can be processed with SYSMAIN. The XREF option indicates whether SYSMAIN should process XRef data. XRef data is always deleted if the delete or replace function is performed on a cataloged object.
If Predict has not been installed, set the XREF option to N
                       and thus no validation of Predict files is performed. If the XREF option is set
                       to Y and the FDIC file(s) being used is (are) not valid Predict
                       file(s), an error message is returned.
               
The rules for setting the XREF option are the same as the ones imposed by Natural Security. However, in a non-security environment there are no restrictions.
Consider the following settings for XREF:
If the XREF option is set to N, no XRef data is processed,
                        but in situations where a cataloged programming object is deleted or replaced,
                        SYSMAIN deletes the XRef data. The target Predict system file is determined
                        according to the current settings of the source or target FDIC system file. The
                        default is the value assigned to the profile parameter
                        FDIC (see FDIC - Predict System
                           File in the Parameter Reference
                        documentation) at the start of the Natural session.
               
If the XREF option is set to Y or F, the
                        following actions are applied during processing:
               
SYSMAIN verifies that XRef data already exists in the Predict system source file.
If the replace option is active (set to Y) and a
                                programming object is to be deleted from the target environment, XRef data is
                                deleted from the Predict system target file.
                     
If a programming object is being copied to a new environment, the XRef data of the programming object is copied from the Predict system source file to the Predict system target file. The library name is changed accordingly and in the case of the rename function, the object name is also changed.
If the move function was requested, the XRef data of the programming object is deleted from the Predict system source file.
If the XREF option is set to F, SYSMAIN additionally
                        checks that the programming object (program, subroutine, subprogram, map or
                        helproutine only) has a Predict program entry defined on the Predict system
                        target file. If not, processing of the object is terminated.
               
If the XREF option is set to S, the special case applies
                        where a range of specified objects is processed with corresponding XRef data
                        regardless of whether all of the objects have cross-reference data or not: the
                        objects that have cross-reference data are processed with their cross-reference
                        data, and the objects that have none are also processed.
               
If the XREF option is set to  D, SYSMAIN checks that the
                        programming object (program, subroutine, subprogram, map or helproutine only)
                        has a Predict program entry defined on the Predict system target file. If not,
                        processing of the object is terminated. Objects that have cross-reference data
                        are processed with their cross-reference data, and the objects that have none
                        are also processed. 
               
If any of the following inconsistencies occur during the SYSMAIN processing of XRef data, all processing for the object or function is terminated and an error message is displayed:
The value of the XREF option in Natural Security is F or
                                Y and you specified a value of Y or N
                                respectively.
                     
The XREF option is set to F or D, and
                                SYSMAIN finds no documented program entry in Predict for the object being
                                processed.
                     
An invalid Predict file is specified.
The value of the XREF option in Natural Security is F,
                                D or Y and you specified a value of
                                S.
                     
The value of the XREF option in Natural Security is D
                                and you specified a value of N.
                     
In addition to the selection criteria specified in the input fields in a Programming Object menu, you can select objects by a date/time, user ID and terminal ID that relates to their saving or cataloging.
You can also specify the user ID and the library for a Predict set. This option does not apply to the list and find functions.
For example, you can select only those objects that were cataloged on a specific day between 8:00 and 12:00 by a specific user on a specific terminal, which means that the processing of objects according to the selection criteria is based on all selected criteria as a whole, not on each condition.
 To specify additional selection criteria 
 In the Criteria field of a
                                Programming Objects menu, replace N (default)
                                by Y.
                     
The Additional Criteria window similar to the example below appears:
 15:24:55             ***** NATURAL SYSMAIN UTILITY *****            2006-09-15
 User MMO                 - Copy Programming Objects -
                   +------------------------------------------+
                   !       --- Additional Criteria ---        !
                   !                                          !
                   !  Object Type ..... PN__________________  !
                   !  Date/Time From .. 2006-01-01 _____      !
                   !  Date/Time To .... __________ _____      !
                   !  User ID ......... SAG______             !
                   !  Terminal ID ..... ________              !
                   !  Set Library ..... ________              !
                   !  Set User ........ ________              !
                   !                                          !
           Code .. !  Command ===>                            !
   Object  Name .. !                                          !
                   +------------------------------------------+ N
   Source  Library ... SYSTEM__    Database .... 10___  File .. 32___
   Target  Library ... ________    Database .... 10___  File .. 32___
   Options Replace ... N         + Criteria .... Y
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Menu  Exit  Copy  Del   Find  List  Move  Ren   Fsec  Fdic  Fnat | 
                        
Enter the required selection criteria. If one or more object-type codes have been entered in the Object Type field in the Additional Criteria window, the Type field in the Programming Objects menu is preset to the same object-type codes.
 When you return to the Programming Objects
                                menu, a plus sign (+) in front of the Criteria field
                                indicates that additional object selection criteria have been specified; in the
                                example above, user ID SAG.
                     
The plus character (+) is not displayed if only the Object Type field contains an entry since this entry already appears in the Type field in the Programming Objects menu.
This section shows the syntax that applies when performing a SYSMAIN function for programming objects by using direct commands in either online or batch mode. For general instructions on using direct commands, refer to Executing Commands.
For explanations of the keywords and variable values used in the syntax diagrams below, refer to Keywords and Variables in Direct Commands. The symbols in the syntax diagrams correspond to the syntax symbols used for system commands. These symbols are explained in System Command Syntax in the System Commands documentation.
The syntax of the where-clause and the with-clause are identical for each command.
This section covers the following topics:
| 
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        ||||||||
| name | 
                                     
                            
  |  
                                 
                        
                                     FM [LIBRARY]
                                     lib-name
                                     
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        [where-clause] | |||||||||
TO [LIBRARY]
                         |  
                                 
                        lib-name [where-clause] [with-clause] | ||||||||||||
COPY PROG1 FM TESTORD TO ORDERS DBID 1 FNR 6 REP
C PGM* WITH REP TYPE PNS FM PRODLIB TO TESTLIB
M PROG1 FM OLDLIB TO NEWLIB
MOVE STOWED * TO NEWLIB WHERE DBID 100 FNR 160 FMDATE 2007-01-01 FM OLDLIB WITH XREF Y
 DELETE 
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        name | 
                                     
                            
  |  
                                 
                         IN
                                     [LIBRARY]
                                     lib-name
                                     
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        [where-clause] | [with-clause] | 
DELETE C M> IN LIB ORDERS
D * IN TESTLIB DBID 1 FNR 5 NAME SYSNAT
D SA * IN LIBTEST TYPE GLA
D * TYPE PM IN TESTORD FMDATE 2007-01-01 TODATE 2007-04-30
| 
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        name | 
                                     
                            
  |  
                                 
                         IN
                                     [LIBRARY]
                                     lib-name
                                     
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        [where-clause] | [with-clause] | 
Note:
 The direct command LISTLIB is only
                           available in batch mode and is used to obtain a list of library names.
                  
FIND SAVED MENU IN TESTLIB
FIND STOWED MAINMENU IN SYS* WHERE DBID 1 FNR 5
F ALL PROG2 IN PROD* FNR 27 DBID 1
LIST * IN TESTLIB
LIST DT* IN TESTLIB
L SAVED TEST* IN TESTLIB TYPE PNS FNR 6
L SA TEST* TYPE PM IN TESTLIB FNR 6 DBID 2 FMDATE 2007-01-01
LISTLIB ALL MENU IN SYS* DBID 10 FNR 44
                                     RENAME 
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        |||||||
name AS
                                     new-name
                                     [with-clause]
                                     
                         |  
                                
                     |||||||||||
| 
                                     
                            
  |  
                                 
                        FM
                                     [LIBRARY]
                                     lib-name
                                     
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        [where-clause] | ||||||||
| 
                                     
                            
  |  
                                 
                        TO
                                     [LIBRARY]
                                     lib-name
                                     
                         |  
                                 
                        [where-clause] | 
                                     
                            
  |  
                                
                     ||||||||
RENAME PGM1 AS PROG1 FM TESTLIB
R PGM1 AS PROG1 FM TESTLIB DBID 1 FNR 5 TO PRODLIB DBID 2 FNR 6
R PGM* TYPE PS RCOP FM TESTLIB TO PRODLIB
 [WHERE] [DBID
                                     dbid]
                                     [FNR fnr]
                                     [NAME
                                     vsam-name]
                                     [CIPHER
                                     cipher]
                         | 
                                 
                                
                     |||||||||||||||||||
| 
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                         
                                     
                             
                                           |  
                                 
                        
                                     
                            
  |  
                                 
                        password | 
                                     
                            
  |  
                                 
                        ||||||||||||||
 [DIC
                                     (dbid,fnr,password,cipher)]
                         | 
                                 
                                
                     |||||||||||||||||||
 [SEC
                                     (dbid,fnr,password,cipher)]
                         | 
                                 
                                
                     |||||||||||||||||||
Commas must be used as separators between the values following the
                        DIC and SEC keywords, or if a value is missing. For
                        example: DIC (10,,secret,2a).
               
 If the session parameter ID (see
                        ID - Input Delimiter
                           Character in the Parameter Reference
                        documentation) has been set to a comma, use a slash (/) as the separator
                        between values.
               
 [WITH] 
                         |  
                                 
                         [TYPE
                                     type]
                         | 
                                 
                                 
                         [FMDATE date-from]
                         | 
                                 
                                 
                         [TODATE date-to]
                         | 
                                 
                                 
                         [FMTIME time-from]
                         | 
                                 
                                 
                        ||||||
 [TOTIME
                                     time-to]
                         | 
                                 
                                 
                         [USER
                                     user-id]
                         | 
                                 
                                 
                         [TID
                                     terminal-id]
                         | 
                                 
                                 
                         [XREF xref]
                                     [HELP] 
                         |  
                                
                     |||||||
 [REPLACE] 
                         |  
                                 
                         [RCOP] 
                         |  
                                 
                         [EXTEND] 
                         |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                 
                        
                                     
                            
  |  
                                
                     ||||
 [SETUSER
                                     set-user]
                         | 
                                 
                                 
                         [SETNO
                                     set-number]
                         | 
                                 
                                 
                        [SETLIBRARY
                                     set-library]
                                     
                         |  
                                 
                        ||||||||