Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initial state of WORKING-STORAGE items with no VALUE clauses

Status
Not open for further replies.

AustinOne

Programmer
Mar 22, 2002
59
0
0
US
I should know this, but don't remember and can't seem to find a definitive answer:

1. What is the initial state of WORKING-STORAGE items with no VALUE clauses? Or, in other words, if I have something like this in WORKING STORAGE, can I reliably depend on it to have an initial value of spaces?

01 WS-MISC-VARIABLES.
05 WS-WORK-FIELD-1 PIC X(10).

2. Does the answer to this question vary based on the implementor or is it a COBOL "standard"?

 
Long ago IBM used a phrase for things like this:
The results may be unpredictable"

Today, with the wide variety of compilers in use and the various compiler options, suggest you look in the documentation for the compiler you are using.

fwiw - none of the sites i've supported in many, many years will allow code to be promoted if the ws variables do not have initial values specified or some initialization code at the beginning of the program - on any platform.
 
It is "standard" that this is implementor defined. Also, it is normal that there is a way to modify this. With both IBM mainframe COBOL and Micro Focus COBOL, the default is SPACES, but this can be modified by specifying the appropriate compile-time options.

Note that on IBM mainframes, the default alphabet is EBCDIC, and SPACE is x"40". An ascii SPACE IS x"20".

Note also that this applies only to WORKING-STORAGE. Other areas are in general undefined (and initially may not even have any addressablity).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top