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

String concatenation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harunnisa

New User


Joined: 27 Aug 2008
Posts: 8
Location: Chennai

PostPosted: Fri Mar 26, 2010 5:37 pm
Reply with quote

I have i/p in the following format:

MCCLANEY, DARNELLA J
TROMBLEY, ANGELA S.
KETTY SMIT

I want o/p should be:

DARNELLA J MCCLANEY
ANGELA S TROMBLEY
SMITT KETTY

can anyone help on this issue?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Mar 26, 2010 5:41 pm
Reply with quote

This is a HELP forum, not a DO-YOUR-CODE-FOR-YOU forum. What have you done so far and what is not working about it?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Mar 26, 2010 5:49 pm
Reply with quote

What's the logic behind the extra 'T' in the sample,
Quote:
KETTY SMIT
Quote:
SMITT KETTY
icon_razz.gif icon_razz.gif
Back to top
View user's profile Send private message
Ranjithkumar

New User


Joined: 10 Sep 2008
Posts: 93
Location: India

PostPosted: Fri Mar 26, 2010 6:03 pm
Reply with quote

@harunnisa:

1. Replace all balnks by ',' using INSPECT.
2. UNSTRING the value into three variables (L-NAME,F-NAME,M-NAME) delimitted by ','.
3. Use the variables to STRING as per your requirement.

It will work only if the order in input is L-NAME,F-NAME M-NAME and L-NAME and F-NAME should not be blank.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 26, 2010 9:26 pm
Reply with quote

Hello,

Quote:
It will work only if the order in input is L-NAME,F-NAME M-NAME and L-NAME and F-NAME should not be blank.
You have made a "rule" that conflicts with the sample "input" shown. . .

When posting a "solution", it needs to meet the requirement, not just something similar. . .

This is like having your mechanic tell you "I couldn't fix your brakes so i made your horn louder" - compliments of our Admin icon_smile.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 26, 2010 9:48 pm
Reply with quote

Quote:
MCCLANEY, DARNELLA J
TROMBLEY, ANGELA S.
KETTY SMIT

Ignoring the lack of the extra 'T' and the missing ',' in the last name as just typos, unstring delimited by the comma into last-name and first-middle-name and then string them back together.....
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri Mar 26, 2010 9:57 pm
Reply with quote

Standardized entry of names in a fixed order with commas, and periods is often promised by designers and user representatives but seldom delivered in reality.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Mar 26, 2010 10:00 pm
Reply with quote

CICS Guy wrote:
Quote:
MCCLANEY, DARNELLA J
TROMBLEY, ANGELA S.
KETTY SMIT

Ignoring the lack of the extra 'T' and the missing ',' in the last name as just typos, unstring delimited by the comma into last-name and first-middle-name and then string them back together.....
Since the owner has not replied to any of our queries i think all we can do is guess... icon_biggrin.gif

Basically i think that the three samples provided are three differnet ways the input might come. One with ',' after LAST NAME, another with a '.' in the last of the input, the third with no ',' or '.'. ... icon_razz.gif icon_razz.gif
Back to top
View user's profile Send private message
A_programmers

New User


Joined: 24 Mar 2010
Posts: 19
Location: USA

PostPosted: Thu Apr 08, 2010 3:44 pm
Reply with quote

1) Convert all commas to spaces.
2) Extract first word using unstring delimited by space.
3) Append at the end of remaining string.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Apr 08, 2010 5:09 pm
Reply with quote

A_programmers wrote:
1) Convert all commas to spaces.
2) Extract first word using unstring delimited by space.
3) Append at the end of remaining string.


What about people with a multi-part first, middle, or last name?
Or people with no middle name?
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top