Saturday, November 17, 2012

File-Aid: Reformatting Records



Chapter 11. Reformatting Records

The Reformat function extends the capabilities of the Copy utility by allowing you to change the format of your file as you are copying it. You define the rules for reformatting by supplying record layouts for the file being copied and for the target file.
Typically you start with a layout which matches a data file. Then, make a copy of the layout and make changes to the new version to reflect the new format of your data file. In the new layout you reorganize the source fields by adding new fields, deleting unwanted fields, changing field sizes and/or reordering fields.
Next you create a reformat definition using the Reformat function. Then, execute the definition to read your original file and write reformatted records to your new file.
You create a reformat definition for the target file by:
  • Using optional field selection criteria to selectively copy and/or reformat records
  • Defining fields to be moved (including numeric format translations)
  • Specifying constant values for new or existing fields
After you create a reformat definition, you can execute the Reformat function online or in batch.

11.1 Accessing the Reformat Function (Option 9)

The Reformat function is located on File-AID's Primary Option Menu as option 9.
Steps:
  1. Enter a 9 in the OPTION field on the Primary Option Menu (not shown here).
  2. Press <Enter>. File-AID displays the first screen of the Reformat function as shown in Figure 11-1.

11.2 Creating a New Reformat Definition

This example illustrates the process of creating a new reformat definition.
Figure 11-1. Reformat Definition - Specify Reformat Definition Member
+-------------------------------------------------------------------------------
| File-AID ------------------------- REFORMAT DEFINITION ------------------------|
| OPTION  ===> ___                                                               |
|                                                                                |
| blank - Create a new or change an existing reformat definition                 |
|     D - Dynamically create and execute a temporary reformat definition         |
|     E - Execute a previously saved reformat definition                         |
|                                                                                |
| Specify Reformat Definition Dataset:                                           |
|   Dataset name  ===> FASAMP.RFMTDEF                                            |
|   Member name   ===> EMPNEW                                                    |
|   Volume serial ===>          (If not cataloged)                               |
|   Description   ===>                                                           |
|                                                                                |
| Specify Execution Information:                                                 |
|    Process online or batch     ===> O      (O = Online; B = Batch)             |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
| Use END command to END or ENTER to continue REFORMAT MODE                      |
|                                                                                |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Leave OPTION field blank to specify that you want to create a new reformat definition.
  2. Enter FASAMP.RFMTDEF in the Dataset name field. The attributes of this dataset are DSORG=PO,RECFM=VB,LRECL=1580,BLKSIZE=7870.
  3. Enter EMPNEW in the Member name field.
  4. Type an O in the Process online or batch field.
  5. Press <Enter>. File-AID displays the Reformat Record Layouts - Create Mode screen as shown in Figure 11-2.
More About the Reformat Definition Screen
  • If the member name you specify already exists, File-AID invokes the editor where you can make changes to your reformat definition. You cannot change record layouts in an existing member; you must create a new member in order to use different layouts or when a layout you want to use has changed.
  • You can create and execute a temporary reformat definition by specifying option D. File-AID does not save the reformat definition you create through this option unless you specifically request to save it.
  • You can execute an existing reformat definition by specifying option E. This option lets you execute a reformat definition that you previously created and saved. You bypass the editing process when you select option E.
  • Contents of your sample reformat library (FASAMP.RFMTDEF) include a member EMPLOYE2, which matches the new member EMPNEW you are defining in this example.

11.3 Identifying the Source and Target Record Layouts

