Working with User Files

User files are only available to users of Super Natural under Adabas.

This section covers the following topics:


What are User Files?

User files are files created by users. You can store both data copied from a database file and your own data in user files.

Other users can modify data contained in your user files and create reports using them only if the Super Natural administrator has given them authorization. Other users cannot delete your user files.

There are two ways of creating user files which are described in the sections Adding User Files and Creating User Files Using Report Destination USER FILE.

Note:
You can access user files created with Super Natural directly from a Natural session.

Listing User Files

Start of instruction setTo obtain a list of user files available

  • Issue the USERFILE command.

    Or:
    Select the object User Files on the Menu.

    The User File List screen appears.

     18:25                      ***** Super Natural *****                07.Jan.1993
     SN2400                        - User File List -                       Thursday
                                                                       More: <      
     Cmd  Name                  Description                                         
          *___________________                                                      
      __  EMPLOYEE-DATA         ____________________________________________________
      __  NEW                   ____________________________________________________
      __  PERSONNEL             file del____________________________________________
      __  SUMMARY               CREATED BY: UF1 (91-09-11 15:13)____________________
      __  USER-FILE-RECORDS     ____________________________________________________
      __  USERFILEV             CREATED BY: USERFIL (91-08-12 15:19)________________
      __  USERFILE1             first user file created in 3.1______________________
      __                        ____________________________________________________
      __                        ____________________________________________________
      __                        ____________________________________________________
      __                        ____________________________________________________
      __                        ____________________________________________________
     Add  ____________________                                                      
                                                                                    
     Cmd's: Info, Delete, Retrieve                                                  
     Userfile successfully deleted                                                  
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help        Exit              Flip        +           <     >     Canc   
    

    The User File List screen functions in the same way as all object list screens. For general information on object list screens, see Object List Screens in Starting Up.

    The User File List screen displays a list of your user files.

Notes:

  1. If a file is not in use, the description line contains a status message as described in the section Information Function.
  2. There is no Library field on the User File List screen.

Adding User Files

When you create a user file using the Add Userfile function you have two choices:

  • Design your own file layout by defining your own field descriptions

  • Copy the layout of an existing file. You cannot copy data from the template file.

When you create a user file using the Add Userfile function, the file you create is empty. You can add data to a user file using a data maintenance transaction. For further information, see Working with Data Maintenance Transactions.

