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 Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am


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