The Reformat Record Layouts - Create Mode screen is displayed only when you are creating a new reformat definition. The information you enter on this screen defines the record layouts (source and target) for your new reformat definition.
Figure 11-2. Reformat Record Layouts - Create Mode. Identify Source and Target Record Layouts and Options
+-------------------------------------------------------------------------------
| File-AID ----------------------- Reformat Record Layouts --------- CREATE MODE |
| COMMAND ===>                                                                   |
|                                                                                |
| Specify Source Record Layout and XREF Information:                             |
|    Record layout usage       ===> S         (S = Single; X = XREF)             |
|    Record layout dataset     ===> FASAMP.LAYOUTS                               |
|    Member name               ===> EMPLOYEE  (Blank or pattern for member list) |
|    XREF dataset name         ===>                                              |
|    Member name               ===>           (Blank or pattern for member list) |
|                                                                                |
| Specify Target Record Layout and XREF Information:                             |
|    Record layout usage       ===> S         (S = Single; X = XREF)             |
|    Record layout dataset     ===> FASAMP.LAYOUTS                               |
|    Member name               ===> EMPLOYE2  (Blank or pattern for member list) |
|    XREF dataset name         ===>                                              |
|    Member name               ===>           (Blank or pattern for member list) |
|                                                                                |
| Move corresponding?     ===> YES        (YES or NO)                            |
|                                                                                |
| Ignore prefix           ===>                                                   |
| Ignore suffix           ===>                                                   |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Verify that the Record layout usage field in the Source information area of the screen contains a value of S.
  2. Type FASAMP.LAYOUTS in the Record layout dataset field.
  3. Type EMPLOYEE in the Member name field.
  4. Verify that the Record layout usage field in the Target information area of the screen contains a value of S.
  5. Type FASAMP.LAYOUTS in the Record layout dataset field.
  6. Type EMPLOYE2 in the Member name field.
  7. Verify YES in the Move corresponding field.
  8. Press <Enter>. File-AID displays the Reformat Definition Editor screen as shown in Figure 11-3.
More About the Reformat Record Layouts Screen
  • When you leave the OPTION field blank to create a new reformat definition, File-AID displays the information flag CREATE MODE in the top right corner of the display.
  • When you specify YES in the Move corresponding field, File-AID matches the source and target layout field names and automatically assigns field references to request data movement during the reformat. File-AID does not automatically match COBOL FILLER fields. Use the optional Ignore prefix and Ignore suffix fields when field names in the source and target layouts are similar, but have a different prefix or suffix. File-AID uses the values in these fields to match field names in this case.
  • If you use an XREF for either the source or target layout, File-AID presents a list of layout members for you to choose. If you choose a BASE layout for the source, File-AID automatically reformats only those records with the matching record type values. You must not choose a DEFAULT-BASE layout for a target. If you execute in batch, you need to add DD01XR and DD01RL statements to the batch JCL to identify the XREF member and layouts library.

11.4 Using the Reformat Definition Editor

In this example, you use the Reformat Definition Editor to define the new format of the FASAMP.EMPLOYE2 dataset. Using the editor, complete the following tasks:
  • Initialize new and existing fields with literals.
  • Define selection criteria to select only those records that meet the criteria for reformatting.
The Reformat Definition Editor screen as shown in Figure 11-3, is divided into two parts: the source record layout fields are located in the top portion of the screen and the target record layout fields are located in the bottom portion of the screen.
Figure 11-3. Reformat Definition Editor
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===>                                                  SCROLL ===> PAGE |
|                                                                                |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row    1 of   35 |
|   0 EMPLOYEE-MASTER-FILE            GRP/198                                    |
|   1  EMP-NUMBER                      AN/5                                      |
|   2  EMP-LAST-NAME                   AN/15                                     |
|   3  EMP-FIRST-NAME                  AN/10                                     |
|   4  EMP-MID-INIT                    AN/1                                      |
|   5  FILLER                          AN/2                                      |
|   6  EMP-TITLE                       AN/30                                     |
|   7  EMP-PERSONAL-INFO              GRP/23                                     |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row    1 of   36 |
|   0 EMPLOYEE-MASTER-FILE            GRP/211                                    |
|   1  EMP-NUMBER                      AN/5        /EMP-NUMBER                   |
|   2  EMP-FIRST-NAME                  AN/15       /EMP-FIRST-NAME               |
|   3  EMP-MID-INIT                    AN/1        /EMP-MID-INIT                 |
|   4  EMP-LAST-NAME                   AN/20       /EMP-LAST-NAME                |
|   5  EMP-TITLE                       AN/30       /EMP-TITLE                    |
|   6  EMP-PERSONAL-INFO              GRP/24                                     |
|   7   EMP-NATL-ID-NUMBER            NUM/9   9v00 /EMP-NATL-ID-NUMBER           |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Because we asked for Move Corresponding = Y, target fields are pre-filled with references to corresponding source layout fields by field name. For example, /EMP-NUMBER in the target field EMP-NUMBER means to move data from source field name EMP-NUMBER.
When you execute your reformat, moves are performed using the rules of COBOL. If an alphanumeric field is moved to a larger field, blanks are added on the right. If move to a shorter field, data is truncated to the length of the target field.
Scrolling
You can scroll the data in both the source and target windows of the editor independently or at the same time.
The location of the cursor determines which window(s) is scrolled. If the cursor is located within the source layout fields, then only the upper window is scrolled. The lower window only scrolls when the cursor is located in the lower window fields. If the cursor is on the command line, both windows scroll.
The Existing (Source) Record Layout (Upper Window)
The source window displays information about the source record layout. It is in this window that you specify the field selection criteria to use to select specific records to be reformatted.
The New (Target) Record Layout (Lower Window)
Use the target window fields to specify which source fields to use as a source of data. Optionally, you can specify a constant for a target field to initialize new fields or to mask sensitive data during the reformat.
Field references are specified in the Data Area to the right of each target field, by entering a slash (/) followed by the field name or number. Constants are specified by entering a string of decimal digits for numeric fields or a quoted string for alphanumeric fields.
Notice that on entry to the Reformat Editor, the target fields already contain field references (for example, /EMP-NUMBER, /EMP-FIRST-NAME, etc.). These references are automatically generated when you specify a value of YES in the Move corresponding field.
Commands EX, SAVE, CANCEL, END
Use the following commands from the Reformat Definition Editor:
SAVE Saves the reformat definition member in the reformat dataset.
EX Saves the reformat definition and displays either the online or batch Execute Reformat screen.
END Saves the reformat definition and redisplays the Reformat Definition screen.
CANCEL Terminates the reformat definition session without saving any changes you made to the reformat definition.
Scrolling Both Windows
When the cursor is positioned in the command line and you specify a scrolling command or press a scrolling PF key (for example: PF8=DOWN, PF7=UP), File-AID scrolls both windows in the reformat definition editor.
Figure 11-4. Reformat Editor - DOWN command. Scrolling Both Windows.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FA                       |
| COMMAND ===> DOWN                                                              |
|                                                                                |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.                       |
| Num Field Name                     Format  Pic   OP Data                       |
|   0 EMPLOYEE-MASTER-FILE            GRP/198                                    |
+-------------------------------------------------------------------------------

