View previous topic :: View next topic
|
Author |
Message |
hemu88
New User
Joined: 13 May 2011 Posts: 29 Location: India
|
|
|
|
I have a varible defined as below.
05 WS-EMP-SALARY PIC S9(13)V9(02) COMP-3.
What value will be there in this variable before initializing or moving any value to this?
If I move Zero to this variable and check for Numeric as below, what will be the outcome? T or F
IF WS-EMP-SALARY NUMERIC
Thanks |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Why don't you write a simple program and check it yourself. You can always post your findings to help others with same set of questions. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You could also read the manuals or any primer on programming languages. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The questions are so basic, or so odd, there must be something else behind them. Why don't you tell us what the problem is, not your far-fetched analysis of it. |
|
Back to top |
|
|
hemu88
New User
Joined: 13 May 2011 Posts: 29 Location: India
|
|
|
|
I have tried this. just declared variable is having zeros only. I just wanted to cofirm if it is always true.
for second question, yes its numeric.. I tested
thanks |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Unless you actually do something with your variable the storage it occupies will remain as it was before your program started - in general but some environments may pre-initialise storage but I do not know which (if any). |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Look in the manuals.
If you define storage without an initial value, you'd be a fool to rely on its content before putting something else into it.
For this one, I don't care how often you test it. Read the manual. Believe it.
For your particular set-up you may get predictable results. Since this is in conflict with the manual and you don't know how that comes about, I don't suggest you rely on it even at your site. You may also get what look like predicatble results but turns out to be coincidence.
If you even think of relying on the value of unitialised storage I will have to get a thesaurus out, look up fool, include all those in a piece of text and add what assorted colloquialisms I can come up with as welll |
|
Back to top |
|
|
hemu88
New User
Joined: 13 May 2011 Posts: 29 Location: India
|
|
|
|
Now I got answer. it may be some junk values also.. need not be zero.. thank you Nic. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The answer to your question can only be provided by someone working at your site. There are options, for example, that can be set to initialize memory to zeroes (LOW-VALUES in COBOL terms) or any other desired value -- but these options are site-dependent and no one on this forum could possibly tell you how your site is configured. |
|
Back to top |
|
|
hemu88
New User
Joined: 13 May 2011 Posts: 29 Location: India
|
|
|
|
Thanks for reply Robert. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Not only site-dependent, but are subject to change over time. What works today, may not work tomorrow, even at the same site. |
|
Back to top |
|
|
|