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
 

 

Initializing all the occurance of an array of length 250

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Initializing all the occurance of an array of length 250
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    Post subject:
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

Site Director


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

PostPosted: Sat May 26, 2007 12:41 pm    Post subject:
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

Site Director


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

PostPosted: Sat May 26, 2007 12:44 pm    Post subject:
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    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 SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm
No new posts File Manager with Variable Length File ahabib IBM Tools 10 Thu Mar 31, 2016 11:00 pm


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