Steps:
  1. Position the cursor in the command line (HOME).
  2. Press the PF key for DOWN (PF8), or
    Type the command DOWN in the COMMAND field and press <Enter>.
Result of Scrolling DOWN Both Windows.
Figure 11-5. Reformat Definition Editor. Establishing Constants in the Target Layout.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===> DOWN                                             SCROLL ===> PAGE |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row    9 of   35 |
|   8   EMP-NATL-ID-NUMBER            NUM/9   9v00                               |
|   9   FILLER                         AN/1                                      |
|  10   EMP-DATE-OF-BIRTH              AN/6                                      |
|  11   EMP-DOB-REDEF                 GRP/6                                      |
|         Redefines EMP-DATE-OF-BIRTH                                            |
|  12    EMP-DOB-MM                   NUM/2   2v00                               |
|  13    EMP-DOB-DD                   NUM/2   2v00                               |
|  14    EMP-DOB-YY                   NUM/2   2v00                               |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row    9 of   36 |
|   8   EMP-NEW-BIRTH-DATE            GRP/7                                      |
|   9    EMP-DOB-CENTURY               AN/1        '1'                           |
|  10    EMP-BIRTH-DATE               GRP/6                                      |
|  11     EMP-DOB-YY                  NUM/2   2v00 /14                           |
|  12     EMP-DOB-MM                  NUM/2   2v00 /12                           |
|  13     EMP-DOB-DD                  NUM/2   2v00 /13                           |
|  14   EMP-NEW-HIRE-DATE             GRP/7                                      |
|  15    EMP-HD-CENTURY                AN/1        '1'                           |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

11.5 Entering Constants

After the DOWN scroll, both layouts are scrolled to show the BIRTH-DATE field (see Figure 11-5). Notice how the target layout re- arranges the date from MMDDYY format to YYMMDD format and inserts a new EMP-DOB-CENTURY field.
You assign a constant value of '1' (meaning 19xx) to the new century fields for birth date and hire date.
Steps:
  1. Type '1' in EMP-DOB-CENTURY target field Data area. You must surround an alphanumeric field constant with single quotes.
  2. Type /14 in EMP-DOB-YY target field Data area. /14 references the EMP-DOB-YY source field.
  3. Type /12 in EMP-DOB-MM target field Data area.
  4. Type /13 in EMP-DOB-DD target field Data area.
  5. Type '1' in EMP-HD-CENTURY target field Data area.
  6. Position the cursor in the command line.
  7. Press the PF key for DOWN (PF8), or
    Type the command DOWN in the COMMAND field and press <Enter>.
