Вы находитесь на странице: 1из 88

DB2 File Aid – A Step By Step Manual for Beginners

Target readers

All.

Keywords

Mainframe, DB2 File AID.


Introduction

This document demonstrates how use DB2 File Aid. This document describes how to use
the functionalities available in DB2 File Aid with simple step by step screen shots.

How to go to Db2 file Aid

Option1:
Step1:
Step2:
Result:
Option2:
Type R.FD in the Command Prompt and press enter.
Result:
How to Copy Rows from One Table to another Table:

This is very useful in Production Support while loading the Adhoc data
into the testing region.
During Integration testing for loading System testing data into Unit test
region, DB2 File Aid can be used.
(Remember Db2 File AID is not a replacement of the BMCUnLoad and
BMCload utility.)

Step1:
Result:
Step2A: For Copying all the records from one table to another table

Note: The source table and the destination table in this case should
have the same structure other wise the copy will be unsuccessful.
Give the Qualifier and Table Name in “From Table” and “To Table” fields.
Keep the “Specify Option” blank and press “ENTER”.
Result:
Step2b: Copying All the rows which matches some criteria (using
where clause while selecting)

Option1: Using ProEdit like user-friendly options.


Give “T” in “Specify Option”
Result:
In this screen you can give the selection criteria just like ProEdit.
Option2: Using SPUFI directly

Give “S” in “Specify Option”


Result:

Here you can specify Data Set Name where you write the SQL query for
selection
Common Error:
Playing With the Other Options:

There are many options in this screen which are highlighted below
Option1: Max Rows to Select:

You can specify how many records to copy from the Source Table to the
Destination table.

Option2: Column Selection “YES” and Column Name Matching


“Yes”/”Y’.

Change “Column Selection” option to “YES” and “Column Name


Matching” option to “Y” press “ENTER”.
Result:
It matches the column names between two tables. It maps the columns
which are of same name and different tables. The mapping can be
changed here if required.
You can check the SQL query generated by typing “SQL” in the
“Command Prompt”.
After the mapping is done press “F6” to execute.
Option3: Column Selection “YES” and Column Name Matching
“NO”/”N”.
Result:
It allows to do the mapping manually. In this screen the columns can be
copied Column wise also. Some columns can be removed if it is not
used.
Common Error:
Here we are trying to map a Decimal field to a character field.
It will display message that the fields are not compatible.
Option4: Delete Existing Rows

If there is any row common between the tables (for which the key
fields are same) this option can be set to “YES”.
If it is set to “YES” then the row in the destination table will be deleted
and the new row will be copied from the source table.
Using DB2 File Aid BROWSE

How to go into tables in Browse Mode:

Step1:
In “Db2 File Aid Main Screen”, type “1” in the “Command Prompt” and
press “Enter”.
Step2A:
For viewing all the records in the table press “ENTER”.
Step2BA:
View only the rows which meet certain criteria, A Data Set can be used
in the same way like SPUFI. Give the Data Set name where you have
the Selection Criteria and press “Enter”
Step2BB:

Press “F6” or type “EXEC” in the command prompt for execution.


Result:
Other Options:

Look at the other options in screen given in Step2BB. The below screen
shot elaborates how to use these options. Press F6 to execute.

Selection of Max Number of rows


Columns. that will be selected

“Where”
condition

Sorting Order
.Ascending/ Descending

Sort Keys. Here it means that first it will be


sorted on the column where 1 is given then it
will be sorted on the second column.
Result:
Playing with Options:

Option1: Initial Display Mode: 1

If Initial Display Mode is 1 then it will show multiple rows in the same
page. It is same as VFMT mode of normal “FILE AID”. The previous 3
screen shots were taken keeping Initial Display Mode 1. Please refer
those for checking how the result will look like.
Option1: Initial Display Mode: 2
Step1:
It is similar to normal “FILE AID” FMT mode.
Step2:

Press “F6” or type “EXEC” in the command prompt to execute.


Results:
Using DB2 File Aid EDIT

Step1:

In “DB2 File Aid Main Screen”, type “2” in the “Command Prompt” and
press “ENTER”.
Step2A:

For viewing all the records in the table press “ENTER”.


Step2BA:

View only the rows which meet certain criteria, A Data Set can be used
in the same way like SPUFI. Give the Data Set name where you have
the Selection Criteria and press “ENTER”
Step2BB:

In this screen you can select some columns by giving “S” in front of the
column name. By Default, all the columns will be displayed. You can
also give the Maximum Number of Rows to be displayed. After
selecting the columns press “F6” or type “EXEC” in the command
prompt for execution.
Result:

Notice one interesting thing in the result. The DB2 FILE AID will not
allow you to edit the Primary Key Fields. This is how DB2 FILE AID
ensures the integrity of the data. The fields which are editable will
come in green (if default color is not changed manually)
Other Options:

Look at the other options in screen given in Step2BB. The below screen
shot elaborates how to use these options. Press F6 to execute.

Max Number of rows


Selection of
that will be selected
Columns.

“Where”
condition

Sorting Order
.Ascending/ Descending

Sort Keys. Here it means that first it will be


sorted on the column where 1 is given then it
will be sorted on the second column.
Result:
Playing with Options:

Option1: Initial Display Mode: 1

If Initial Display Mode is 1 then it will show multiple rows in the same
page. It is same as VFMT mode of normal “FILE AID”. The previous 3
screen shots were taken keeping Initial Display Mode 1. Please refer
those for checking how the result will look like.
Option1: Initial Display Mode: 2
Step1:

