Using Sets

#### Search Results

Search

# Using Sets

This document covers the following topics:

- Functional Scope

- Examples for the Use of Sets

- Using Sets to Share Work among Team Members

- Internal Structure of Sets

- How are Sets Created?

- Who can Work with Sets?

- Working With Sets

- Creating a New Set via Selection

- Operate on Sets

- Application Programming Interface

## Functional Scope

Predict can save the output list of XRef data retrieval in sets for subsequent processing:

- The Natural objects listed in a set can be cataloged, checked or stowed and their contents can be edited or listed directly from the set.

- An existing set of object types and names can be displayed, purged or sent to another user. When a set is sent, a short comment can be included that will appear when the set is displayed at the terminal of the recipient.

- Sets can be merged, subtracted or intersected.

- Sets are identified by the functions that were used to create them.

- Sets are saved separately for each user and each Natural library. Any user who is defined in the Predict data dictionary can create and use up to ninety-nine sets in any library.

Notes:

1. Sets can be used as input for certain `LIST XREF` commands. This is documented where applicable for each command individually in section Retrieving Information For Individual Members. This also applies when issuing these commands in batch mode. Refer to Commands for Retrieving Information for Individual Members in section LIST XREF Commands for details.
2. Sets can also be used in the Natural Object Handler, the SYSMAIN utility, the Natural System Commands `CATALL` and `SCAN` and in Natural ISPF.

All functions used to process sets are called from the Operate on sets screen. See Operate on Sets.

## Examples for the Use of Sets

- Whenever copy code is changed, all programs that use the copy code may require corresponding changes. The Natural `LIST XREF` function Copy code referenced in programs can be used to find out which programs may be affected. If the types and names of these programs are saved as a set, the programs can be modified, one after another, to match the changed copy code with a single call.

- Whenever a free or automatic processing rule is changed, all maps that use the processing rule must be recataloged. A Natural `LIST XREF` function can be used to find out which programs (maps) are affected and to save their types and names as a set. Later, a single function can be used to recatalog all maps included in the list.

## Using Sets to Share Work among Team Members

When a project team is working on a Natural application, one member of the team may create a set that describes objects which require work from other members of the team. Using the send function, either the whole set or selected members can be copied or moved to any other user who is authorized to log on to the same library. A short comment can be sent with the set to tell the recipient why it has been sent. The set that was sent will appear next time that the recipient logs on to the library and displays the Operate on sets screen of the Natural `LIST XREF` command. The short comment will appear when the set of object types and names is next displayed.

## Internal Structure of Sets

A set is a list of the types and names of program and/or data areas selected from a Natural library. All objects in the list are members of the same Natural library.

The type and name specification for each Natural object has the format type:name, for example:

S:SUB1

Valid types
A | Parameter data area
G | Global data area
H | Help routine
L | Local data area
M | Map
N | Subprogram
O | Command processor
P | Main program
S | Subroutine
T | Dialog
Y | Natural Expert model
4 | Class
F | Function
8 | Adapter
C | Copy code
X | Text
5 | Resource

Hence, the example above specifies the Natural subroutine named SUB1.

Sets are saved separately for each user and each Natural library.

## How are Sets Created?

There are two ways to create a set:

- Set the Save set parameter to Y before executing a retrieval function for XRef data. A default value can be specified for this parameter in the XREF profile. This value is used when the command `LIST XREF VERIFY ALL` is executed.

- Set the `SAVE` parameter to Y when executing a `LIST XREF` command (online or batch mode).

- Use the function Creating a New Set via Selection.

## Who can Work with Sets?

Any user defined in Predict can use functions of Predict and the Natural `LIST XREF` command to save sets of Natural object types and names. Up to ninety-nine sets of object types and names can be saved at any time in any Natural application (library) to which that user has access. Attempts to create a hundredth set will produce an error message.

## Working With Sets

Two functions in the XREF menu apply to sets:

N | Create new set via selection
O | Operate on sets

## Creating a New Set via Selection

The input screen is displayed with N in the XRef menu.

     16:59:34            *****  P R E D I C T *****                      2009-09-02
     Library: SYSDIC               - Create  Set -           DBnr:   180 Fnr:    64

          Object name: *_______
       Mark to select: _ all stowed objects
                       _ all objects not yet catalogued
                       _ all catalogued objects without source

       Mark to select: _ Global Data Areas           _ Local Data Areas
                       _ Parameter Data Areas        _ Subroutines
                       _ Subprograms (CALLNAT)       _ Helproutines
                       _ Maps                        _ Programs
                       _ Classes                     _ Dialogs
                       _ Functions                   _ Adapters
                       _ Copy Codes                  _ Texts
                       _ Resources

    Command ===>
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Invp  GDAV  Quit  Sets  Rule  Copy  Xref  View  OSet  SPfk  Main  Exit

Sets can be created by entering selection criteria in the set creation screen. Asterisk notation is allowed, and one or more selection marks can be entered to restrict the set to Natural objects of certain types. All Natural objects that meet the given selection criteria are included in the set.

Note
Only objects from the current library are written to the set. A library or runtime structure can not be evaluated.