Resetting Existing Values to a Constant
You may specify a new constant value for any target field. Just type over the field reference with a constant.
In this example, you assign values to the new fields EMP-PAY-GRADE and EMP-NEW-401K-WITHOLD-AMT and also assign a new constant value of 28.5 to the EMP-NATL-TAX-WITHOLD-PCT field.
Figure 11-6. Reformat Definition Editor. Resetting Existing Values to a Constant Value.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===> DOWN                                             SCROLL ===> PAGE |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row   16 of   35 |
|  15   EMP-HIRE-DATE                  AN/6                                      |
|  16   EMP-MARITAL-STATUS             AN/1                                      |
|  17  EMP-PERSONAL-INFO              GRP/15                                     |
|  18   EMP-LIFE-INS-WITHOLD-AMT     NUMS/6   4v02                               |
|  19   EMP-NATL-TAX-WITHOLD-PCT       PS/3   3v02                               |
|  20   EMP-REGION-TAX-WITHOLD-PCT     PS/3   3v02                               |
|  21   EMP-LOCAL-TAX-WITHOLD-PCT      PS/3   3v02                               |
|  22  EMP-HOME-ADDRESS               GRP/50                                     |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row   17 of   36 |
|  16    EMP-HIRE-DATE                 AN/6        /15                           |
|  17   EMP-MARITAL-STATUS             AN/1        /EMP-MARITAL-STATUS           |
|  18  EMP-PERSONAL-INFO              GRP/20                                     |
|  19   EMP-PAY-GRADE                  AN/3        PAY                           |
|  20   EMP-LIFE-INS-WITHOLD-AMT       PS/5   7v02 /EMP-LIFE-INS-WITHOLD-AMT     |
|  21   EMP-NATL-TAX-WITHOLD-PCT       PS/3   3v02 28.5                          |
|  22   EMP-NEW-401K-WITHOLD-AMT       PS/3   3v02 0                             |
|  23   EMP-REGION-TAX-WITHOLD-PCT     PS/3   3v02 /20                           |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Type /15 in EMP-HIRE-DATE target field Data area. /15 references the EMP-HIRE-DATE source field.
  2. Type PAY in the EMP-PAY-GRADE target field Data area.
  3. Type 28.5 in the EMP-NATL-TAX-WITHOLD-PCT target field Data area. Numeric field constants are entered as one or more decimal digits (with optional decimal points or signs) and are not quoted.
  4. Type 0 in the EMP-NEW-401K-WITHOLD-AMT target field Data area. Numeric fields are automatically initialized to zero if no constant value or field reference is specified. Alphanumeric fields are initialized to blanks.
  5. Position the cursor in the command line.
  6. Press the PF key for DOWN (PF8), or
    Type the command DOWN in the COMMAND field and press <Enter>.

11.6 Initializing New Fields

This example illustrates the process of initializing a new field. The zip code needs to be expanded from a five to a nine digit field. You assign a constant "0000" for the new EMP-ZIP-CODE-PLUS-4 field.
Figure 11-7. Reformat Definition Editor. Initializing New Fields.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===> DOWN                                             SCROLL ===> PAGE |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row   24 of   35 |
|  23   EMP-STREET-ADDRESS             AN/25                                     |
|  24   FILLER                         AN/1                                      |
|  25   EMP-CITY                       AN/15                                     |
|  26   EMP-STATE-PROV-CNTY           GRP/4                                      |
|  27    EMP-STATE                     AN/2                                      |
|  28    FILLER                        AN/2                                      |
|  29   EMP-POSTAL-CODE               NUM/5   5v00                               |
|  30  EMP-EMERGENCY-CONTACT          GRP/47                                     |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row   25 of   36 |
|  24   EMP-LOCAL-TAX-WITHOLD-PCT      PS/3   3v02 /EMP-LOCAL-TAX-WITHOLD-PCT    |
|  25  EMP-HOME-ADDRESS               GRP/51                                     |
|  26   EMP-STREET-ADDRESS             AN/25       /EMP-STREET-ADDRESS           |
|  27   EMP-CITY                       AN/15       /EMP-CITY                     |
|  28   EMP-STATE                      AN/2        /27                           |
|  29   EMP-NINE-DIGIT-ZIP            GRP/9                                      |
|  30    EMP-POSTAL-CODE              NUM/5   5v00 /29                           |
|  31    EMP-ZIP-CODE-PLUS-4           AN/4        '0000'                        |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Type /27 in EMP-STATE target field Data area. /27 references the EMP-STATE source field.
  2. Type /29 in EMP-POSTAL-CODE target field Data area.
  3. Type '0000' in the EMP-ZIP-CODE-PLUS-4 target field Data area.
  4. Position the cursor in the command line.
  5. Press the PF key for DOWN (PF8), or
    Type the command DOWN in the COMMAND field and press <Enter>.

