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
 

 

Is it Initializing an Array?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Mon Aug 04, 2008 4:20 pm    Post subject: Is it Initializing an Array?
Reply with quote

Hi,

Could anyone explain me what is the following..

Initialize the Large array in Cobol.

05 WS-TEMP.
07 A OCCURS 10 TIMES

INITIALIZE A (1)

MOVE WS-TEMP TO WS-TEMP (LENGTH OF A (1) + 1 : )


Thanks,
~Vamsi
Back to top
View user's profile Send private message

sri_mf

Active User


Joined: 31 Aug 2006
Posts: 216
Location: India

PostPosted: Mon Aug 04, 2008 4:48 pm    Post subject: Re: Is it Initializing an Array?
Reply with quote

shreevamsi wrote:
Hi,

Could anyone explain me what is the following..

Initialize the Large array in Cobol.

05 WS-TEMP.
07 A OCCURS 10 TIMES

INITIALIZE A (1)

MOVE WS-TEMP TO WS-TEMP (LENGTH OF A (1) + 1 : )


Thanks,
~Vamsi



I have executed a sample code.
Code:


01 WS-OCCURS.
   10 WS-A1  OCCURS 3 TIMES
                     INDEXED BY I.
      20 WS-A1-1 PIC 9(9).
      20 WS-A1-2 PIC X(9).
01 WS-TEMP PIC 9(01) VALUE 1.

PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3
MOVE WS-TEMP TO  WS-A1-1(I)
MOVE WS-TEMP TO  WS-A1-2(I)
ADD 1 TO WS-TEMP
END-PERFORM.
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3
DISPLAY  WS-A1-1(I)
DISPLAY  WS-A1-2(I)
END-PERFORM.
INITIALIZE WS-A1-1(1)
MOVE WS-OCCURS  TO
                WS-OCCURS (LENGTH OF WS-A1-1(1) + 1 : )
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3
DISPLAY  WS-A1-1(I)
DISPLAY  WS-A1-2(I)
END-PERFORM.

And the results are

000000001
1
000000002
2
000000003
3
000000000
000000000
000000000
000000000
000000000
000000000


Finally what i have observed is : It moved zeros to all array variables.

Seniors and Moderators correct me if i am wrong.
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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm
No new posts COBOL Program to Read Array data raj4neo COBOL Programming 8 Sat Aug 15, 2015 12:28 am
No new posts Checking for High-Values in an array amitc23 COBOL Programming 10 Wed Aug 05, 2015 4:09 pm
No new posts How to define and use Double dimensio... pkmurali DB2 3 Mon Jun 22, 2015 8:36 am


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