Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Limit in Length for a CICS START seahawk789 CICS 6 Mon Apr 02, 2018 8:34 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us