11.7 Hiding Sensitive Data On Output

Sometimes when copying a file to create test data from production files, there may be sensitive information you want to hide in the target file.
In this example, you assign a generic value to the phone number fields. You also scroll both windows to the top of their layouts using the UP MAX command.
Figure 11-8. Reformat Definition Editor. Changing Sensitive Data to Generic Data.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===> UP MAX                                           SCROLL ===> PAGE |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row   32 of   35 |
|  31   EMP-CONTACT-NAME               AN/25                                     |
|  32   FILLER                         AN/2                                      |
|  33   EMP-CON-WORK-PHONE             AN/10                                     |
|  34   EMP-CON-HOME-PHONE             AN/10                                     |
| ******************************* BOTTOM OF DATA ******************************* |
|                                                                                |
|                                                                                |
|                                                                                |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row   33 of   36 |
|  32  EMP-EMERGENCY-CONTACT          GRP/45                                     |
|  33   EMP-CONTACT-NAME               AN/25       /EMP-CONTACT-NAME             |
|  34   EMP-CON-WORK-PHONE             AN/10       '8105551212'                  |
|  35   EMP-CON-HOME-PHONE             AN/10       '8105551212'                  |
| ******************************* BOTTOM OF DATA ******************************* |
|                                                                                |
|                                                                                |
|                                                                                |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Type '8105551212' in the EMP-CON-WORK-PHONE and the EMP-CON-HOME-PHONE target field Data areas.
  2. Position the cursor in the COMMAND field.
  3. Type the command UP MAX and press <Enter>.

11.8 Establishing Selection Criteria

In the upper (Source) window you may specify selection criteria by entering values in the OP and Data fields at the right side of one or more field names.
Only records matching your selection condition are considered for reformatting. During execution you have an option to include or exclude non-selected records in the output file.
To complete your reformat definition you:
  1. Set up a selection condition to reformat only those records with an EMP-NUMBER greater than or equal to spaces.
  2. Place generic number 999,999,999 in the EMP-NATL-ID-NUMBER field; and
  3. Request execution of your reformat with the EX command.
Figure 11-9. Reformat Definition Editor. Specifying Selection Criteria and Requesting Execution.
+-------------------------------------------------------------------------------
| File-AID ---- REFORMAT Definition Editor - DS:USERID9.FASAMP.RFMTDEF(EMPNEW) - |
| COMMAND ===> EX                                               SCROLL ===> PAGE |
| Source COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYEE) -----|
| Num Field Name                     Format  Pic   OP Data      Row    1 of   35 |
|   0 EMPLOYEE-MASTER-FILE            GRP/198                                    |
|   1  EMP-NUMBER                      AN/5        GE '     '                    |
|   2  EMP-LAST-NAME                   AN/15                                     |
|   3  EMP-FIRST-NAME                  AN/10                                     |
|   4  EMP-MID-INIT                    AN/1                                      |
|   5  FILLER                          AN/2                                      |
|   6  EMP-TITLE                       AN/30                                     |
|   7  EMP-PERSONAL-INFO              GRP/23                                     |
| Target COBOL - EMPLOYEE-MASTER-FILE ---- USERID9.FASAMP.LAYOUTS(EMPLOYE2) -----|
| Num Field Name                     Format  Pic   Data         Row    1 of   36 |
|   0 EMPLOYEE-MASTER-FILE            GRP/211                                    |
|   1  EMP-NUMBER                      AN/5        /EMP-NUMBER                   |
|   2  EMP-FIRST-NAME                  AN/15       /EMP-FIRST-NAME               |
|   3  EMP-MID-INIT                    AN/1        /EMP-MID-INIT                 |
|   4  EMP-LAST-NAME                   AN/20       /EMP-LAST-NAME                |
|   5  EMP-TITLE                       AN/30       /EMP-TITLE                    |
|   6  EMP-PERSONAL-INFO              GRP/24                                     |
|   7   EMP-NATL-ID-NUMBER            NUM/9   9v00 999999999                     |
| Use END Command to Save then End, CANCEL to Cancel, or EX to Execute Reformat  |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Type GE in the OP column to the right of the EMP-NUMBER field.
  2. Type ' ' (quote five spaces quote) in the Data column to the right of the GE in the EMP-NUMBER field. If you specify another field test, the two conditions are ANDed; both must be valid before the record is selected for reformatting.
  3. Overtype reference/8 with the value 999999999 (nine 9s) in the data area to the right of the target EMP-NATL-ID-NUMBER field to provide a generic value on the output file.
  4. Type EX in the COMMAND field. Press <Enter>.
