View previous topic :: View next topic |
Author |
Message |
tech_mf Beginner
Joined: 12 Oct 2007 Posts: 5 Topics: 2
|
Posted: Thu Dec 04, 2008 10:04 am Post subject: Assign the values to the array while define |
|
|
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 |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Thu Dec 04, 2008 1:08 pm Post subject: |
|
|
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 |
|
 |
tech_mf Beginner
Joined: 12 Oct 2007 Posts: 5 Topics: 2
|
Posted: Thu Dec 04, 2008 1:19 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
tech_mf Beginner
Joined: 12 Oct 2007 Posts: 5 Topics: 2
|
Posted: Thu Dec 04, 2008 2:48 pm Post subject: |
|
|
Thanks for your help Kolusu,
Sorry for that, I searched but I should have done better job while searching.
Regds. |
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Thu Dec 04, 2008 10:16 pm Post subject: |
|
|
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 |
|
 |
tech_mf Beginner
Joined: 12 Oct 2007 Posts: 5 Topics: 2
|
Posted: Tue Dec 09, 2008 9:47 am Post subject: |
|
|
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 |
|
 |
|
|