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 

OF/IN Qualifier

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


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Tue May 09, 2006 7:06 am    Post subject: OF/IN Qualifier Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue May 09, 2006 8:14 am    Post subject: Reply with quote

nbdtrjk,

what exactly is the pointing of defining 2 occurances with the same names?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Tue May 09, 2006 8:24 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue May 09, 2006 8:36 am    Post subject: Reply with quote

nbdtrjk,

Please search before posting. Check this link which explains about initializing an Array.

http://www.mvsforums.com/helpboards/viewtopic.php?t=4327&highlight=initialize+array

http://www.mvsforums.com/helpboards/viewtopic.php?t=873&highlight=initialize+array

Hope this helps..

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Tue May 09, 2006 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Wed May 10, 2006 12:04 am    Post subject: Reply with quote

nbdtrjk,

Since your intension is to initialize all the occurence of the table WS2, you can use

Code:
INITIALIZE WS2.


Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
PaulPeplinski
Beginner


Joined: 17 Feb 2006
Posts: 11
Topics: 3

PostPosted: Thu May 11, 2006 10:03 am    Post subject: Reply with quote

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
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