More About Selection Criteria
  • If you had used an XREF to define the source layout, record type fields are automatically set and locked by File-AID. Only records of the chosen record type are reformatted.
  • You may choose to run your reformat in batch. If you do so you may include a DD01SC (Selection criteria) DD to identify a saved selection criteria definition you created with the Selection Criteria function (option 6).
  • At execution time, you have an option to copy all records or only those records matching your selection criteria. Reformatting is only applied to records matching any selection criteria.

11.9 Executing the Reformat Online at Your Terminal

When you request execution, your current reformat definition member is saved in your reformat dataset. The message, DEFINITION SAVED, is displayed at the top right corner of the display.
Figure 11-10. Reformat Execution Screen
+-------------------------------------------------------------------------------
| File-AID --------------  Reformat Execution - Online  ------- DEFINITION SAVED |
| OPTION  ===>                                                                   |
|                                                                                |
| Display file after reformat ===> N  (N=No, B=File-AID Browse, E=File-AID Edit) |
|                                                                                |
| Specify Input Dataset:                                                         |
|   Dataset name   ===>                                                          |
|   Member name    ===>                                                          |
|   Volume serial  ===>                   (If not cataloged)                     |
|   Disposition    ===> SHR               (OLD or SHR)                           |
|                                                                                |
|                                                                                |
| Specify Output Dataset:                                                        |
|   Dataset name   ===>                                                          |
|   Member name    ===>                                                          |
|   Volume serial  ===>                   (If not cataloged)                     |
|   Disposition    ===> OLD               (OLD, SHR or MOD)                      |
|                                                                                |
| Copy unselected records      ===>       (Y = Yes, N = No, drop unselected)     |
| Number of records to process ===> 0     (1-9999, 0 = all)                      |
|                                                                                |
| Use END command to END or ENTER to continue REFORMAT MODE                      |
|                                                                                |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Viewing Results Immediately
The Display file after reformat field lets you choose to browse or edit the output file after the reformat has been performed. If you select B (Browse) or E (Edit), File-AID invokes a browse or edit session on the output file. This lets you review and verify your definition.
Controlling Copying of Unselected Records
You can further tailor the reformat process with the "Copy unselected records" and "Number of records to process" fields. The "Copy unselected records" field enables you to specify whether or not you want to copy records that did not match the selection criteria from the input to the output file. If you choose to copy the records that do not match the selection criteria, those records are copied without any changes or reformatting.
Limiting the Total Records Copied
The "Number of records to process" field enables you to control the final size of the dataset. This is usually used to test your reformat definition by limiting processing to a small number of records so that the results are available very quickly.
Specifying the Input and Output Datasets
On the Reformat Execution screen (Figure 11-11), you identify the actual input and output datasets that are to participate in the reformat process.
The Input Dataset contains the records to be read, selected, and reformatted.
The Output Dataset contains the results of the reformat.
Note: If the Output Dataset is fixed length (RECFM=F or FB), the record length (LRECL) must exactly match the size of the target record layout. Target field number 0 (zero) (see Figure 11-9) contains the size of the layout in the Format area (for example, GRP/211 - means length 211).
Figure 11-11. Reformat Execution Screen. Identifying Datasets.
+-------------------------------------------------------------------------------
| File-AID --------------  Reformat Execution - Online  ------- DEFINITION SAVED |
| OPTION  ===>                                                                   |
|                                                                                |
| Display file after reformat ===> B  (N=No, B=File-AID Browse, E=File-AID Edit) |
|                                                                                |
| Specify Input Dataset:                                                         |
|   Dataset name   ===> FASAMP.EMPLOYEE                                          |
|   Member name    ===>                                                          |
|   Volume serial  ===>                   (If not cataloged)                     |
|   Disposition    ===> SHR               (OLD or SHR)                           |
|                                                                                |
|                                                                                |
| Specify Output Dataset:                                                        |
|   Dataset name   ===> FASAMP.EMPLOYE2                                          |
|   Member name    ===>                                                          |
|   Volume serial  ===>                   (If not cataloged)                     |
|   Disposition    ===> OLD               (OLD, SHR or MOD)                      |
|                                                                                |
| Copy unselected records      ===> Y     (Y = Yes, N = No, drop unselected)     |
| Number of records to process ===> 0     (1-9999, 0 = all)                      |
|                                                                                |
| Use END command to END or ENTER to continue REFORMAT MODE                      |
|                                                                                |
|                                                                                |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. Type a B in the Display file after reformat field.
  2. Enter FASAMP.EMPLOYEE in the input Dataset name field.
  3. Enter FASAMP.EMPLOYE2 in the output Dataset name field.
  4. Type a Y in the Copy unselected records field.
  5. Ensure that there is a 0 (zero) in the "Number of records to process" field. The value 0 tells File-AID to copy all records.
  6. Press <Enter>. File-AID executes the Reformat function and displays the dataset in Browse mode as illustrated in Figure 11-12.

