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
 

 

Given a Value, Search which variable has the value -

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Given a Value, Search which variable has the value -
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: 2150
Location: At my coffee table

PostPosted: Tue Jul 20, 2010 2:47 pm    Post subject: Re: Given a Value, Search which variable has the value -
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

Senior Member


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

PostPosted: Tue Jul 20, 2010 5:55 pm    Post subject:
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    Post subject: Reply to: Given a Value, Search which variable has the value
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

Senior Member


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

PostPosted: Tue Jul 20, 2010 7:16 pm    Post subject:
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    Post subject: Reply to: Given a Value, Search which variable has the value
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    Post subject:
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

Senior Member


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

PostPosted: Tue Jul 20, 2010 9:37 pm    Post subject:
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    Post subject:
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: 7912
Location: Bellevue, IA

PostPosted: Tue Jul 20, 2010 10:14 pm    Post subject:
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    Post subject: Reply to: Given a Value, Search which variable has the value
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

Senior Member


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

PostPosted: Wed Jul 21, 2010 7:40 pm    Post subject:
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    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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am
No new posts Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm


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