## Operate on Sets

Sets can be displayed, deleted, sent, sorted (by name or type), modified, combined (merge, intersect, subtract), cataloged, checked, stowed, listed and edited. To process sets, display the Operate on sets screen with code O from the XRef menu.

     19:32:57                *****  P R E D I C T  *****                 2011-10-25
     Library: SYSDIC             - Operate on sets -         DBnr:   180 Fnr:   106

     O  Nr  created with function                                Date   C/K/W Count
        __                             (1 of 3)
     _  1   REPORT * (*) BY * ON * SAVE Y                      2011-10-25         1
     _  2   SELECT MENU                                        2011-10-25  C      1
     _  3   ERNIE -> SELECT AB8* (N)                           2011-10-25        74

     O: (I,U,X,Y       Intersection,Union,Difference X minus Y)
        (C,K,W,E,L     Cat,Check,Stow,Edit,List) Keep set after Cat/Check/Stow .. N
        (D,P,S,T,N,M,? Display,Purge,Send,Sort by type,Sort by name,Modify,Help)
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Invp  GDAV  Quit  Sets  Rule  Copy  Xref  View  OSet  SPfk  Main  Exit

### Explanations

- A set is identified by a number and the text of the command that corresponds to the function with which the set was created (see Set 1 in the screen above).

- Sets created with the function Creating a New Set via Selection are identified with the text SELECT (see Set 2 in the screen above).

- C, K or W in the column C/K/W means that all entries in the Set were cataloged with `CAT`, `CHECK` or `STOW` and that errors occurred during checking or cataloging (Set 2). The set contains only members which produced errors (if option Keep set after Cat/Check/Stow is set to N, as in the screen above).

- Sets that were sent by another user are identified with the user ID of the sender and -->.

  Set 3 in the example above was sent by user ERNIE.

### Displaying, Deleting, Sending and Sorting Sets

Sets can be displayed (D), purged (P), sent to another user (S) or their members can be sorted by type (T) or by name (N).

- Sending a Set
  Using the Send function, either the whole set or selected members can be copied or moved. A short comment can be sent with the set to tell the recipient why it was sent. The set that was sent will appear next time that the recipient logs on to the library and displays the Operate on sets screen of the Natural `LIST XREF` command. The short comment will appear when the set of object types and names is next displayed.

- Sorting a Set
  When sorting by name (code N), the Natural objects are sorted in alphabetical order. When sorting by type (code T), the Natural objects are displayed in the following order:

G | Global data area
L | Local data area
A | Parameter data area
S | Subroutine
F | Function
N | Subprogram
H | Help routine
M | Map
8 | Adapter
P | Main program
4 | Class
T | Dialog
C | Copy code
X | Text
5 | Resource

Within one type, the objects are displayed alphabetically.

### Modifying Sets

Enter function code M in the column O of the Operate on sets menu to display the following screen for the selected set.

         13:18:56            *****  P R E D I C T  *****              2009-05-31
         Library: SYSDIC             - Operate on sets -         DBnr:   180 Fnr:    54

         Set Nr ............: 1
           Header ..........: PROG * (*) USING PROG * (*) WITH * VIA *

           Abstract ........:

You can modify the following set attributes:

Set nr. | You may enter a new set number between 1 and 99. The new number must not already exist.
Header | The header of a set indicates how the set was created. This information can be modified if required.
Abstract | Up to 10 abstract lines of up to 50 characters each can be specified.

### Combining Sets

New sets can be created by combining existing sets in one of the following ways:

- Merging sets by marking two or more sets with U (union);

- Intersecting sets by marking two or more sets with I;

- Subtracting sets by marking them with X and Y.

Note
Sets can only be merged or intersected if they are sorted with the same sort order.

Predict assigns names to new sets that indicate which sets were combined and in which manner, for example: (2 i 3) denotes a set created by intersecting sets 2 and 3.

### Cataloging, Checking, Stowing, Listing and Editing Objects Contained in Sets

Natural objects contained in sets can be processed directly from the set. Objects can be cataloged (C), checked (K) or stowed (W) and the source code of all the objects (if it exists) can be listed (L). The catalog, check, stow and list functions are also available as commands.

The edit (E) function can be used to display a set of object types and names as a menu. Individual Natural objects can then be marked to select their contents for editing (E) or listing (L), or to list directory (I).

If option Keep set after Cat/Check/Stow is set to Y, the set is retained after cataloging, checking or stowing. Otherwise the set is deleted or contains the entries for which errors were found.

## Application Programming Interface

Two Application Programming Interfaces (API) are delivered which allow you to retrieve and maintain information about sets. For further information see Using API / Subprogram USR2033N and Using API / Subprogram USR4013N in the section Application Programming Interface of the Predict Administration documentation.

### On this page

- Functional Scope
- Examples for the Use of Sets
- Using Sets to Share Work among Team Members
- Internal Structure of Sets
- How are Sets Created?
- Who can Work with Sets?
- Working With Sets
- Creating a New Set via Selection
- Operate on Sets
- Application Programming Interface