Natural objects stored in the Natural system files FNAT and FUSER are grouped into logical constructs called libraries. A Natural library is used to organize objects according to functional criteria. For example, a library can consist of a set of objects that perform a particular task. If Natural Security is installed, a library can also be used to restrict object access to a particular group of users such as administrators.
A Natural application can access objects in multiple libraries depending on how the environment is set up.
All operations on a library are performed with Natural menu functions or corresponding commands. See also the section Using Commands and Menu Functions.
Natural System Files - Natural System Architecture documentation
Libraries in System Files - Natural System Architecture documentation
Library Maintenance - Natural Security documentation
This section covers the following topics:
A library contains object modules (source object and cataloged object, if applicable) of the following types of Natural object: program, subprogram, subroutine, copycode, helproutine, class, function, recording, map, local data area, global data area, parameter data area, command processor source, error message, dialog, debug environment, adapter and resource.
This section describes the types of Natural library provided.
A user library contains objects of a user application which are specific to this application and which are required to run the application. A user library is contained in the FUSER system file.
A system library is an internal file. It is contained in the FNAT system file.
A system library contains all objects required to run a Natural system application.
In addition, there are system libraries that contain objects of the type program, which are provided for demonstration purposes: see Example Libraries in the section Natural Main Menu.
Note that you cannot log on to the system libraries SYSLIB and SYSLIBS. They are
reserved for internal use. If you try to log on to either library, you will receive the
following message: Libraries SYSLIB and SYSLIBS reserved for system
usage.
Important
Do not store any user-specific objects in a Natural system library.
User-specific objects can be overwritten when installation or correction data sets/files
are loaded into the system files.
A steplib is a Natural user library or system library that is concatenated with the current user or system library. A steplib can be used as a single storage location for multiple objects that are shared by different applications. This avoids redundant storage of identical objects and helps organize applications.
A steplib is a library in which Natural searches when an object is not found in the current library (see also the following section). The standard steplibs are the libraries SYSTEM in the FUSER and the FNAT system files.
This section covers the following topics:
If Natural Security is active, you can define additional steplibs in the security profile of each library. The entries in a library security profile override any definitions made outside Natural Security. These steplibs are searched for an object before the standard steplibs SYSTEM (FUSER and FNAT).
Steplibs - Natural Security documentation
If Natural Security is not active, you can specify one additional steplib with the
Natural profile parameter STEPLIB at session start. In addition,
you can define further steplibs by using one of the Application Programming Interfaces
(for example, USR1025N or USR3025N) that are supplied for this purpose in the Natural
system library SYSEXT.
These steplibs are searched for an object before the standard steplibs SYSTEM (FUSER and FNAT).
To check the steplib setting of your current library
Enter the following system command:
TECH
The TECH window appears.
Scroll down the window by choosing ENTER repeatedly until the Steplib column appears.
TECH - System Commands documentation
This section describes the sequence in which Natural libraries and system files are searched for a requested object that is to be executed from either a user library or a system library.
Note
If the profile parameter BPSFI is set to ON (the
default setting is OFF), objects are searched for in the buffer pool
first.
The current library in the FUSER system file as defined by the system variable *LIBRARY-ID.
The steplibs (in sequence) as specified in the Natural Security profile for the current library or in the steplib table.
The default steplib as defined by the system variable
*STEPLIB.
The library SYSTEM in the FUSER system file.
The library SYSTEM in the FNAT system file.
The current "SYS" library in the FNAT system file as defined by the
system variable *LIBRARY-ID.
The steplibs (in sequence) as specified in the Natural Security profile for the current library or in the steplib table.
The library SYSLIBS in the FNAT system file, which contains objects shared by system commands and utilities.
The library SYSTEM in the FNAT system file.
The library SYSTEM in the FUSER system file.
Since the FUSER system file is searched last, you must provide an object that is used in both the FUSER and the FNAT system files (for example, a user exit routine for a Natural utility) only in one location, namely in FUSER.
When you start a Natural session, you are logged on to a library assigned by Natural. A
Natural screens usually provides a field (for example, Library or
LIB=) that indicates the name (ID) of your library, that is, the
current library (for example, LIB=SYSTEM) where Natural objects are stored
and from which they are retrieved.
To find out your current library
Enter the following system command:
TECH
The TECH window appears. The library where you are currently logged on is listed in the Library field.
The default library ID assigned by Natural is SYSTEM if the Natural profile
parameter AUTO is set to OFF. You can change the
default library ID at session startup by setting AUTO to
ON. AUTO=ON initiates an automatic logon to the
library that corresponds to your user ID. However, different rules apply if you log on to
Natural under Natural Security as described in the Natural Security
documentation.
You may have to log on to another library to perform a maintenance function or work on a different application as described in Logging on to a Library.
TECH - System Commands documentation
AUTO - Parameter Reference documentation
Logging On - Natural Security documentation
When you create or maintain Natural objects or execute a Natural program inside a specific library, you may have to switch libraries and first log on to the library or steplib (see Steplib Libraries) that contains (or is to contain) the object.
You usually use the system command LOGON to log on to a
library. However, different rules apply if you log on to Natural under Natural Security as
described in the Natural Security documentation.
After a successful logon to a library that does not contain any objects, the confirmation
message reads: This library is empty.
Note
The system command LOGON does not consider objects of the
types error message and debug environment. Therefore, the confirmation message only refers
to all object types other than error messages and debug environments. You can find out
whether a library contains error messages or debug environments, for example, by using the
SYSMAIN utility, or the utilities SYSERR and the debugger, respectively.
You can also find out whether a library is empty (except for error messages and/or debug
environments) by using the system command LIST described in
Listing Objects in a
Library.
The library to which you are logged on remains active until you log on to another library or terminate your Natural session.
Enter the following system command:
LOGON library-ID
where library-ID is the name (ID) of the library you want to access.
Or: From the Natural Main Menu or its subordinate menus:
In the top right-hand corner of the screen, in the Library field, replace the library ID displayed with another library ID (see also Example of a Menu Function in the section Using Commands and Menu Functions).
Press ENTER.
If the library ID you entered complies with the library naming conventions, the
following confirmation message appears: Logon accepted to library
library-ID.
LOGON and LOGOFF - System Commands documentation
Logging On - Natural Security documentation
You create a library by using either the system command LOGON
for an empty library where you create an object, or the move or copy function of a Natural
utility when transferring objects.
To create a library
If you use the system command LOGON, proceed as
described in Logging on to a
Library. Specify a library ID (see also Library Naming
Conventions) that logs you on to a library that does not
contain any objects. In this library, create at least one cataloged object or one
source object.
Or:
If you want to move or copy objects from an existing library to a new one, proceed
as described in Moving,
Copying and Renaming Libraries.
You can obtain a list of all libraries available in your current Natural system environment, for example, by using the SYSMAIN utility.
The instructions in this section are examples of listing libraries by using either SYSMAIN menu functions or a corresponding command.
To list all libraries using menu functions
From the Natural Main Menu, choose .
Press ENTER.
The Maintenance and Transfer Utilities screen appears.
Select Transfer Objects to Other Libraries.
Or:
Enter the following system command:
SYSMAIN
Press ENTER.
The Main Menu of the SYSMAIN utility similar to the example below appears:
14:09:48 ***** NATURAL SYSMAIN UTILITY ***** 2013-05-02
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
X Predict Sets
? 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 |
In the Object Code field, enter an A (default
setting) to list all libraries that contain Natural objects except error messages
and debug environments (for error messages, enter an E, for debug
environments a D).
In the Function Code field, enter an L (for
List).
Press ENTER.
The List Programming Objects screen appears.
In the Code field, enter an A to search for
libraries that contain all types of object module: cataloged objects and source
objects.
In the Source Library field, enter an asterisk (*) to search for all libraries.
(For valid name ranges, see Specifying a Range of Names in the SYSMAIN Utility documentation.)
Leave all other input fields unchanged.
Press ENTER.
The Library Selection screen appears with a list of all libraries available in the current system file.
Press ENTER to scroll down the list, PF11 to scroll right and PF12 to scroll left.
From the Library Selection screen, you can select a particular library and list the objects contained in that library. For further information on the Library Selection screen, see Related Topic below.
To list all libraries using a command
Enter the following system command:
SYSMAIN LIST ALL * IN LIBRARY *
Press ENTER.
The Library Selection screen appears with a list of all libraries available in the current system file.
Listing and Selecting Libraries - SYSMAIN Utility documentation
You can obtain a list of objects contained in a library by using either the system
command LIST or the corresponding function of the Natural utility SYSMAIN or
the Object Handler.
Note
The system command LIST does not process objects of the
types error message and debug environment. You can list error messages or debug
environments, for example, by using the SYSMAIN utility.
This section describes how to obtain a list of objects by using
LIST.
Enter the following system command:
LIST *
where asterisk (*) specifies that all source objects and cataloged objects are to be listed (see also object-name-range in LIST in the System Commands documentation).
Press ENTER.
A LIST Objects in a Library
screen similar to the example below appears with a
list of source objects and cataloged objects available in the current library (in
the example below: TEST) in the current system file:
10:09:25 ***** NATURAL LIST COMMAND ***** 2012-07-24
User SAG - LIST Objects in a Library - Library TEST
Cmd Name Type S/C SM Version User ID Date Time
--- *________ *__________ *__ * *______ *________ *__________ *________
__ COPYLDA Copycode S R 8.2.02 SAG 2012-07-23 17:58:19
__ DEMOSPGM Subprogram S/C S 8.2.02 SAG 2012-07-23 17:58:34
__ EMP-L Local S/C 8.2.02 SAG 2012-07-23 17:58:47
__ GDATEST Global S 8.2.02 SAG 2012-07-24 10:09:25
__ HELPR1 Helproutine S/C S 8.2.02 SAG 2012-07-24 10:02:59
__ LDATEST Local S/C 8.2.02 SAG 2012-07-23 17:59:16
__ MAPTEST Map S/C S 8.2.02 SAG 2012-07-24 10:04:44
__ MAP01 Map S/C S 8.2.02 SAG 2012-07-24 10:04:25
__ PDASTUB Subprogram S/C S 8.2.02 SAG 2012-07-24 10:03:41
__ PDATEST Parameter S/C 8.2.02 SAG 2012-07-24 10:03:47
__ PGMTEST Program S/C S 8.2.02 SAG 2012-07-24 10:03:53
__ PGM01 Program S S 8.2.02 SAG 2012-07-23 17:59:02
__ SUBPGM1 Subprogram S S 8.2.02 SAG 2012-07-23 17:59:08
__ SUBRTEST Subroutine S/C R 8.2.02 SAG 2012-07-24 10:07:58
__ TESTPGM Program S S 8.2.02 SAG 2012-07-24 10:05:26
__ TEXTTEST Text S 8.2.02 SAG 2012-07-24 10:05:43
16 Objects found
Top of List.
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
Help Print Exit Sort -- - + ++ > Canc |
The list is sorted by the name of the object (Name column) and
contains further information on the object such as the type of object (for example,
Program), the type of object module (S/C column:
S = source object, C = cataloged object) available and
the ID of the user who created or modified the object.
From the LIST Objects in a Library screen, you can select an object for further processing such as listing the source code of an object or deleting objects from a library as described in To delete objects using LIST in the section Deleting Objects in a Library.
For further information on the LIST Objects in a Library screen and
other options provided with LIST such as listing a particular
range of object names or sorting the list of objects, see the related topics below.
You can print a list of objects contained in the current library in the current system file.
To print a list of objects
Invoke the LIST Objects in a Library as described in Steps 1 and 2 in Listing Objects in a Library.
Press PF2 (Print).
The PRINT window appears.
In the Destination field, enter a valid printer name (if required, ask your Natural administrator for a printer available in your current environment). If required, change the page size (the default setting is 60 lines).
Press ENTER.
The Printout Specification screen appears where you can specify printer settings such as the amount of copies to be printed.
Press ENTER.
The list of objects contained in the library is printed on the specified printer device.
LIST - System Commands documentation
You can use the SYSMAIN utility or the system command SCAN to
search for objects contained in a library.
The following instructions are examples of finding objects by specifying search criteria by using either SYSMAIN menu functions or a corresponding command.
To find objects using menu functions
Invoke the Main Menu of the SYSMAIN utility as described in Steps 1 through 4 of To list all libraries using menu functions.
In the Object Code field, enter an A (default
setting) to search for all types of object.
(Exceptions: for error messages, enter an E, for debug environments
a D.)
In the Function Code field, enter an F
(Find).
Press ENTER.
The Find Programming Objects screen appears.
In the Code field, enter an A to search for all
types of object module: cataloged objects and source objects.
In the Object Name field, enter an asterisk (*) to search for all object names. Asterisk (*) is the default setting.
(For valid name ranges, see Specifying a Range of Names in the SYSMAIN Utility documentation.)
In the Source Library field, enter the ID of the library, in which to perform the search operation.
In the Criteria field, replace N (No) by
Y (Yes). N is the default setting.
Leave all other input fields unchanged.
Press ENTER.
The Additional Criteria window appears where you can enter additional search criteria as shown in the example below:
18:23:16 ***** NATURAL SYSMAIN UTILITY ***** 2009-05-20
User SAG - Find Programming Objects -
+------------------------------------------+
! --- Additional Criteria --- !
! !
! Object Type ..... PM__________________ !
! Date/Time From .. 2006-05-09 _____ !
! Date/Time To .... 2009-05-01 _____ !
! User ID ......... SAG______ !
! Terminal ID ..... ________ !
! !
! !
! Command ===> !
Code .. ! !
Object Name .. +------------------------------------------+
Source Library ... TEST____ Database .... 10___ File .. 32___
Options 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 one or more search criteria and press ENTER.
The window is closed. A plus (+) sign in front of the Criteria field indicates when additional criteria other than the object type are specified in the window.
Press ENTER again.
The Find Selection screen appears with a list of all source
objects and cataloged objects that are available in the specified library in the
current system file and that meet the specified search criteria. In the example
above, all objects of the types P (program) and M (map)
that were created or modified between 2006-05-09 and
2009-05-01 by the user SAG are listed.
Press ENTER to scroll down the list until the following message
appears: Library has been successfully listed.
From the Find Selection screen, you can select an object for further processing such as listing the source code of an object as described in Selection Lists for Programming Objects in the SYSMAIN Utility documentation.
Using Menu Functions and Commands - SYSMAIN Utility documentation
To find objects using a command
Enter the following system command:
SYSMAIN FIND ALL * TYPE PN WITH USER user-ID IN library-ID
where:
ALL specifies that all source objects and cataloged objects are to
be selected for the search operation.
Asterisk (*) specifies that all object names are to be selected for the search operation (see also Specifying a Range of Names in the SYSMAIN Utility documentation).
PN specifies the types of object for which to search: P
denotes program, N denotes subprogram.
library-ID is the ID of the library in which to search.
user-ID is the ID of the user for which to search.
Press ENTER.
The Find Selection screen appears with a list of all source objects and cataloged objects of the types program and subprogram that were created or modified by the specified user.
Keywords and Variables in Direct Commands - SYSMAIN Utility documentation
The following instructions are examples of finding objects by scanning their sources
for a particular string of characters by using the system command
SCAN.
Note
The SCAN does not process objects of the types error
message and debug environment. You can scan error messages by using the Scan in
messages function of the Natural utility SYSERR.
To scan sources using menu functions
Enter the following system command:
SCAN
Press ENTER.
A Scan Objects in Libraries screen similar to the example below appears where you can specify an object range and a scan value:
18:24:53 ***** NATURAL SCAN COMMAND ***** 2009-05-20
User SAG - Scan Objects in Libraries - Library TEST
Code Function
T Statistics
L List of Objects Containing Scan Value
S Object Lines with Scan Value
? Help
. Exit
Code ............ L
Scan value ...... LOCAL___________________________
Replace value ... GLOBAL__________________________
Library ......... TESTLIB_
Object name ..... *________ Selection list .. N
Object type(s) .. *_____________
Absolute scan ... N Trace ........... N
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
Help Menu Exit |
In the Code field, enter an L (for
) and specify a
scan value, a library and an object range; asterisk (*) selects all object names
and object types.
In the Replace value field, you can enter a character string
(for example, GLOBAL) that is to replace the specified scan value
(for example, LOCAL).
Press ENTER.
The Select Objects for Library screen appears for the
specified library in the current system file with a list of all source objects
that meet the specified search criteria. In the example above, all objects in the
library TESTLIB that contain the character string LOCAL
are selected.
From the Select Objects for Library screen, you can select an object and display or modify the source line that contains the scan value.
To scan sources using a command
Enter the following system command:
SCAN FUNC=L,SVAL=scan-value,LIB=library-ID,*
where:
scan-value is the character string (for example,
LOCAL) for which to scan sources.
library-ID is the ID of the library in which to search
(for example, TESTLIB).
Asterisk (*) specifies that all source objects are selected for the search operation.
Press ENTER.
SCAN - System Commands documentation
You copy or move a library by copying or moving all Natural objects from a source library to an existing or a new target library.
Renaming a library requires the same steps as moving a library. Once all objects of a library have been moved to a new target library, the old library is deleted automatically.
You can copy or move single or multiple objects from one library to another by using either the SYSMAIN utility or the Object Handler. The instructions below are examples of copying or moving all objects with SYSMAIN by using either menu functions or corresponding commands.
To copy or move all objects using menu functions
Invoke the Main Menu of the SYSMAIN utility as described in Steps 1 through 4 of To list all libraries using menu functions.
In the Object Code field, enter an A (default
setting) to select all types of object.
(Exceptions: for error messages, enter an E, for debug environments a
D.)
In the Function Code field, enter a C (for
) or an M (for
).
Press ENTER.
Depending on the function code entered, either the Copy Programming Objects or the Move Programming Objects screen appears.
In the Code field, enter an A to select all types
of object module: cataloged objects and source objects.
In the Sel. List (Selection List) field, replace
Y (Yes) by N (No). Y is the default
setting.
In the Object Name field, enter an asterisk (*) to select all object names. Asterisk (*) is the default setting. (For valid name ranges, see Specifying a Range of Names in the SYSMAIN Utility documentation.)
In the Source Library field, enter the ID of the library that contains the objects to be copied or moved.
In the Target Library field, enter the ID of an existing or a new library to which you want to copy or move the objects.
Leave all other input fields unchanged.
Press ENTER.
All source and cataloged objects are copied or moved between the specified source
and target libraries in the current system file and the following message appears:
Function completed successfully.
To copy or move all objects using commands
Enter one of the following system commands:
SYSMAIN COPY ALL * FM old-library TO new-library
(copies objects)
or
SYSMAIN MOVE ALL * FM old-library TO new-library
(moves objects)
where:
ALL specifies that all source objects and cataloged objects are to be
selected.
Asterisk (*) specifies that all object names are to be selected (see also Specifying a Range of Names in the SYSMAIN Utility documentation).
old-library is the ID of the library that contains the objects to be copied or moved.
new-library is the ID of an existing or a new library (see also Library Naming Conventions).
Press ENTER.
If the copy or move operation was successful, the command processed is displayed on
the screen followed by the message: Function completed
successfully.
For further information on the functions provided with the SYSMAIN utility such as replacing or renaming objects, refer to the Utilities documentation.
A library is only maintained in a Natural environment as long as it contains at least one source object or one cataloged object. If you delete all objects from a library, this library is no longer available.
You can delete single or multiple objects from a library by using the system command
LIST or a Natural utility.
The instructions below are examples of deleting objects from the current library by using
the system command LIST, and deleting objects from a different
library by using the menu functions or commands of the SYSMAIN utility.
Enter the following system command:
LIST *
where asterisk (*) specifies that all source objects and cataloged objects are to be listed (see also object-name-range in LIST in the System Commands documentation).
Press ENTER.
The LIST Objects in a Library screen appears with a list of source objects and cataloged objects available in the current library in the current system file.
In the Cmd column, next to the object(s) required, enter the following:
DE
as shown on the example screen below.
Press ENTER.
A DELETE window similar to the example below appears:
17:04:25 ***** NATURAL LIST COMMAND ***** 2010-03-01
User SAG - LIST Objects in a Library - Library TEST
Cmd Name Type S/C SM Version User ID Date Time
--- *________ *__________ *__ * *______ *________ *__________ *________
DE COPYLDA Co +---------------DELETE---------------+ 010-03-01 15:10:48
DE DEMOSPGM Su | | 010-02-05 19:00:08
DE EMP-L Lo | Please select one item: | 010-03-01 15:31:31
DE GDATEST Gl | | 010-03-01 15:23:37
__ HELPR1 He | _ Confirm each deletion | 010-03-01 15:13:12
__ LDATEST Lo | _ Delete without confirmation | 010-02-05 18:49:14
__ MAPTEST Ma | _ Exit (no deletion) | 010-03-01 15:14:16
__ PDASTUB Su | | 010-03-01 15:31:18
__ PDATEST Pa +------------------------------------+ 010-03-01 15:31:24
__ PGM01 Program S S 8.2.01 SAG 2010-03-01 15:29:31
__ SUBPGM1 Subprogram S S 8.2.01 SAG 2010-03-01 15:25:02
__ SUBRTEST Subroutine S/C R 8.2.01 SAG 2010-03-01 15:30:12
__ TESTPGM Program S S 8.2.01 SAG 2010-03-01 15:26:40
__ TEXTTEST Text S 8.2.01 SAG 2010-03-01 15:05:23
14 Objects found
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
Help Print Exit Sort -- - + ++ > Canc |
Mark an item by typing in any character next to the option required and press ENTER:
Confirm each deletion invokes a window for each object to be deleted in which you type in the name of the object to confirm the delete operation.
Delete without confirmation immediately executes the delete operation(s).
Exit cancels the delete operation(s).
To delete objects using SYSMAIN menu functions
Invoke the Main Menu of the SYSMAIN utility as described in Steps 1 through 4 of To list all libraries using menu functions.
In the Object Code field, enter an A (default
setting) to select all types of object.
(Exceptions: for error messages, enter an E, for debug environments a
D.)
In the Function Code field, enter a D (for
).
Press ENTER.
The Delete Programming Objects screen appears.
In the Code field, enter an A to select all types
of object module: cataloged objects and source objects.
In the Sel. List (Selection List) field, replace
Y (Yes) by N (No). Y is the default
setting.
In the Object Name field, enter an asterisk (*) to select all object names. Asterisk (*) is the default setting. (For valid name ranges, see Specifying a Range of Names in the SYSMAIN Utility documentation.)
In the Source Library field, enter the ID of the library you want to delete.
Leave all other input fields unchanged.
Press ENTER.
All source objects and cataloged objects are deleted from the specified library in
the current system file and the following message appears: Function
completed successfully.
To delete all objects using a SYSMAIN command
Enter the following system command:
SYSMAIN DELETE ALL * FM library-ID
where:
ALL specifies that all source objects and cataloged objects are to be
selected.
Asterisk (*) specifies that all object names are to be selected
(see also
Specifying a Range of Names in the
SYSMAIN Utility documentation).
library-ID is the ID of the library that contains the objects to be deleted.
Press ENTER.
If the delete operation was successful, the command processed is displayed on the
screen followed by the message: Function completed
successfully.