Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Loading flat file into DB2 using load utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Thu Feb 21, 2008 5:27 am    Post subject: Loading flat file into DB2 using load utility
Reply with quote

Hi,

I will try to explain this as best as I can...

I have a flat file, which has dates in packed format (CYYMMDD) among other fields, and I would like to load this file into my DB2 table. I would like to be able to convert the 'DATE' on the fly to DB2's DATE format (MMDDYYYY) while doing the loading. Is this possible?

My second question is, is there anyway to specify that for the whole flat file, if there is a field that is all X'FF' then it should be treated as NULL inside DB2?

Hopefully, it is not confusing...

Thanks,
Nirav
Back to top
View user's profile Send private message

jainrahul

New User


Joined: 21 Feb 2008
Posts: 1
Location: bangalore

PostPosted: Thu Feb 21, 2008 5:16 pm    Post subject:
Reply with quote

hi,
You can do this by the help of some changes in the LOAD card
use the DATE EXTERNAL as an attribute for that particular coloum like

LOAD DATA
INTO <table>
( <col 1> <position()> <type>,
.........................
<col n> <position()> DATE EXTERNAL)
this will tell DB2 that the particular coloumn contains the DATE and DB2 will store it in the required format.


For your second question use NULLIF() = ' ' with the column attribute like <col> <position> <type> NULLIF ( ) = ' '

since 4F is actually blank. DB2 will take the input as NULL in the case when IF condition is true.

Thanks,
- rahul
Back to top
View user's profile Send private message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Thu Feb 21, 2008 6:01 pm    Post subject: Reply to: Loading flat file into DB2 using load utility
Reply with quote

Hi, thanks for the suggestion.

I am little confused. How would DB2 recognize CYYMMDD needs to be converted to MMDDCCYY? I mean, will it correctly convert 3080221 to 02212008? In my shop, 3 means 20 and 2 means 19...

Also, do I need to specify every column that need not be converted as well as the date columns?

-----

As for NULLIF, when you say 4F did you actually mean X'FF' ? Sorry, I have never seen 4F before...

Appreciate the help!
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Feb 21, 2008 6:10 pm    Post subject:
Reply with quote

1. DB2 will not convert CYYMMDD to an acceptable format you will have to handle that before hand.

2. Niether x'FF' nor x'4F' is a blank, you would have to use a hex compare NULLIF((1:1) = X'FF')
Back to top
View user's profile Send private message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Thu Feb 21, 2008 6:46 pm    Post subject: Reply to: Loading flat file into DB2 using load utility
Reply with quote

Oh okay, thanks. I was afraid to hear that answer!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts DB2 - TERMINATE utility vasanthz DB2 5 Mon May 15, 2017 11:49 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us