Start of instruction setTo add a user file

  1. Enter a new user file name in the Name column of the User File List screen in the input field next to the Add field.

    Or:
    Issue the ADD USERFILE command.

    The Add User File window appears:

     14:21                      ***** Super Natural *****                08.Jan.1993
     SN2400                        - User File List -                         Friday
                                                                                    
     Cmd  Name          +----------------------Add User File-----------------------+
          *____________ !                                                          !
      __  EMPLOYEE-DATA ! User file name ........ NEW_________________             !
      __  PERSONNEL     ! Description ........... ______________________________   !
      __  SUMMARY       !                         ______________________________   !
      __  USER-FILE-REC !                                                          !
      __  USERFILEV     ! Use fields from file .. ________________________________ !
      __  USERFILE1     !                                                          !
      __                +----------------------------------------------------------+
        
    
  2. Enter a name for the user file you are creating in the User file name field.

    File names must begin with a letter or a special non-blank character and are limited to 20 characters.

  3. Enter a description of the user file in the Description field if required.

  4. If you want to copy the layout of an existing file, type it's name in the Use Fields From File field.

  5. If you don't know the name of the file you want to use, enter an asterisk (*) and the File Selection List window appears.

  6. If you don't want to copy the layout of an existing file, leave this field blank.

  7. Press Enter.

    The User File Description Editor appears. If you are not copying the layout of an existing file, the editor columns are blank:

     17:15                       ***** Super Natural *****               08.Jan.1993
     SNZUL-UF                - User File Description Editor -                 Friday
                                                                                    
               Fieldname                           Format  Length  Dec.Places  Key  
           1 <                                  >                                   
           2 <                                  >                                   
           3 <                                  >                                   
           4 <                                  >                                   
           5 <                                  >                                   
           6 <                                  >                                   
           7 <                                  >                                   
           8 <                                  >                                   
           9 <                                  >                                   
          10 <                                  >                                   
          11 <                                  >                                   
          12 <                                  >                                   
          13 <                                  >                                   
          14 <                                  >                                   
          15 <                                  >                                   
                                                                                    
                                                                                    
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help        Exit              Flip  -     +                       Canc   
    

    If you are copying the layout of an existing file, the field descriptions for that file are already entered in the columns of the user file layout editor. You can keep the descriptions, change them, delete them and/or add new field descriptions.

    The following diagram shows the User File Description Editor with the layout of the demonstration file SAG-TOURS-E-PERSON:

     14:26                       ***** Super Natural *****               08.Jan.1993
     SNZUL-UF                - User File Description Editor -                 Friday
                                                                       More:     +  
               Fieldname                           Format  Length  Dec.Places  Key  
           1 < PERSON-ID                        >    N         8                D   
           2 < BIRTH-DATE                       >    N         8                    
           3 < SEX                              >    A         1                D   
           4 < SURNAME                          >    A        20                D   
           5 < FIRST-NAME-1                     >    A        20                    
           6 < FIRST-NAME-2                     >    A        20                    
           7 < TITLE                            >    A        20                    
           8 < FORM-OF-ADDRESS                  >    A         8                    
           9 < ADDRESS-ADDITION                 >    A        20                    
          10 < STREET-NUMBER                    >    A        20                    
          11 < COUNTRY                          >    A         3                D   
          12 < ZIP-CODE                         >    A        10                D   
          13 < CITY                             >    A        20                D   
          14 < AREA-CODE                        >    A         6                    
          15 < PHONE-NUMBER                     >    A        15                    
                                                                                    
                                                                                    
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help        Exit              Flip  -     +                       Canc   
    

    If you are copying the layout of an existing file, some of the fields of that file may not be presented in the User File Description Editor. The omitted fields are Adabas phonetic descriptors and group fields. Multiple-value fields and fields contained in a periodic group are changed to elementary fields. Field format and length are not changed.

    You use the User File Description Editor to edit the layout of the user file you are creating by adding, modifying and/or deleting field descriptions. For information on how to use Super Natural editors, see Editor Commands and Editor Help System in Using Editors.

  8. Type/modify the names of the fields you want in your user file in the Fieldname column.

    Do not use Natural key words as field names.

  9. Type/modify the format of the fields you want in your user file in the Format column.

    You can define fields with format "A" or "N" only.

  10. Type/modify the number of decimal places each field should have in the Dec. Places column.

    For fields of format "A", no decimal places are allowed. For fields of format "N", 0-7 decimal places are allowed.

  11. Mark at least one alphanumeric field in the Key column.

  12. When you have finished making your entries in the User File Description Editor, press PF8.

    The user file is created and the User File List screen appears.

    Once a user file has been created, you cannot modify the field definitions.

Information Function

Start of instruction setTo obtain information on a user file

  • Enter the command abbreviation IN in the command column of the User File List screen next to the user file name.

    Or:
    Issue the INFO USERFILE name command.

The User File Information window appears which contains the following fields:

Field Description

File The full name of the file (the user file prefix, the user ID and the name given by the user).
Description You can enter or modify a description of the file here.
Creation Date/Time Date and time at which the file was created.
Status Status of the file as follows: IN USE Field definitions (and possibly data) exist for this file
DATA DEL Field definitions exist. Data has been cleared
FILE DEL File has been deleted logically but can still be retrieved ******** Deletion currently in process.
Record Count Number of records contained in the file.
Expiration Date Date after which the file will be automatically deleted. The user file expire period is determined by the Super Natural administrator.
Field Name Column showing the names of the fields contained in the user file. The field name may differ from the field heading defined for display.
Format/Length Column showing the format and length of the fields contained in the user file. "A" indicates alphanumeric fields, "N", numeric fields.
Key Column showing which fields are defined as key fields in the user file. Key fields are indicated by the entry "DE".

Deleting User Files

When you delete a user file, you have two options:

  • Delete the data and the file description

    Or:

  • Delete the data only (the file description remains)

You can delete a user file description and/or data online, in Batch mode or so that the user file is retrievable.

