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
 

 

What is the value of an uninitialized alphanumeric variable?

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

New User


Joined: 23 Nov 2006
Posts: 3
Location: India

PostPosted: Thu Nov 23, 2006 12:55 pm    Post subject: What is the value of an uninitialized alphanumeric variable?
Reply with quote

Is it possible to predict the value of an uninitialized alphanumeric variable's value?

IF TABLE-SW = 'N'
THEN
NEXT SENTENCE
ELSE
PERFORM 100-INITIALIZE THRU 100-EXIT.

Here TABLE-SW is not initialized anywhere.
How is the value predicted?

Thanks a lot!!
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Nov 23, 2006 1:03 pm    Post subject:
Reply with quote

Hi sanaathana,

We cant predict the value of a variable if it is not initialized & does not have any value clause.
Back to top
View user's profile Send private message
sanaathana

New User


Joined: 23 Nov 2006
Posts: 3
Location: India

PostPosted: Thu Nov 23, 2006 1:47 pm    Post subject:
Reply with quote

Isn't there any fill value clause or something equivalent during compilation time?

Does this mean that the programmer of the above piece of code expected the random/junk value present in the uninitialised variable to not be 'N'?
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Thu Nov 23, 2006 2:26 pm    Post subject: Re: What is the value of an uninitialized alphanumeric varia
Reply with quote

Hi,

I think when alphanumeric field is not intialized then it will take "LOW VALUES".
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Nov 23, 2006 2:51 pm    Post subject:
Reply with quote

Hi Surya,

I dont thk so?
Back to top
View user's profile Send private message
sanaathana

New User


Joined: 23 Nov 2006
Posts: 3
Location: India

PostPosted: Thu Nov 23, 2006 3:26 pm    Post subject:
Reply with quote

Ekta, I think uninitialized alphanumeric variables will have low-values. Noticed this -uninitialised AN vars having low-values- in 2 cases . There might be some catch to this though.

I'll try to confirm this.

Thanks Ekta and Surya!
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 23, 2006 10:22 pm    Post subject:
Reply with quote

The following was stated from IBM's E COBOL reference manual in the link below:
Quote:
In the working-storage section, the VALUE clause can be used in condition-name entries, or in specifying the initial value of any data item. The data item assumes the specified value at the beginning of program execution. If the initial value is not explicitly specified, it is unpredictable.

From personal experience, in MOST cases it is LOW-VALS, but I wouldn't bet the farm on it.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGY3LR10/5.3.17?SHELF=&DT=20020920180651&CASE=
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Nov 23, 2006 11:03 pm    Post subject:
Reply with quote

In the (really) old days, all programmers pre-initialized working storage.....
Later there were releases of COBOL that insured clear low value working storage and most newer programmers knew that they could trust that fact....
Then along came LE and it did not automatically provide cleared storage and that really messed up, among other things, CICS maps......
There is a LE parm that forces LE to provide cleared storage and nowadays most shops have it so.....
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 Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 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. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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