IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Initializing all the occurance of an array of length 250


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Sat May 26, 2007 11:09 am
Reply with quote

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

New User


Joined: 08 Dec 2006
Posts: 48

PostPosted: Sat May 26, 2007 12:00 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 26, 2007 12:41 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 26, 2007 12:44 pm
Reply with quote

Hello,

Is this an interview question?

Do not post the same question in multiple forums.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top