11.10 Browsing the Reformatted File

Note that File-AID indicates that the reformatting process is complete with the message, FILE REFORMATTED, at the top right corner of the display as shown in Figure 11-12.
File-AID displays the reformatted file in formatted Browse mode. Refer to Chapter 2. "Browsing a Data File" to review which commands you can use to navigate through a dataset in the Browse function.
Use the DOWN and UP scroll commands to examine the reformat results.
When you are done with your review, return to the File-AID Primary Option Menu now.
Figure 11-12. Browsing the Reformatted File
+-------------------------------------------------------------------------------
| File-AID - Browse - USERID9.FASAMP.EMPLOYE2 ----------------- FILE REFORMATTED |
| COMMAND ===> END                                              SCROLL ===> PAGE |
| RECORD:     1                EMPLOYEE-MASTER-FILE                LENGTH:   211 |
| ---- FIELD NUMBER/NAME ------ -FORMAT- ----+---1----+---2----+---3----+---4|
| 1 EMP-NUMBER                    5/AN   00090                                   |
| 2 EMP-FIRST-NAME               15/AN   EDWARD                                  |
| 3 EMP-MID-INIT                  1/AN   M                                       |
| 4 EMP-LAST-NAME                20/AN   MARTIN                                  |
| 5 EMP-TITLE                    30/AN   AIRPLANE MANUFACTURER                   |
|   7 EMP-NATL-ID-NUMBER          9/NUM  999999999                               |
|     9 EMP-DOB-CENTURY           1/AN   1                                       |
|       11 EMP-DOB-YY             2/NUM  54                                      |
|       12 EMP-DOB-MM             2/NUM  10                                      |
|       13 EMP-DOB-DD             2/NUM  19                                      |
|     15 EMP-HD-CENTURY           1/AN   1                                       |
|     16 EMP-HIRE-DATE            6/AN   920101                                  |
|   17 EMP-MARITAL-STATUS         1/AN   M                                       |
|   19 EMP-PAY-GRADE              3/AN   PAY                                     |
|   20 EMP-LIFE-INS-WITHOLD-AMT   5/PS   -3000.00                                |
|   21 EMP-NATL-TAX-WITHOLD-PCT   3/PS   28.50                                   |
|   22 EMP-NEW-401K-WITHOLD-AMT   3/PS   0                                       |
|   23 EMP-REGION-TAX-WITHOLD-PCT                                                |
|                                 3/PS   25.00                                   |
|   24 EMP-LOCAL-TAX-WITHOLD-PCT                                                 |
|                                                                                |
+-------------------------------------------------------------------------------

Steps:
  1. If necessary, use the FMT command to view the data in Formatted Mode.
  2. Type DOWN in the COMMAND field.
  3. Press <Enter>.
  4. Type RIGHT in the COMMAND field.
  5. Press <Enter>.
  6. Press PF3 (END) several times until the File-AID Primary Option Menu is displayed.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.