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
 

 

Cobol String Strip between the spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 2:18 pm    Post subject: Cobol String Strip between the spaces
Reply with quote

Hi Guys,

My requirment is

Address Line1: 'AAAAAAA______________40'
Address Line2: 'BBBBBBB 60'

Where '_' - Spaces

I want to concatenate the Address line 1 & Address line 2 and the desired output should be

Output Concatenated
'AAAAAAA 40 BBBBBBB 60'

Note:- One space should be inserted in between the words in the resultant of concatenated line.

I have referred prior topics, but i couldnt solve my problem, thats why im posting it again.....

Tip me if you have any idea regarding this.

Thanks,
xavier
Back to top
View user's profile Send private message

xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 2:49 pm    Post subject: detailed requirment
Reply with quote

Possible scenarios

Code:
Address Line1

AAAAAAA AAA AAAA            40

AAAAAAA                            40
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 15, 2010 3:05 pm    Post subject:
Reply with quote

You need small logic and piece of code for it.
But what have you tried till now? where are you stuck?
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 3:09 pm    Post subject:
Reply with quote

Hello sambhaji,

I have tried this string statement,

Code:
STRING WS-ADDR-LINE1 DELIMITED BY SIZE   
       X'404040'     DELIMITED BY ' '     
       X'4040'       DELIMITED BY ' '     
  ' '  WS-ADDR-LINE2 DELIMITED BY SIZE   
  INTO WS-ADDR-CONCAT3   


Output has come like,

Code:
AAAAAAAAAAA               40 BBBBBBB 60


Now i want to remove the in-between spaces and should be look like
Code:

AAAAAAAAAAA 40 BBBBBBBB 60
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Mon Feb 15, 2010 3:42 pm    Post subject:
Reply with quote

@xavierrajnaveen

Morning Sir !

Just think of a useful combination of UNSTRING and STRING command
Read about all parameters of Unstring command.

Btw, where comes this "60" from?
In your scenario above, there are only two "40".
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 3:47 pm    Post subject:
Reply with quote

Thanks for your information sire Umeysan!!!!

Well, abt 60....is that matters you deviatiang my question if it is , it is just a mistake thats all.

Never mind that......
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 15, 2010 3:48 pm    Post subject:
Reply with quote

Hi,
check the solution from this post
http://www.ibmmainframes.com/viewtopic.php?t=35459&highlight=vintemp
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 4:15 pm    Post subject:
Reply with quote

Sambhaji,

Thank you very much for your timely help [icon_smile.gif] it has solved my problem, one more favour sambhaji if could pls explain the working logic of pointers which you have given will help me a lot.

Thanks again sambaji for ur kind help....... icon_smile.gificon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 15, 2010 5:07 pm    Post subject:
Reply with quote

Quote:
one more favour sambhaji if could pls explain the working logic of pointers which you have given will help me a lot.
I would suggest you to spend some time to read manuals.
Joining data items (STRING)
Splitting data items (UNSTRING)
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 15, 2010 5:17 pm    Post subject:
Reply with quote

Sure man.......icon_smile.gif

Thanks,

Regards,
Xavier Rodriquez
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm


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