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

Given a Value, Search which variable has the value -


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

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Tue Jul 20, 2010 1:30 pm
Reply with quote

Hi All,

I have been given a problem.

The Problem is, I have a value, and from that value i have to find which variable is having that value.

for example, I have been given a number 134454, and now I am being asked to find out the variable which has that value.

As of now, I am doing hit and trial, but it is very timeconsuming. So just wanted to know, is there any option by which we can trace it.

Please note, we don't have xpeditor, so maximum I can do is, give displays, and then search for value.

Regards,
Tushar
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 Jul 20, 2010 2:47 pm
Reply with quote

saurabh39 wrote:
So just wanted to know, is there any option by which we can trace it.
Yea, sorta, but it depends on what you are looking at.....
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jul 20, 2010 5:55 pm
Reply with quote

it's not clear what do you want to do? You have posted in Mainframe COBOL part of the Forum but you this statement
Quote:
have been given a number 134454, and now I am being asked to find out the variable which has that value.
makes me think as if you are talking about ISPF 3.14 option kind of stuff, are you?
Back to top
View user's profile Send private message
saurabh39
Warnings : 1

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Tue Jul 20, 2010 7:04 pm
Reply with quote

@Anuj - Let me make more clear.........

In my application, we calculate premium and it comes out to be some value say 134454, now business is saying the value is incorrect and it should be something else. But the tables from which the data is arrived is correct. So the problem is happening in my application.

One way to find, from where the value is coming is by giving displays, and displaying all the numric value, but this is a tedious task, so I want to know, is there any way by which I can know, which variable is having the said value, and then by knowing the variable, I can know, where the wrong computation is happening.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jul 20, 2010 7:16 pm
Reply with quote

oh, the way I'm understad it is -
    1. it looks like you've some program which read some input file, picks up some values to caluculate the "premium" number.
    2. Your program do some calculation/manipulation on the data it reads.
    3. There is a COBOL-program-variable "which has the value to searched for", during the execution time.
    4. You want to know, from which cobol-variable you get that value?
Back to top
View user's profile Send private message
saurabh39
Warnings : 1

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Tue Jul 20, 2010 8:55 pm
Reply with quote

Yes Anuj, you understanding is correct.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jul 20, 2010 9:32 pm
Reply with quote

Quote:
You want to know, from which cobol-variable you get that value?


normally, one looks at the logic of the program, and determines which variable provides the value.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Jul 20, 2010 9:37 pm
Reply with quote

    1. Well, use xpeditor and "keep" the variable you want to look for.
    2. put the Displays.
    3. Check for logic.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jul 20, 2010 10:01 pm
Reply with quote

or if you don't have expeditor,
determine where the value comes from - desk checking, following the logic
run you test,
having displays based on an IF statement comparing the variable to the 'bad' value,
that also display the pertinent fields used in the calculation,
so that you can find your logic error.

the displays and the IF statement can be debug lines (d in col 7)
and use the Source computer clause WITH DEBUGGING MODE
to allow you to move the module to production
with only changing the SOURCE COMPUTER clause.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Jul 20, 2010 10:14 pm
Reply with quote

Unless you have some form of run-time analyzer such as Xpediter, be aware that what you are wanting can be a very complex, time-consuming and expensive task -- especially since you seem to have no idea which variable(s) you need to monitor. There is no easy way to do this other than painstaking desk checking or many DISPLAY statements.
Back to top
View user's profile Send private message
saurabh39
Warnings : 1

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Wed Jul 21, 2010 2:49 pm
Reply with quote

I was able to find out the culprit, by using displays...but as robert said, its quite complex nd time consuming. Thats why, I thought of asking the problem....and to see if there is any better way.

@Anuj - From Xpeditor, we can find the value of a variable, but finding a varbiale, which has certain value(as in my case)...i guess we cannot do it from xpeditor. Moreover, Xpeditor is not activated at my site, so could not try also.

I guess, for my problem, there is no staright solution, but to do the tedious task of anylyzing the program, giving displays of the variable, which I think may be culprit, and then keep on executing until and unless I nail it.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Wed Jul 21, 2010 7:40 pm
Reply with quote

Glad to hear that you got it working.

Quote:
@Anuj - From Xpeditor, we can find the value of a variable, but finding a varbiale, which has certain value(as in my case)...i guess we cannot do it from xpeditor. Moreover, Xpeditor is not activated at my site, so could not try also.
It's like saying - egg came first or hen? However, in this case we are lucky to know that what data "program can read" and what is the expected output. But to understand, what is happening, under the covers, with the values in "programs' intermediate-varaibles" is programmers responsibilty - but if you have not written the program then ofcourse it needs a little amount of work from you. And for suh work, it's usually, (not always because if you've written the program sometime you can tell that) a road from "variable to value" and not vice-versa. So yes, xpeditor can't do that.
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 REXX/CMS How to place command console... CLIST & REXX 4
No new posts CA7 count with DATE variable CA Products 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Search two or more word with FILEAID Compuware & Other Tools 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top