MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Formatting character

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
cobcurious
Beginner


Joined: 04 Oct 2003
Posts: 68
Topics: 25

PostPosted: Thu Apr 26, 2007 12:14 pm    Post subject: Formatting character Reply with quote

Hi,
I am using DB2, LOAD utlity. While loading the data, I want to replace character "/" in date field with a "." How can I do this ?


Thanks in advance
Cobcurious
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 26, 2007 12:25 pm    Post subject: Reply with quote

cobcurious,

1. Code a FIELDPROC on the column
2. Run the load file thru an utility and replace the character

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cobcurious
Beginner


Joined: 04 Oct 2003
Posts: 68
Topics: 25

PostPosted: Thu Apr 26, 2007 12:29 pm    Post subject: Reply with quote

Can you please tell how to use FIELDPROC here ???

LOAD DATA
INDDN (SYSREC)
LOG NO
REPLACE
COPYDDN(SYSCP101)
INTO TABLE NMK.TAB (
RLTNSHP_STRT_DTE POSITION( 113: 122)
DATE EXTERNAL( 10),

RLTNSHP_END_DTE POSITION( 123: 132)
DATE EXTERNAL( 10) )
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 26, 2007 1:01 pm    Post subject: Reply with quote

cobcurious,

Fieldproc is something that you define at the time of creating/ALTERING the DB2 table.

Search for FIELDPROC in this link for a better understanding

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/5.36?DT=20010718164132

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Thu Apr 26, 2007 2:40 pm    Post subject: Reply with quote

kolusu,

I am a little fuzzy on this but won't a fieldproc decode the value back when there is a select or an unload.

cobcurious,

Do you need the "/" permanently changed to "," ?

Regards,
Manas
_________________
There is no path to peace. Peace is the path.
- Mahatma Gandhi (1869-1948)
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Fri Apr 27, 2007 1:09 pm    Post subject: Reply with quote

you can using DFSORT process the record before LOAD
try INREC/OUTREC OVERLAYY
Back to top
View user's profile Send private message
cobcurious
Beginner


Joined: 04 Oct 2003
Posts: 68
Topics: 25

PostPosted: Tue May 01, 2007 12:19 pm    Post subject: Reply with quote

Hi,

Thanks to Kolusu and videlord for your time.

Videlord,
There is no doubt DFSORT would have been one of the best alternative to use but due to some time restrictions I was not keen on using it. Anyways,I would request you to please let me know how can we use it in this scenario.


Kolusu,
Since in my project, we don't have access to create database tables, FIELDPROC can't be used. I would appreciate if you can please suggest any other trick of getting around this problem.

Thanks again
Cobcurious
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue May 01, 2007 12:36 pm    Post subject: Reply with quote

Quote:

Kolusu,
Since in my project, we don't have access to create database tables, FIELDPROC can't be used. I would appreciate if you can please suggest any other trick of getting around this problem.


Load the data as is and run an update statement as shown below

Code:

UPDATE Table                                 
   SET DATE_col = REPLACE(ID_DATE,'/','.')
;                                         



Check this link for a detailed explanation of REPLACE scalar function

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.66?SHELF=&DT=20010718164132&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cobcurious
Beginner


Joined: 04 Oct 2003
Posts: 68
Topics: 25

PostPosted: Tue May 08, 2007 1:38 pm    Post subject: Reply with quote

Hi Kolusu,

I have n't tried the above idea. The problem was solved by the data sender to correct the format in which the data was being sent.

I will definitely try using the scalar function.

Thanks very much for your time.

Thanks
Cobcurious
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group