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
 
Expand a field while unloading a table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Expand a field while unloading a table
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    Post subject:
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    Post subject:
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    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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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