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

Manipulating string in a table


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

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Fri Nov 17, 2006 3:22 pm
Reply with quote

hi,

In a table, one field is declared string, which contains more than one space between two words, eg,

ABC DEF FEGLH

the requirement is to remove all the spaces between the words and insert only a single space like this ....

ABC DEF FEGLH

I want a query or Stored Procedure, as its a table.........

In program we can do this by breaking the strings, but not getting how to do this in a query or Stored Proc

Please answer this ASAP

thanks,
Kiran.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 17, 2006 5:13 pm
Reply with quote

there is no difference between
Quote:
ABC DEF FEGLH

and
Quote:
ABC DEF FEGLH


you should use the UB code - code /code to show examples.

Code:
ABC   DEF   FEGLH

and

Code:
ABC DEF FEGLH


if that is what you mean.
Back to top
View user's profile Send private message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Fri Nov 17, 2006 6:56 pm
Reply with quote

yes this is what i mean...

now, some one help me out in handling this requirement.

thanks,
Kiran.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 17, 2006 9:27 pm
Reply with quote

I will assume that english is not your native tongue, thus the very rude usage of ASAP and 'now, someone do my work for me'.

how are you determining that the COLUMN
(fields are in records and working-storage definitions, DB2 Rows do not have fields)
contains more than one space between non-space characters?

This appears to be a 'repair the data' function and suggest that you do it programatically as apposed to SQL.

Though someone could probably generate the necessary sql to determine if the column requires 'repair' and then 'repair' the column, this kind of SQL would require a lot of resources. Would not advise a mass-update. Since you would/should use a cursor, that would mean your data is in the program, so repair it with the programming language you are using.

Before you 'repair' the data, suggest you modify the original INSERT logic to assure that this does not occur, then 'repair' your data.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon Nov 20, 2006 12:34 pm
Reply with quote

what's the meaning of Warnings : 1? how many warnings or different types of warning exists? does it mean a user is banned?....
Back to top
View user's profile Send private message
PascalQ

New User


Joined: 12 May 2006
Posts: 20

PostPosted: Mon Nov 20, 2006 3:59 pm
Reply with quote

acevedo wrote:
what's the meaning of Warnings : 1? how many warnings or different types of warning exists? does it mean a user is banned?....


as the mod said, read the rules icon_lol.gif

they say you're not banned with just 1 warning.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon Nov 20, 2006 4:55 pm
Reply with quote

fwiw:

Edit or Remove
The moderating, support and other teams reserve the right to edit or remove any post at any time. The determination of what is construed as indecent, vulgar, spam, etc. as noted in these points is up to Team Members and not users

Warning
Users abusing these rules will be given One(1) warning only. If the offence is repeated, they will face a possible ban. If you received one or more warning then you are not eligible to participate in the 'MEMBER OF THE MONTH' Contest.

Ban
Users will be warned a maximum of three times for any and all offences in a three month period. If the need arises for a fourth warning a temporary ban will be put in place of between 1 to 3 days. Arguing with team members after having received a warning will lead to an immediate additional warning. Should this exceed three strikes a temporary ban will be put in place as above.

Termination
OUR GOAL IS NOT POPULATION, BUT PERFECTION. So we have the rights to terminate the membership without any notice, if the user is not active for a long period.
Back to top
View user's profile Send private message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Tue Nov 21, 2006 10:57 am
Reply with quote

Hi dbzTHEdinosauer,

Yes, English is not my native language.

But I sincerely apologize if my wordings spelt rude which i never intended.

Thanks,
Kiran.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top