Creating a file with FILEMGMT: Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 5: Line 5:
<p>Adding a file to the database includes the following steps:</p>
<p>Adding a file to the database includes the following steps:</p>
<ol>
<ol>
<li>Defining the file organization and recovery options (File Definition - Organization screen).</li>
<li>[[#Defining_file_organization|Defining the file organization]] and recovery options (File Definition - Organization screen).</li>
<li>Defining the file security (File Definition - Security screen).</li>
<li>Defining the file security (File Definition - Security screen).</li>
<li>For procedure files, defining the parameters for the procedures contained in the file (File Definition - Procedure screen).</li>
<li>For procedure files, defining the parameters for the procedures contained in the file (File Definition - Procedure screen).</li>

Revision as of 17:17, 29 January 2014

Overview of creating files

Prerequisites:

You must have Dictionary/204 and its subsystems running in order to use FILEMGMT.

Before working your way through the File Management Subsystem facility (FILEMGMT) interface to create a file, you should have made decisions about the organization, recovery options, and security for the file you are creating. See the chapters on Planning and File design for more information.

Adding a file to the database includes the following steps:

  1. Defining the file organization and recovery options (File Definition - Organization screen).
  2. Defining the file security (File Definition - Security screen).
  3. For procedure files, defining the parameters for the procedures contained in the file (File Definition - Procedure screen).
  4. For data files, defining fields, records, and field groups in the following order:
    1. Defining the fields in the file. (Field Name List screen; Field Attributes screen)
    2. Defining the records in the file. (Record Name LIst screen; Record Definitions screen)
    3. Defining the field groups in the file. (Optional. Field Group List screen; Field Group Definition screen.

    See "Field group maintenance" in the Rocket Model 204 Dictionary/204 and Data Administration Guide for details.

  5. Sizing the file and its tables. (File Size Definition screen)
  6. Modifying the file's field, record, and field group definitions and the size specifications, as needed.
  7. Executing the CREATE command (Execute Commands screen).

Defining file organization

  1. Log on to FILEMGMT as described in Logging on to FILEMGMT.
  2. Select the FILE Maintenance CREATE function (number 1) from the primary screen.

    FILEMGMT displays the first of the three File Definition screens, the Organization Screen:

File Definition - Organization screen

FILEMGMT File Definition - Organization PAGE 1 OF 3 Filename: VEHICLES FICREATE: 7.1 LANGUAGE: Active/Inactive I FILE ORGANIZATION Optimized Field Extract: N FILEORG X' 0E ' Entry:__ Sorted:_ Hash:X Unordered:_ Reuse Record Numbers:_ Sort/Hash Key: Req Evry Rec:X Enable Skewing:_ Table B Auto Increase Pages: 0 Table D Auto Increase Pages: 0 Table X Auto Increase Pages: File Models: None X 1nf _ Numeric Validation_ FILEMODL X' 00 ' FILE OPTIONS FOPT X' 00 ' Disable Lock Pending Updates: _ Only FM Defines New Fields: _ No Procedure Statement Numbers: _ No Procedure Statement Labels:_ Enable Date Time Stamp: N FILE RECOVERY OPTIONS FRCVOPT X' 00 ' Disable Transaction Back out: _ No Rollforward (RF): _ No RF Logging: _ No Checkpoint (CK) Logging: _ No Updates Without RF Logging: _ No Updates Without CK Logging:_ All Updates Applied During RF: _ No Discontinuities Allowed: _ Format File During CREATE: Y Verify Disk Updates: N ===> 1=HELp 2= 3=QUIt 4=FIElds 5=WIDen 6=COMmands 7= 8=FORward 9=SIZe 10= 11= 12=END

You use the File Definition - Organization screen to name a new file and to specify file organization parameters. When this screen is displayed for a file for the first time, the standard Model 204 default values for the parameters are used.

Model 204 default values are supplied for any parameters for which you do not fill in values.

You select options from the choices on the screen, and FILEMGMT uses your selections to compute appropriate values for the Model 204 FILEMODL, FILEORG, FOPT, and FRCVOPT parameters.

  1. In the Filename input field, enter the name of the file that you are creating.

    The name can be up to 8 characters long. The filename cannot be FILE or GROUP and cannot start with CCA, SYS, OUT, TAPE, or a number. It must start with a letter, and can contain only letters, numbers, and the following special characters:

    At sign (@)

    Pound sign (#)

    Dollar sign ($)

  2. The FICREATE input field displays the Model 204 version number for the file that you are creating. FILEMGMT uses FICREATE to calculate the file size and validate certain Model 204 file features. Enter a different version number if needed.
  3. The LANGUAGE input field displays the language of the file that you are creating (set by the LANGFILE parameter). The default is U.S. English. Enter a different language if needed.
  4. Change the Active/Inactive default value as needed.

    The Active/Inactive input field specifies how the commands in your file will be processed when you execute commands from the Execute Commands screen.

    Active or inactive indicates the mode you selected on the Organization screen or last used to execute commands against the file. The file itself is referred to as active or inactive, depending on the mode in which commands for the file were last executed.

    If you have permissions to change the value, and your system supports the alternative option you choose, your entry will override the system default set by the system administrator.

    • Type A to create an Active file. The commands will be executed immediately (upon verifying your permissions) or later in a batch file. Select the active execution mode if you choose to transform the file to current release format. Set FICREATE to the current release number.
    • Type I to create an Inactive file. The commands will be generated and stored in separate files for later execution.

      Active and inactive options are described in "Execution options" on page 219 and "Execute Commands screen" on page 305.

  5. In the Optimized Field Extract input field, enter Y to add a length byte to every non-preallocated (or non-OCCURS) field, which could result in faster field extraction. The improvement is most noticeable when you have built records with a large number of fields. Entering Y sets FILEORG to X'80'.

    The default is N: non-preallocated (or non-OCCURS) fields that are type FLOAT, CODED, and BINARY are not stored with a preceding length byte. See Preallocated fields for more information on preallocated and non-preallocated fields.

  6. In the FILE ORGANIZATION section, select file organization characteristics for the specified file. FILEMGMT computes the Model 204 FILEORG parameter from your selections and displays the computed value. See File design (File management) for details on the advantages and disadvantages of each file organization type.

    Select one of the following options:

Option Parameter value Description
Entry (FILEORG=x'00') Records are stored in the file in the order in which they are entered. You cannot reorder records or reuse the record numbers of deleted records. Entry is the default file organization.
Sorted (FILEORG=x'01') Records are stored in the file in order by the sort key that you specify. Sorted is less efficient than the other options and is not recommended.
Hash (FILEORG=x'08') Records are stored in the file in order by the hash key that you specify.
Unordered (FILEORG=x'20') Records are stored in the file in the order in which they are entered. You can reorder records and reuse the record numbers of deleted records.

A record is stored on a page if there is sufficient space (as determined by the BREUSE parameter) and if there is an unused record number.

  1. In the Reuse Record Numbers input field, enter Y or N.

    Available with Unordered, Hashed, or Sorted file organization. Select Reuse Record Numbers if you want the record numbers of deleted records to be reused for new records added, provided that the record number is available on the Table B page to which the new record is being added. Selecting Reuse Record Numbers sets FILEORG=x'04'.

  2. Enter a Sort or Hash key, if applicable.

    If you have selected Hashed or Sorted as the file organization, enter the name of the sort or hash key field. The entry must be a valid Model 204 field name (1-70 characters). The requirements for a valid field name are described in Field name rules. The sort or hash key field must exist in every record in the file.

    If you have selected the Entry or Unordered file organization option, leave Sort/Hash Key blank.

  3. In the Req Every Rec input field:
  4. If you have selected Hashed or Sorted as the file organization, enter X to place a hash key (for hashed files) or a sort key (for sorted files) on every record. This option is required for Hashed or Sorted files because a key on every record is needed to process the file correctly. This option sets FILEORG=x'02'.
  5. If you have selected the Entry or Unordered file organization option, leave Req Evry Rec blank.
  6. Leave the Enable Skewing input field blank. Skewing is an obsolete method of physical storage that was designed to improve efficiency during sequential searches. An X would indicate that blocks within a track were stored in a skewed order.
  7. Select the following Auto Increase options as needed. See File size calculation in detail for details.
  8. TableB Auto Inc: If you want Model 204 to automatically increase Table B when it is opened or becomes full, enter an x beside one of the following options:
  9. Full: Table B will be automatically increased when it fills up by the amount specified in the parameter BAUTOINC.
  10. At Open: Table B will be automatically increased at file open time. [!!!is it increased when the table opens or the file opens?]
  11. Table B Auto Increase Pages: If you have selected a TableB Auto Inc option, enter the number of pages to increase Table B by. This sets the parameter BAUTOINC to the specified value.
  12. Table D Auto Increase Pages: If you want Model 204 to automatically increase Table D when it is opened or becomes full, enter the number of pages to increase Table D by. This sets the parameter DAUTOINC to the specified value.
  13. Table X Auto Increase Pages: If you want Model 204 to automatically increase Table X when it is opened or becomes full, enter the number of pages to increase Table X by. This sets the parameter XAUTOINC to the specified value. To use Table X:
  14. The file must have been created in Model 204 version 7.1.0 or later.
  15. The file must have an organization type of Entry or Unordered.
  16. File Models: A file model is a set of default file and field attributes. Rocket Software recommends that you use the default setting.
  17. In the FILE OPTIONS section, select the characteristics of the file you are creating. FILEMGMT computes the Model 204 FOPT parameter from your selections and displays the computed value.
    Disable lock pending updates Transaction back out locks an update until the transaction is committed, allowing an update to be backed out prior to the commit if for any reason the transaction does not finish. By disabling Lock Pending Updates, the feature Transaction back out is also disabled (Disable Transaction Backout must also be selected). If Disable lock pending updates is selected, incomplete transactions may be present in the file which may result in a file that is logically inconsistent. (FOPT=X'02')

    The default is null.

    Only file manager defines new fields This option prevents the DEFINE FIELD command from being issued without using the FILEMGMT facility. The purpose of this option is to maintain the integrity of the dictionary. By using the FILEMGMT facility to define fields, the relationship between a file, the records in the file and the fields and their relationship to the file and the records within the file is automatically maintained in the Dictionary. (FOPT=X'01')

    The default is that new fields can be defined outside of FILEMGMT on the command line.

    No procedure statement numbers Selecting this option prevents any procedures from being stored in the file which use statement numbers. Using statement numbers is an obsolete way of coding a User Language procedure which is difficult to understand. If this file is being used to store procedures, select this option in order to enforce proper coding standards. (FOPT=X'80')
    No procedure statement labels Selecting this option prevents any procedures from being stored in the file which use statement labels. Statement labels are the proper way to code a User Language procedure. If this file will be used for storing procedures, enter N or leave the input field blank. Otherwise, enter Y if you want to prohibit procedure statement labels from being assigned to procedure lines. (FOPT=X'40')
    Enable Date Time Stamp The Date Time Stamp is an additional field within the file which tracks changes to a file at the record level and records the date and time of each update to a record. (FOPT=X'10') For details, see Overview of the date-time stamp feature.

    To use the date-time stamp:

    • The file must be an LPU file.
    • The date/time stamp field specified in the DTSFN= system parameter must have already been defined to the file. For details, see Enabling date-time stamp updates.
  18. In the FILE RECOVERY OPTIONS section, select file recovery options for the file. FILEMGMT computes the Model 204 FRCVOPT parameter from your selections and displays the computed value.

    By default, recovery features are enabled. In an online environment, using the default options is recommended so that the file can participate in recovery if the system crashes.

    You might want to turn off recovery options if you are running a batch job that does not need to incur the overhead of recording information for recovery. FILEMGMT provides options to turn off specific recovery features, as described below.

    See File integrity and recovery for details about these options.

  19. Disable Transaction Backout File does not use the Model 204 transaction back out feature. This option is required if Disable Lock Pending Updates is selected.

    Transaction back out is a feature that will back out an update if the update does not complete as intended. This feature maintains the logical integrity of the file by ensuring that if the commit for an update is not executed, the update will not be kept.

    The default is null.

    (FRCVOPT=X'08')

    No Rollforward (RF) File does not use the roll forward facility of the RESTART command. The default is null. This option prevents the updates from the file from being processed during roll forward. If this option is selected, the file will not participate in roll forward when the system performs recovery.

    (FRCVOPT=X'02')

    No RF Logging Model 204 does not log changes to the journal file. The default is null. Roll Forward logging is the recording of updates from a file that are then used to apply updates when recovery is run. Selecting this option prevents the file from being able to use recovery.

    (FRCVOPT=X'04')

    No Checkpoint (CK) Logging Model 204 does not log checkpoint information to the checkpoint data set. The default is null.

    Checkpoint logging is the process of capturing the contents of a record before an update is made. If checkpoint logging is not active, the file cannot participate in recovery.

    (FRCVOPT=X'20')

    No Updates without RF Logging File is not updated unless roll forward logging is active. The default is null.

    Selecting this option requires that a journal be defined in the environment in which updates are made to the file. If a journal is not available, updates will not be allowed. If updates are made using a batch job, selecting this option will require that the batch job have a journal defined to it that will allow roll forward logging to be performed.

    (FRCVOPT=X'80')

    No Updates without CK Logging File is not updated unless checkpoint logging is active.The default is null.

    This option requires that a checkpoint data set be defined to the run. Updates will not be allowed unless a checkpoint data set is present. If updates are made using a batch job, the job must have a checkpoint data set.

    (FRCVOPT=X'40')

    All Updates Applied During RF All updates to the file are applied when the file is rolled forward. The default is null.

    This option will apply all updates during roll forward and not back out any incomplete update transactions. This option can only be used if Transaction back out (TBO) is turned off. This can be useful if a large number of updates are made without a commit being issued. It is suggested that after recovery has been run against a file with this option that a REORG be run against this file to ensure that the data and the indexes are in sync.

    (FRCVOPT=X'09')

    No Discontinuities Allowed Only updates that do not result in discontinuities are applied to the file. The default is null.

    A discontinuity is an event that cannot be rolled back past during recovery. It will process the file using the discontinuity as a checkpoint for roll back and roll forward recovery. Essentially, a discontinuity creates a checkpoint for the file in question at the point in time when the discontinuity occurs. There is really no reason not to allow discontinuities.

    (FRCVOPT=X'10')

  20. Format File During CREATE: FILEMGMT formats the file during file creation. Valid values are Y and N. Rocket Software recommends that you use the default value, Y, in order to maintain file integrity.
  21. Verify Disk Updates: FILEMGMT verifies all updates made to the file during file creation. Valid values are Y and N. Rocket Software recommends that you use the default value, N. The computer does its own verification of disk updates, so this option is no longer necessary and likely to cause overhead.

Recreating files

A file recreate is necessary if, for example, you want to increase a table size that cannot be increased in the existing file. Recreating a file deletes all the data and procedures in the file, but leaves the field, record, and field group definitions intact. To preserve the data and procedures, you must dump or display the files and procedures. You cannot recreate a file from the primary screen, which has entities staged with commands.

To recreate a file:

Select the File Maintenance Recreate function from one of the following:

  • Primary screen if the file is an existing file.
  • File Size Definition screen if the file is existing or staged, and if the sizing calculations show some tables are so large that the file needs to be recreated. (See Sizing an existing file.)

When you select the Recreate function, FILEMGMT creates a version of all field, record, and field group definitions and stages them for DEFINE. The steps for recreating a file are thereafter similar to the steps for creating a file described in Overview of creating files.

The Recreate function uses the same Definition screens as the CREATE function.

You can select the Size function to resize the file after you redefine the file on the Definition screens.