View previous topic :: View next topic |
Author |
Message |
nbdtrjk Beginner
Joined: 08 Mar 2006 Posts: 17 Topics: 11
|
Posted: Tue May 09, 2006 7:06 am Post subject: OF/IN Qualifier |
|
|
Code: |
Data DIVISION.
01 WS1.
02 WS-2 OCCURS 10 TIMES.
05 WS-A1 PIC X(40).
01 WS2.
02 WS-2 OCCURS 10 TIMES.
05 WS-A1 PIC X(40).
PROCEDURE DIVISION.
MAIN-PARA.
MOVE SPACES TO WS-A1(1) OF WS2.
|
Is above one is correct ? but layout is correct what ever i used.
Bur i am getting an error saying that "IGYPS0037-S "WS-A1" was not a uniquely defined name." and "Expected a reference-modification specification but found ")".
Please give me solution how to resolve this issue.. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue May 09, 2006 8:14 am Post subject: |
|
|
nbdtrjk,
what exactly is the pointing of defining 2 occurances with the same names?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nbdtrjk Beginner
Joined: 08 Mar 2006 Posts: 17 Topics: 11
|
Posted: Tue May 09, 2006 8:24 am Post subject: |
|
|
the logic is i need to initialize with spaces for all 10 occurence
Code: |
MOVE SPACES TO WS-A1(1) OF WS2
MOVE SPACES TO WS-A1(2) OF WS2
MOVE SPACES TO WS-A1(3) OF WS2
MOVE SPACES TO WS-A1(4) OF WS2
MOVE SPACES TO WS-A1(5) OF WS2
MOVE SPACES TO WS-A1(6) OF WS2
MOVE SPACES TO WS-A1(7) OF WS2
MOVE SPACES TO WS-A1(8) OF WS2
MOVE SPACES TO WS-A1(9) OF WS2
MOVE SPACES TO WS-A1(10) OF WS2
|
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
nbdtrjk Beginner
Joined: 08 Mar 2006 Posts: 17 Topics: 11
|
Posted: Tue May 09, 2006 9:28 am Post subject: |
|
|
Oh....This is not my Expected Results.
Data DIVISION.
01 WS1.
02 WS-2 OCCURS 10 TIMES.
05 WS-A1 PIC X(40).
01 WS2.
02 WS-2 OCCURS 10 TIMES.
05 WS-A1 PIC X(40).
PROCEDURE DIVISION.
MAIN-PARA.
MOVE SPACES TO WS-A1(1) OF WS2.
Explanation:-
The Logic is very simple. The Above code "WS-A1" is present in twice under WS1 and WS2 in 05 Level. If i use "MOVE SPACES TO WS-A1(1) OF WS2." like this i am getting below compilation Error.
1. "IGYPS0037-S "WS-A1" was not a uniquely defined name."
2 "Expected a reference-modification specification but found ")
Soo What is wrong in the above one or give me some suggestions..
Note:-
if i removed occurs clause under WS1. The compilation is going fine..like below
Data DIVISION.
01 WS1.
02 WS-2 OCCURS 10 TIMES.
05 WS-A1 PIC X(40).
01 WS2.
02 WS-2.
05 WS-A1 PIC X(40).
PROCEDURE DIVISION.
MAIN-PARA.
MOVE SPACES TO WS-A1 OF WS2.
But i want code with Occurs clause only and there is no change in field definition. If i change the definition, nearly 1000 components will impact for single changes.
Please help me !!!!!!! |
|
Back to top |
|
|
Jaya Beginner
Joined: 02 Sep 2005 Posts: 77 Topics: 10 Location: Cincinnati
|
Posted: Wed May 10, 2006 12:04 am Post subject: |
|
|
nbdtrjk,
Since your intension is to initialize all the occurence of the table WS2, you can use
Thanks,
Jaya. _________________ "Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein |
|
Back to top |
|
|
PaulPeplinski Beginner
Joined: 17 Feb 2006 Posts: 11 Topics: 3
|
Posted: Thu May 11, 2006 10:03 am Post subject: |
|
|
In this case there is a work-around but the proper syntax is
MOVE SPACES TO WS-A1 OF WS2 (1)
or with reference-modification (assuming a field of two or more bytes)
MOVE SPACES TO WS-A1 OF WS2 (1) (2:1)
I have seen cases where the OF qualifier is necessary. Think off-the-shelf wrappers with standard API's (account-bal has the same name in all "methods" - inquire, deposit, withdraw, etc). |
|
Back to top |
|
|
|
|