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

Data Extraction in COBOL


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

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Tue May 05, 2009 10:14 am
Reply with quote

Hi,

I need one help,i am retrieving data from one table ,the data is available in the table in below format

0-1000
1000-2000
2000-3000
4000+
less than 5000

the logic here is if it is 0-1000,then i have to move 1000 to working storage variable,if its 1000-2000 then i have to move
2000 to the working storage variable ,like this and if it is 4000+ then i have to move 4000 to the working storage variable
if it is less than 5000 then i have to move 5000 to Ws variable



I can use a UNSTRING command with "+" or "-"(hypen) condition to filter ,but one prblem here is "less than condition"

I cannot use REXX ,the logic should be implemented in COBOL only,could you please help me in this regards

REgards
Karthik
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue May 05, 2009 10:29 am
Reply with quote

Karthick,
First find for
Code:
less than
using reference modification. If its not present go for UNSTRING. simple IF ELSE should do.
Back to top
View user's profile Send private message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Tue May 05, 2009 10:38 am
Reply with quote

Hi Hari,

I can find this using reference modification,but problem here is table will have data in different language like English,spanish,so all these scenarios needs to be handled

Regards
Karthik
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: Tue May 05, 2009 12:03 pm
Reply with quote

Hello,

Quote:
table will have data in different language like English,spanish,so all these scenarios needs to be handled
Suggest a separate bit of code for each language to be supported.
Back to top
View user's profile Send private message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Tue May 05, 2009 3:48 pm
Reply with quote

Hi,

I have data in this format 1000-2000 and "less than 1000"

i have to get 2000 in scenario of 1000-2000

i have to get 1000 in scenario of "less than 1000"

Please let me know how can i handle ths in Array

Regards
Karthik
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 05, 2009 4:49 pm
Reply with quote

n.karthikeyan,

a little more info is necessary:
layout of data
layout of COBOL Internal Table (array)

Quote:
i have to get 1000 in scenario of "less than 1000"

are you sure about this? <1000 is -infinity to +999 last i heard.
Back to top
View user's profile Send private message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Tue May 05, 2009 5:12 pm
Reply with quote

Hi,

The data is available like this in the table

1000-2000
2000-3000
3000+
less than 3000

can i retrieve the data for ex if it is 1000-2000,only 2000 i have to move to WS varaiable
if its 3000+ i have to move 3000 to WS variable
if it is less than 3000,i have to move only 3000 to WS variable

Regards
Kartik
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: Tue May 05, 2009 6:53 pm
Reply with quote

I'm still stumped, what you want is clear to you, but it makes no sense to me.
What sort of table?
What sort of retrieve?
Please explain further.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue May 05, 2009 10:30 pm
Reply with quote

Posting examples of your input and desired output would help us understand your requirement. And please use VBCode where appropriate.
Back to top
View user's profile Send private message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Wed May 06, 2009 11:24 am
Reply with quote

Hi,

Thanks for your replies,my requirement is like this

I want to get the upper limit for a mileage and store it in working storage variables
table is having datas like this

1000-2000
2000-3000
3000-4000
lessthan 7000
7000+

for first one i have to separate and get 2000,second one i have to separate and 3000,third one i have to separate 4000 and 5th one i have to separate 7000,last one also 7000

am not going to use any JCL since its AS400 cobol,i have to implement the logic in COBOL itself
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: Wed May 06, 2009 1:49 pm
Reply with quote

Hello,

What have you written so far? Where are you stuck?

Suggest you post "this" field as well as a few others from some sample input and show what output from this sample input should be. The "output" could be an array in the program.

In your code, parse each input value and determine the low and high value for that input. If this input is a range definition, you also need to check for overlap.

If this process is still being developed, i'd suggest that the input entries be only the "high" value. When used for determining which range to use the "low" value would be zero (for the first entry) or the previous high value. This also eliminates the need to do range-checking on the input.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top