MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Assign the values to the array while define

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
tech_mf
Beginner


Joined: 12 Oct 2007
Posts: 5
Topics: 2

PostPosted: Thu Dec 04, 2008 10:04 am    Post subject: Assign the values to the array while define Reply with quote

I need to assign the values to the array while declaration in working storage, Is it possible ?

Instead of moving like this in the program. Please suggest.

Code:

MOVE '01'            TO WS-IND (1)
MOVE '03'            TO WS-IND (2)
MOVE '05'            TO WS-IND (3)
MOVE '11'            TO WS-IND (4)
MOVE '05'            TO WS-IND (5)
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Dec 04, 2008 1:08 pm    Post subject: Reply with quote

Not sure what you mean, but another way to accomplish your code is to:
Code:
MOVE '0103051105' TO WS-INDS
where WS-INDS is the group name for your occurrences of WS-IND.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
tech_mf
Beginner


Joined: 12 Oct 2007
Posts: 5
Topics: 2

PostPosted: Thu Dec 04, 2008 1:19 pm    Post subject: Reply with quote

Thanks Terry for your help on this.

At present I have the code like this :

Code:

01  WS-PROD-IND-ARRAY               OCCURS 17 TIMES.
    05  WS-PRODUCT-IND              PIC X(15).       
    05  WS-LINE-OF-COV              PIC X(02).       

1000-INITIALIZE.                               
                                               
    MOVE 'MEDICAL'       TO WS-PRODUCT-IND (1) 
    MOVE '01'            TO WS-LINE-OF-COV (1) 
                                               
    MOVE 'DENTAL'        TO WS-PRODUCT-IND (2) 
    MOVE '03'            TO WS-LINE-OF-COV (2) 
                                               
    MOVE 'LIFE'          TO WS-PRODUCT-IND (3) 
    MOVE '05'            TO WS-LINE-OF-COV (3) 
    ---
    ---
    ---
    till  17.   


But I want avoid the MOVE statements and have them declared in working storage section. Any suggestions on this.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Dec 04, 2008 1:51 pm    Post subject: Reply with quote

tech_mf,

please search before posting. Check this link

http://mvsforums.com/helpboards/viewtopic.php?t=4327&highlight=table

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tech_mf
Beginner


Joined: 12 Oct 2007
Posts: 5
Topics: 2

PostPosted: Thu Dec 04, 2008 2:48 pm    Post subject: Reply with quote

Thanks for your help Kolusu,

Sorry for that, I searched but I should have done better job while searching.


Regds.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Dec 04, 2008 10:16 pm    Post subject: Reply with quote

As the link kolusu shows, I'd code:
Code:
01  WS-PROD-IND-ARRAY.
    05.
        10                  PIC  X(15) VALUE 'MEDICAL        '.
        10                  PIC  XX    VALUE '01'.
    05.
        10                  PIC  X(15) VALUE 'DENTAL         '.
        10                  PIC  XX    VALUE '03'.
    05.
        10                  PIC  X(15) VALUE 'LIFE           '.
        10                  PIC  XX    VALUE '05'.
                     .
                     .
                     .
    05.
        10                  PIC  X(15) VALUE 'LAST ENTRY     '.
        10                  PIC  XX    VALUE '17'.
01  REDEFINES  WS-PROD-IND-ARRAY.
    05  WS-PROD-IND-ENTRY   OCCURS 17 TIMES
                            INDEXED BY PIA.
        10  WS-PRODUCT-IND  PIC  X(15).
        10  WS-LINE-OF-COV  PIC  XX.
Now WS-PROD-IND-ENTRY, WS-PRODUCT-IND, and WS-LINE-OF-COV can be referenced via the index PIA in the PROCEDURE DIVISION.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
tech_mf
Beginner


Joined: 12 Oct 2007
Posts: 5
Topics: 2

PostPosted: Tue Dec 09, 2008 9:47 am    Post subject: Reply with quote

Terry & Kolusu,

I coded exactly as you mentioned here and it's working perfectly. Thanks for all your help on this. You guys are awesome.

Regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group