View previous topic :: View next topic
|
Author |
Message |
amrita.chatterjee
New User
Joined: 27 Apr 2006 Posts: 48 Location: Bangalore, India
|
|
|
|
Say I have an array
A(250).
I have to initialize all the ocuurances of the array with different value.
A(1) = 1 Like that.
is there any easy way in cobol to initialize all the ocurances of an array with different value instead of mentioning each value in value clause.. |
|
Back to top |
|
|
prafull
New User
Joined: 08 Dec 2006 Posts: 48
|
|
|
|
Code: |
01 WS-INITIALIZE.
05 STRING-1 PIC X(250) VALUE 'PUT*ALL*250*VALUESHERE
- 'THOSE*YOUWANT*TO*USEAS*INITIALVALUES*FOR**
- 'ARRAY*A*TILLTHELENGTHIS250'
05 A REDEFINES STRING-1 OCCURS 250 TIMES PIC X. |
Hope it helps. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If the suggestion posted is not what you want, please post a larger sample of how you want the array initialized. Also, please post the array definition - A(250) is not an array - it is just a field.
Do you have one 250-byte field that is an array of 1-byte fields or do you have an array that is made up of some number of 250-byte fields.
When you post a better definition, we will be able to offer better suggestions. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Is this an interview question?
Do not post the same question in multiple forums. |
|
Back to top |
|
|
|