Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us