Start of instruction setTo delete a user file

  1. Enter the command abbreviation DE in the command column of the User File List screen next to the user file name:

    Or:
    Issue the DELETE USERFILE name command.

    The Delete User File window appears:

     11:54                      ***** Super Natural *****                 1993-05-24
                                   - User File List -                         SN2400
                                                                                    
     Cmd  Name                  Descrip +-------------Delete User File-------------+
          *___________________          ! File: TEST                               !
      de  TEST                  _______ !                                          !
      __                        _______ !    Delete All (Data and Definition)      !
      __                        _______ ! _  Retrievable                           !
      __                        _______ ! _  On-line                               !
      __                        _______ ! _  Batch                                 !
      __                        _______ !                                          !
      __                        _______ !    Delete Data (File Definition Remains) !
      __                        _______ ! _  Retrievable                           !
      __                        _______ ! _  On-line                               !
      __                        _______ ! _  Batch                                 !
      __                        _______ !                                          !
      __                        _______ +------------------------------------------+
     
    
  2. Mark the appropriate field.

  3. Press Enter.

    If you decide to delete online or in Batch mode, a Confirmation window appears displaying the number of records contained in the file. It is more efficient to delete large files in batch mode rather than online.

    If you decide on retrievable delete, the user file description and/or data is not deleted immediately. You can retrieve the user file description and/or data at any time until deletion by a system routine set up by the administrator. The file remains on the User File List screen until this time and displays the description file del. For further information on the system routines at your site, ask your Super Natural administrator.

Retrieving User Files

Start of instruction setTo retrieve a user file

  • Enter the command abbreviation RE in the command column of the User File List screen next to the user file name.

    Or:
    Issue the RETRIEVE USERFILE name command.

Note:
You cannot retrieve a user file if the Super Natural administrator has deleted the file and/or its data or if the file expiration date has been reached.

Creating User Files Using Destination USER FILE

When you create a user file using the transaction mode Destination USER FILE, the layout and data of an existing file or files as determined using a reporting transaction are copied to the user file.

Start of instruction setTo create a user file using Report Destination USER FILE

  1. Issue the ADD TRANSACTION name command.

    The Add Transaction window appears.

  2. Enter the name of the file from which you want to copy layout and data.

  3. Set the reporting mode Destination to USER FILE.

    For further information, see Using Reporting Transactions and Defining Transaction Modes for Reporting.

  4. Press Enter.

    The Destination User File window appears:

     16:42                      ***** Super Natural *****                08.Jan.1993
     SN1110                       - Transaction List -                        Friday
                                                                                    
     Cmd  Name    +----------------------Destination User File---------------------+
          UF_____ !                                                                !
      __          ! Userfile name .. UF__________________                          !
      __          ! Description                                                    !
      __          !   CREATED BY: UF (08.Jan.1993 16:43)__________________________ !
      __          !                                                                !
      __          +----------------------------------------------------------------+
      
    
  5. Type a name for the file you are creating in the User File Name field.

    File names must begin with a letter or a special non-blank character and are limited to 20 characters.

    A default description is entered in the Description field which lists the transaction used to create the file, creation time and date.

  6. Modify the description if you wish.

  7. Press Enter.

    The Worksheet appears:

     16:45                      ***** Super Natural *****                08.Jan.1993
     SN3011                           - Worksheet -                           Friday
                                                                                    
     Ref DB    Field Name                         Seq  S/C  Key  Func Def  Info Del 
     AQ        ________________________________   ___  ___   __   __   __   __   __ 
     AR        ________________________________   ___  ___   __   __   __   __   __ 
     AS        ________________________________   ___  ___   __   __   __   __   __ 
     AT        ________________________________   ___  ___   __   __   __   __   __ 
     AU        ________________________________   ___  ___   __   __   __   __   __ 
     AV        ________________________________   ___  ___   __   __   __   __   __ 
     AW        ________________________________   ___  ___   __   __   __   __   __ 
     AX        ________________________________   ___  ___   __   __   __   __   __ 
     AY        ________________________________   ___  ___   __   __   __   __   __ 
     AZ        ________________________________   ___  ___   __   __   __   __   __ 
     BA        ________________________________   ___  ___   __   __   __   __   __ 
     BB        ________________________________   ___  ___   __   __   __   __   __ 
     BC        ________________________________   ___  ___   __   __   __   __   __ 
     BD        ________________________________   ___  ___   __   __   __   __   __ 
                                                                                    
                                                                                    
     Enter "*" in Fieldname column to select fields or enter NEXT                   
     Command ===>                                                                   
     Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
           Help  Next  Exit        Incl  Flip  -     +           Sel   Run   Canc   
    

    The Worksheet has an extra column named Key.

  8. Make your entries in the Worksheet noting the restrictions described in the following section Using the Worksheet with Report Destination USER FILE.

  9. Finish adding the transaction in the normal way.

  10. Run the transaction.

    When you save or run the transaction, the data you have selected for the report and the fields marked for display are used to create the user file.

