DB2 File Aid – A Step By Step Manual for Beginners

88
DB2 File Aid – A Step By Step Manual for Beginners Target readers All. Keywords Mainframe, DB2 File AID.

Transcript of DB2 File Aid – A Step By Step Manual for Beginners

Page 1: DB2 File Aid – A Step By Step Manual for Beginners

DB2 File Aid – A Step By Step Manual for Beginners

Target readers

All.

Keywords

Mainframe, DB2 File AID.

 

Page 2: DB2 File Aid – A Step By Step Manual for Beginners

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:

Page 3: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

Page 4: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 5: DB2 File Aid – A Step By Step Manual for Beginners

Option2: Type R.FD in the Command Prompt and press enter.

Page 6: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 7: DB2 File Aid – A Step By Step Manual for Beginners

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:

Page 8: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 9: DB2 File Aid – A Step By Step Manual for Beginners

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”.

Page 10: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 11: DB2 File Aid – A Step By Step Manual for Beginners

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”

Page 12: DB2 File Aid – A Step By Step Manual for Beginners

Result:In this screen you can give the selection criteria just like ProEdit.

Page 13: DB2 File Aid – A Step By Step Manual for Beginners

Option2: Using SPUFI directly

Give “S” in “Specify Option”

Page 14: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Here you can specify Data Set Name where you write the SQL query for selection

Page 15: DB2 File Aid – A Step By Step Manual for Beginners

Common Error:

Page 16: DB2 File Aid – A Step By Step Manual for Beginners

Playing With the Other Options:

There are many options in this screen which are highlighted below

Page 17: DB2 File Aid – A Step By Step Manual for Beginners

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”.

Page 18: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 19: DB2 File Aid – A Step By Step Manual for Beginners

Option3: Column Selection “YES” and Column Name Matching “NO”/”N”.

Page 20: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 21: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 22: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 23: DB2 File Aid – A Step By Step Manual for Beginners

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”.

Page 24: DB2 File Aid – A Step By Step Manual for Beginners

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

Page 25: DB2 File Aid – A Step By Step Manual for Beginners

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”

Page 26: DB2 File Aid – A Step By Step Manual for Beginners

Step2BB:

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

Page 27: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 28: DB2 File Aid – A Step By Step Manual for Beginners

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 Columns.

Max Number of rows 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.

Page 29: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 30: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 31: DB2 File Aid – A Step By Step Manual for Beginners

Option1: Initial Display Mode: 2Step1:It is similar to normal “FILE AID” FMT mode.

Page 32: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

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

Page 33: DB2 File Aid – A Step By Step Manual for Beginners

Results:

Page 34: DB2 File Aid – A Step By Step Manual for Beginners

Using DB2 File Aid EDIT

Step1:

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

Page 35: DB2 File Aid – A Step By Step Manual for Beginners

Step2A:

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

Page 36: DB2 File Aid – A Step By Step Manual for Beginners

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”

Page 37: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 38: DB2 File Aid – A Step By Step Manual for Beginners

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)

Page 39: DB2 File Aid – A Step By Step Manual for Beginners

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 Columns.

Max Number of rows 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.

Page 40: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 41: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 42: DB2 File Aid – A Step By Step Manual for Beginners

Option1: Initial Display Mode: 2Step1:

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

Page 43: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

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

Page 44: DB2 File Aid – A Step By Step Manual for Beginners

Results:

Page 45: DB2 File Aid – A Step By Step Manual for Beginners

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:

Page 46: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

Page 47: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 48: DB2 File Aid – A Step By Step Manual for Beginners

Step4:

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

Page 49: DB2 File Aid – A Step By Step Manual for Beginners

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.

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”.

Page 50: DB2 File Aid – A Step By Step Manual for Beginners

After providing the required fields press “ENTER” and you will get the following screen.

Page 51: DB2 File Aid – A Step By Step Manual for Beginners

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”

Page 52: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 53: DB2 File Aid – A Step By Step Manual for Beginners

Loading Tables Using DB2 File Aid

Page 54: DB2 File Aid – A Step By Step Manual for Beginners

Step1:

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

Page 55: DB2 File Aid – A Step By Step Manual for Beginners

Result Screen:

Page 56: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 57: DB2 File Aid – A Step By Step Manual for Beginners

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”.

Page 58: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 59: DB2 File Aid – A Step By Step Manual for Beginners

Step4:

Press “ENTER” when you reach this screen

Page 60: DB2 File Aid – A Step By Step Manual for Beginners

Result1:

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

Page 61: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 62: DB2 File Aid – A Step By Step Manual for Beginners

Result3:

The following is the screen shot taken from the table after the data is loaded to the table.

Page 63: DB2 File Aid – A Step By Step Manual for Beginners

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 by2. Loading the destination table using the same Data Set.

Page 64: DB2 File Aid – A Step By Step Manual for Beginners

Step1:

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

Page 65: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

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

Page 66: DB2 File Aid – A Step By Step Manual for Beginners

Step2:

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

Page 67: DB2 File Aid – A Step By Step Manual for Beginners

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”.

Page 68: DB2 File Aid – A Step By Step Manual for Beginners

Step4:

Press “ENTER” in the following screen

Page 69: DB2 File Aid – A Step By Step Manual for Beginners

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)”.

Page 70: DB2 File Aid – A Step By Step Manual for Beginners

Step6:

Press “ENTER”.

Page 71: DB2 File Aid – A Step By Step Manual for Beginners

Result1:

Loading will start now.

Page 72: DB2 File Aid – A Step By Step Manual for Beginners

Result2:

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

Page 73: DB2 File Aid – A Step By Step Manual for Beginners

Result3:

Page 74: DB2 File Aid – A Step By Step Manual for Beginners

SQL Command Manager

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

Page 75: DB2 File Aid – A Step By Step Manual for Beginners
Page 76: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 77: DB2 File Aid – A Step By Step Manual for Beginners

In this screen we have given the object name (table name) and the object creator and selected “Table” as object type. Press “Enter”.

Page 78: DB2 File Aid – A Step By Step Manual for Beginners

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.

Page 79: DB2 File Aid – A Step By Step Manual for Beginners

DDL of the table:

For checking the DDL for the table give GD in the command prompt and press “Enter”

Page 80: DB2 File Aid – A Step By Step Manual for Beginners

This is how the table was created.

Page 81: DB2 File Aid – A Step By Step Manual for Beginners

Table Information

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

Page 82: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 83: DB2 File Aid – A Step By Step Manual for Beginners

Column Information

Select column information and press “Enter”.

Page 84: DB2 File Aid – A Step By Step Manual for Beginners

Result:

Page 85: DB2 File Aid – A Step By Step Manual for Beginners

Index Information

Select Index Information and press “Enter”

Page 86: DB2 File Aid – A Step By Step Manual for Beginners

Select Index key information.

Page 87: DB2 File Aid – A Step By Step Manual for Beginners

This screen shows the primary key on the table.

Page 88: DB2 File Aid – A Step By Step Manual for Beginners

References

None