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
 

 

Doubt in using an array in 'if' condition

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

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Mon May 31, 2010 3:20 pm    Post subject: Doubt in using an array in 'if' condition
Reply with quote

Hi all,
I have a doubt in using an array in 'if' condition. iam getting compilation error . Can u please help me solve this.
Error message:

variable was not a uniquely defined name. The definition to be used could not be determined from the context. The reference to name was discarded. Expected a reference modification specification but found ")". the if statement was discarded.


In the code i am comparing old value and new value in an field.

Copy book layout:
layout1:
Code:
---------
01 key-field.
     05   field1   pic x(05).
     05   field2   pic x(05).
     05   field3   occurs 2 times.
            10   field4    pic x(05).
            10   field5    pic x(05).

Code:
Code:
ID Division.
.
.
.

Copy layout1 replacing ==key-field== by ==new-field==.
Copy layout1 replacing ==key-field== by ==old-field==.
.
.
if  field4 (1) of new-field not= field4 (1) of old-field
  display ' mismatch'
end-if.
.
.

Note: for normal variables (not array elements) it is fine, i am not getting ay error. I am getting this error only while comparing array elements.


please help me solving this.
Thanks in advance.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 31, 2010 3:44 pm    Post subject:
Reply with quote

obviously, your syntax is incorrect.

Syntax diagram
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Mon May 31, 2010 4:10 pm    Post subject: Reply to: Doubt in array.
Reply with quote

Hi dbzTHEdinosauer,

Thanks, it has helped me a lot.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 31, 2010 4:11 pm    Post subject:
Reply with quote

glad you were able to solve your problem.
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 Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Doubt in MFS abdulrafi IMS DB/DC 2 Fri Oct 21, 2016 3:09 pm
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am


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