Note:
Records selected for transfer which contain multiple value fields or a field contained in a periodic group for transfer to a user file, are flattened. This means that for each occurrence, a separate record is written to the user file. For further information on flattening, see Transaction Options in Adjusting a User Profile.

Using the Worksheet with Report Destination USER FILE

When you are using report Destination USER FILE, the Worksheet has an extra column named Key and certain restrictions must be observed.

The Key Column

You must mark at least one alphanumeric field as a key field in the Key column. Key fields must also be marked with a number in the Sequence column.

Control Breaks

Report Level DETAIL

If you are using the transaction mode Report Level DETAIL, only a sort occurs at control breaks and you cannot use the system functions.

Report Level SUMMARY

If you are using the transaction mode Report Level SUMMARY, you can define one control break only.

If you define no control breaks, only the Grand Total is written to the user file - one record!

If you define more than one control break, the break with the highest number is taken and the others are used as sort levels.

You can only define one system function for each field. If you define more than one system function, the first found in the following list is performed:

  • Count (Cnt)

  • Total (Tot)

  • Sum (Sum)

  • Average (Avg)

  • Maximum (Max)

  • Minimum (Min)

  • Null Count (NCnt) null values ignored

  • Null Average (NAvg) null values ignored

  • Null Minimum (NMin) null values ignored

Note:
Null values are zero for numeric fields and blank for alphanumeric fields.

If you define no system function for a field but the field is marked in the Sequence column, the old value is taken.

Fields

You can only use fields of alphanumeric and numeric format. You cannot use system variables.

Field Length

The field length defined in the Define Field Output window is transferred to the user file. You can change the field length if you wish.

There are no other restrictions on how you create the transaction.

Transactions with Report Destination USER FILE

When you create a user file by sending a report to destination USER FILE, the transaction is stored in your private library. You can execute the transaction again or copy it directly from the Transaction List screen or modify the transaction and run it again. It is important to know what happens to the existing user file and any transactions which perform data maintenance functions on it in each case.

Executing Transactions with Report Destination USER FILE

If you execute a transaction with destination USER FILE, the existing user file and data are retained and additional data is written to the file. Any modifications made to the data in the existing user file using data maintenance transactions are retained. The corresponding ADD, UPDATE and DELETE transactions can still be executed. If you used dynamic input fields for data selection, you can also write new data to your file. You are asked to enter the selection criteria value during transaction execution. You can still use the transactions you have created which use the user file.

Modifying and Running Transactions with Report Destination USER FILE

If you use the Modify Transaction function and run the transaction again, the existing user file is deleted and a new file is created. Any modifications made to the data in the existing user file using data maintenance transactions are lost. The ADD, UPDATE and DELETE transactions remain. The transactions which use the user file remain.

If you have not modified the layout of the user file (selected different fields) and you try to run the corresponding ADD, UPDATE and DELETE transactions again, a warning message is issued, since the file for which they were created no longer exists. However, you can still run the transactions. You can still use the transactions you have created which use the user file.

If you have modified the layout of the file (selected different fields), an error message is issued if you try to run the corresponding ADD, UPDATE and DELETE transactions again. An error message is issued if you try to use the transactions you have created which use the user file.

Copying Transactions with Report Destination USER FILE

If you use the Copy Transaction function, the destination of the new transaction is changed to the value set in your User Profile. This is because there cannot be more than one transaction which adds the same user file.

Note:
You cannot copy a transaction with the transaction mode Report Destination USER FILE into a common library.