Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract a part of string from a variable

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

New User


Joined: 27 Jun 2008
Posts: 3
Location: chennai

PostPosted: Wed Aug 17, 2011 5:00 pm    Post subject: Extract a part of string from a variable
Reply with quote

Hi,

I had a requirements as below

$25,000 to $100,000 in $25,000 increments

I need to extract the $25,000 value before increments in the above text. I know i have to move this value to an array n search for the 3rd $ and take the next numeric value.
But is there any sub-routine or any function like inspect etc which extracts the values based on the $ and i can use it in short.

Thanks in advance for the advice...
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Wed Aug 17, 2011 5:13 pm    Post subject:
Reply with quote

Your "explanation" is as clear as mud. "$25,000 to $100,000 in $25,000 increments" is not a requirement -- it's not even a specification, but merely part of a specification. Increment how -- in a loop? Is the variable numeric or numeric edited or alphanumeric or what? What "3rd $" are you going to search for? What are you storing in the array (which is called a TABLE in COBOL, by the way)? Is there a key to search on? And the questions go on and on and on ...

Start all over. Post a clear and concise statement of what you want to accomplish, what you have done so far, and what is not working for you. Have a coworker or friend read your statement BEFORE you post it. If that person does not understand what you are writing without your saying a word, rewrite it until they do understand -- because we won't have anything but what you write to go by.

Based upon the garbage you've posted so far, INSPECT or FUNCTION NUMVAL could be possible solutions, but who knows for sure since you've not described anything remotely like an issue you are trying to solve.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Wed Aug 17, 2011 5:18 pm    Post subject: Reply to: Extract a part of string from a variable
Reply with quote

ok a bit of translation ...

the ts has a string which looks like
Quote:
$25,000 to $100,000 in $25,000 increments

and my understanding is that he wants to extract the bolded stuff !
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Wed Aug 17, 2011 5:32 pm    Post subject: Reply to: Extract a part of string from a variable
Reply with quote

h4hemanth wrote:
But is there any sub-routine or any function like inspect etc which extracts the values based on the $ and i can use it in short.
Shorter than using one UNSTRING and one FUNCTION NUMVAL-C ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Aug 17, 2011 11:24 pm    Post subject: Re: Extract a part of string from a variable
Reply with quote

h4hemanth wrote:
[...]
$25,000 to $100,000 in $25,000 increments

I need to extract the $25,000 value before increments in the above text. I know i have to move this value to an array n search for the 3rd $ and take the next numeric value.
[...]


UNSTRING delimited by space into six fields would get you want you want in the 5th field.

The trickiest thing was understanding what you wanted. Thanks enrico.
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 Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us