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
 

 

Content of variable before moving or initializing

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

New User


Joined: 13 May 2011
Posts: 29
Location: India

PostPosted: Fri Feb 10, 2012 9:52 am    Post subject: Content of variable before moving or initializing
Reply with quote

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
View user's profile Send private message

kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Fri Feb 10, 2012 10:15 am    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1714
Location: UK

PostPosted: Fri Feb 10, 2012 12:08 pm    Post subject:
Reply with quote

You could also read the manuals or any primer on programming languages.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Feb 10, 2012 1:09 pm    Post subject: Reply to: Content of variable before moving or initializing
Reply with quote

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
View user's profile Send private message
hemu88

New User


Joined: 13 May 2011
Posts: 29
Location: India

PostPosted: Fri Feb 10, 2012 3:27 pm    Post subject: Reply to: Content of variable before moving or initializing
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1714
Location: UK

PostPosted: Fri Feb 10, 2012 3:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Feb 10, 2012 3:52 pm    Post subject: Reply to: Content of variable before moving or initializing
Reply with quote

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
View user's profile Send private message
hemu88

New User


Joined: 13 May 2011
Posts: 29
Location: India

PostPosted: Fri Feb 10, 2012 4:25 pm    Post subject: Reply to: Content of variable before moving or initializing
Reply with quote

Now I got answer. it may be some junk values also.. need not be zero.. thank you Nic.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Fri Feb 10, 2012 5:45 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hemu88

New User


Joined: 13 May 2011
Posts: 29
Location: India

PostPosted: Fri Feb 10, 2012 6:19 pm    Post subject: Reply to: Content of variable before moving or initializing
Reply with quote

Thanks for reply Robert.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Fri Feb 10, 2012 6:37 pm    Post subject:
Reply with quote

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
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 Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
This topic is locked: you cannot edit posts or make replies. Get and display content of an address... lind sh CICS 1 Mon Aug 08, 2016 9:18 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts Moving character data to smallint in db2 rikdeb DB2 5 Thu Jul 14, 2016 12:38 am


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