Processing Programming Objects

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.


Fields in Programming Objects Menus

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
Specifies whether a saved (source) object and/or a cataloged object is to be processed:
   
A Any object that exists as a saved object and/or a cataloged object is processed.
C Any object that exists as a cataloged object is processed.
S Any object that exists as a saved object is processed.
W Only an object that exists as both a saved object and a cataloged object is processed. The exceptions to this are copycode, text and recording which cannot be cataloged. However, they are included in processing when this option is specified.
Sel. List
Specifies whether selective processing or automated processing is used:
   
Y Yes.
Selective processing is activated. A selection list is displayed when processing objects. This is the default setting. For the columns, fields and line commands available on a selection list, see Selection Lists for Programming Objects.
N No.
Selective processing is deactivated.
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 PAM, programs, parameter data areas and maps are processed.

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
Indicates whether XRef (cross-reference) data stored on Predict system files is to be processed:
   
N No.
XRef data is not processed, except when using the delete function. If a cataloged object is deleted or replaced, SYSMAIN always deletes any existing XRef data for this object. N is the default setting.
Y Yes.
All XRef data is processed.
S Special.
A specified object is processed regardless of whether it has cross-reference data or not. Any existing XRef data is processed.
F Force.
All XRef data is processed and the object must be documented in Predict.
D Documented.
The object must be documented in Predict. Any existing XRef data is processed.
 
For further details, see XRef Considerations.
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 1 to 65535.

File The file number (FNR) of a source or a target system file (FNAT or FUSER).

Valid file numbers are 1 to 65535.

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
Specifies whether an object is to be replaced when using the move, copy or rename function:
   
Y Yes.
An object with the same name which exists in the target environment is replaced.
N No.
An object with the same name which exists in the target environment is not replaced. This is the default setting.
   
See also Using the Replace Option.
Criteria
Invokes the Additional Criteria window where you can specify additional object selection criteria. Possible values are:
   
N No.
The Additional Criteria window is not invoked. This is the default setting.
Y Yes.
The Additional Criteria window is invoked.
   
See also Specifying Additional Criteria.

Using Profile Parameter RECAT

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.

Selection Lists for Programming Objects

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:

Columns and Fields

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).

Line Commands

One of the following line commands can be entered in the C (Command) column of a Selection screen:

Line
Command

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 LIST DIR object-name; for details on the directory information displayed, refer to Displaying Directory Information in the System Commands documentation.

L Display the source code of a saved (source) object.

This command corresponds to the system command LIST object-name; for the commands that can be executed from a source-code screen, refer to List of Source in the System Commands documentation. Exceptions: The command EXPAND is not available. The command ZOOM cannot be used if the source object to be displayed is contained in a steplib library.

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 D, the extended list provides information of the object directory: programming mode, Natural version, user ID, saved/cataloged date and time.

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.

Downloading Source Objects to a PC

The download option only applies if Natural Connection and Entire Connection are installed.

Beginn der Anweisungsliste To download one or more source objects

  1. 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).

  2. Invoke any Selection screen.

  3. 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.

  4. Press ENTER to download the object(s).

    The following message appears in the message line: 4824: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.

  5. 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.

XRef Considerations

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:

XREF set to N

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.

XREF set to Y or F

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.

XREF set to F

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.

XREF set to S

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.

XREF set to D

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.

XREF Errors

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.

Specifying Additional Criteria

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.

Beginn der Anweisungsliste To specify additional selection criteria

  1. 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.

  2. 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.

Direct Command Syntax for Programming Objects

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:

COPY and MOVE

COPY
MOVE

ALL
CATALOGED
SAVED
STOWED

           
name

FM [LIBRARY] lib-name

[where-clause]
    TO [LIBRARY] lib-name [where-clause] [with-clause]

Examples:

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

DELETE

ALL
CATALOGED
SAVED
STOWED

name

IN [LIBRARY] lib-name

[where-clause] [with-clause]

Examples:

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

FIND, LIST and LISTLIB

FIND
LIST
LISTLIB

ALL
CATALOGED
SAVED
STOWED

name

IN [LIBRARY] lib-name

[where-clause] [with-clause]

Anmerkung:
The direct command LISTLIB is only available in batch mode and is used to obtain a list of library names.

Examples:

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

RENAME

ALL
CATALOGED
SAVED
STOWED

           
           
name AS new-name [with-clause]
 

FM [LIBRARY] lib-name

[where-clause]  
 

TO [LIBRARY] lib-name [where-clause]

Examples:

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-clause

[WHERE] [DBID dbid] [FNR fnr] [NAME vsam-name] [CIPHER cipher]
     

PASSWORD
PSW

password

                     
      [DIC (dbid,fnr,password,cipher)]
      [SEC (dbid,fnr,password,cipher)]

Separators

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-clause

[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]

PROMPT
NOPROMPT

MON
NOMON

  [SETUSER set-user] [SETNO set-number] [SETLIBRARY set-library]