It is similar to normal “FILE AID” FMT mode.


Step2:

Press “F6” or type “EXEC” in the command prompt to execute


Results:
Extracting and Loading Tables

Using DB2 file AID we can easily achieve many purposes which we
generally do using BMCUnLoad and BMCLoad Tools.

Extracting Tables Using DB2 File Aid

Step1:
Step2:
Step3:

Give the Qualifiers and Table Name in the below screen and press
“ENTER”.
Note: You can take the Unload on some select criteria also by giving
the Criteria Data Set name in this screen.
Note: The Unload can be taken n 2 ways.
1. Online and
2. Batch.
We are following the Online path in the below demonstration. The
Batch Process follows almost the same process.
Step4:

In the following screen, type “EXEC” in the command prompt or hit F6


to execute.
Step5:

This is the most interesting screen in the flow.

Extract Data Set:

Here you can give the Data Set where you want to extract the Unload
of the table.

Control Card Data Set:

You will get the control card for the table in this data set.
People who have used BMC Unload tool might be knowing that, in case
of BMCUnload we get this in the SPOOL.
For loading one t able from some source table, we take the Unload
from the source table first. From spool of the Unload job, we take the
control card and use the control card in BMC Load tool to load the
destination table.

In contrary, here we can take the Unload not only easily, but also at
the same time create one dataset containing only the control card
alone which can directly be used in Load jobs.

A Sample Control
Card for a table

Layout file:

This is the place from where the exact layout of the db2 table is
created with all the NULL indicators. Note: This layout is not the
DCLGEN of the table. The difference is the NULL indicators which are
not present in DCLGEN.
This Layout file once created can easily be used for creating a file
which can easily be used to load some data into the destination table
via BMC Load tool.
The following is a sample DCLGEN and a sample Table Layout created
using DB2 File AID to clarify the difference. If a NULLable field is
holding NULL value then the NULL indicator of that field should be set
to “-1”. Otherwise it should be set to “0”.

DCLGEN of a Layout of the same


Table.txt table.txt
After providing the required fields press “ENTER” and you will get the
following screen.
Step6:

For Batch you will a temporary JCL which contains all the criteria you
have given till now. You have to add the job card and submit the job.

For Online you will get the following screen.


Press “Enter”
Result:
Loading Tables Using DB2 File Aid
Step1:

Press “ENTER” in the following screen. Note: We are using SQL Inset
Statements as shown in the screen shot.
Result Screen:
Step2:

I had already taken the dump of the source table from some other
region. So I had the file and the control card using which I am going to
load the destination table.
Prior to running the load job the destination table had no records as
shown in the following screen shot. This is a screen shot taken from
ProEdit.
We are now coming back to Db2 File Aid Load table from Data Set
option, the same place where we left.
Give the Data Set from which the table will be loaded in “Load Data
Set”. Note this was created while taking the Unload of the table.
Give the Control Card name which was created while unloading.

Press “ENTER”.
Step3:

In the following screen we are following online processing mode. And


the option “Add New Data to Empty table” as the destination table was
empty in my case empty. The other options also can be used
depending on the requirement.
Step4:

Press “ENTER” when you reach this screen


Result1:

It will now show the summary report of the load job. Press ENTER once
in this screen.
Result2:

Now it will show the complete summary of this Load. You can save this
if you require it. Come out of the screen pressing F3.
Result3:

The following is the screen shot taken from the table after the data is
loaded to the table.
Extracting and Loading Table at the same time using DB2 File
Aid:

This is actually nothing but combination of the 2 things which are


described earlier.
1. Unload a source table into a Data Set, followed by
2. Loading the destination table using the same Data Set.
Step1:

This is very much similar to Copying rows from one table to another.
Press “ENTER”
Step2:

Press “ENTER” in the following screen. If you want then you can give
the criteria data set here
Step2:

Type “EXEC” in the command prompt or press F6 in the following


screen to execute
Step3:
This is the similar screen which we got while taking the unload from
the table to a data set.
Enter the Extract Data Set, Control Card Data Set and Layout file. Press
“ENTER”.
Step4:

Press “ENTER” in the following screen


Step5:

This screen shows how many rows were extracted and ask for the
other parameters. This is similar to the screen which we got while
loading a Table from a Data Set. Note in this case we have selected
“Add (Replace Duplicate Keys)”.
Step6:

Press “ENTER”.
Result1:

Loading will start now.


Result2:

After the load is complete the Load Summary Report screen will be
displayed. Press Enter to view it in expanded mode.
Result3:
SQL Command Manager

This is the most familiar SPUFI. I think there is nothing new to say
about this.
Object List Processing

The option 3.4: Object list processing has many interesting options. It helps us get all the
information about the tables (table space, primary keys, Index, alternate indices etc). Here
we will have brief overview of these options.
In this screen we have given the object name (table name) and the object creator and
selected “Table” as object type. Press “Enter”.
In this screen we have various options like
Editing the table,
Browsing the table,
Altering,
Dropping,
Granting and Revoking access on the table,
Loading or extracting the table,
Checking and modifying the privileges,
Get many information on the table like column info, index info etc.
We shall touch DDL, Column Information and Index Information in the next part.
DDL of the table:

For checking the DDL for the table give GD in the command prompt and press “Enter”
This is how the table was created.
Table Information

For information on the table, type ‘I’ in the command prompt and press “Enter”
Result:
Column Information

Select column information and press “Enter”.


Result:
Index Information

Select Index Information and press “Enter”


Select Index key information.
This screen shows the primary key on the table.
References

None

Вам также может понравиться