Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reg: Fetch first name and LAst name from continuous stream

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Thu Jul 01, 2010 4:11 pm    Post subject: Reg: Fetch first name and LAst name from continuous stream
Reply with quote

Hi,

I have a table with a column (COLUMN1) declared as VARCHAR. this field is having some data which has the first name<space>last name<spaces>email as a continuous stream.This is the format which is there. Also there is no specific length for firstname and second name and email, it can vary. Consider ,

As -IS
Code:

FNAME1 LNAME1 helli@email.com1
Firstname lastname helli@email.com2
Firstname Lname helli@email.com3
FName LastName helli@email.com4


where I need to extrcat the record till second till the second space. is this possible

To be
Code:

FNAME1 LNAME1
Firstname lastname
Firstname Lname
FName LastName


This To be should be returned through a mainframe Query, Can any one please advice.I need to extract the records until the second space is encountered.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 01, 2010 4:33 pm    Post subject:
Reply with quote

well, you could use the following scalar functions on every row:

select substr(var_char_col,1,locate(' ',var_char_col,posstr(var_char_col,' ') + 1)
(above is untested - give me a while and I will test it),

which I would do if I owned IBM stock and wanted my company to buy more iron,

but, if I was trying to do this in an economic fashion for my company,
I would select the complete var_char_col and use the COBOL UNSTRING to find the names and discard the email-address.
Back to top
View user's profile Send private message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Thu Jul 01, 2010 5:00 pm    Post subject:
Reply with quote

Thank you...Will try it from my end too..
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 Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts in-stream data set (inline data set) ... Andi1982 JCL & VSAM 4 Thu Jul 07, 2016 2:59 pm
No new posts JCL to fetch schedule status from act... parasmalik20 CA Products 1 Thu Jun 02, 2016 7:11 pm
No new posts ABEND due to FETCH FAILED jackzhang75 ABENDS & Debugging 17 Thu Mar 10, 2016 3:08 am
No new posts Sort Query to fetch particular records RahulG31 DFSORT/ICETOOL 13 Fri Mar 04, 2016 8:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us