IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Expand a field while unloading a table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pradip kumar Mohanty

New User


Joined: 16 Sep 2007
Posts: 33
Location: India

PostPosted: Sun Aug 24, 2008 4:40 am
Reply with quote

Hi,

Is there any built-in function available to expand a field on the fly while unloading.

Essentially what I need is :
Table-A in Database-A, has one of its filed defined as CUST_AMT DECIMAL(5, 0) NOT NULL.
The same Table-A in Database-B has the same filed defined as CUST_AMT DECIMAL(9, 4) NOT NULL.

I need to load the Table-A in Database-B with Table-A-Database-A's data.

ex: CUST_AMT value in one of the records of Table-A is 12345 it shd be expanded/reformated to 12345.0000 to the unload dataset so that it can fit into the corresponding filed in Table-B.

I wish any DB2 function that I can use with the unload query to accompolish this.


Any help?

Best Regards
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Sun Aug 24, 2008 7:52 am
Reply with quote

Have you tried CAST?
Back to top
View user's profile Send private message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Mon Aug 25, 2008 4:27 am
Reply with quote

Hi,

There could be DB2 solutions available. But what I can think of is as follows:
1) Unload Database A table.
2) Convert Decimal(5,0) field to Decimal(9,4) (you can use DFSORT utility to achieve this, by writing a control card like TO=PD,LENGTH=7). Your output dataset will have a record length 4 more than the input one.
3) Use the output of Step2 to load Database B table.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top