IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Multilpe conditions in SEARCH statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sunnybunny

New User


Joined: 29 Nov 2005
Posts: 49

PostPosted: Thu Sep 27, 2007 2:35 pm
Reply with quote

Hello Friends,

I would like to execute a SEARCH statemnt with multiple conditions.
For that I have written a code as below.

SEARCH CHECK-DUP-EMPLOYEE VARYING S-SUB2
AT END
CONTINUE
WHEN EMPLOYEENUMBER IN CHECK-DUP-EMPLOYEE (S-SUB2) =
WS-EMPLOYEENUMBER
AND EMPLOYEETYPE IN CHECK-DUP-EMPLOYEE (S-SUB2) = 16
SET ISK-EMP-FND TO TRUE
END-SEARCH.

For this code what is happening is, let us say there are 5 employeenumbers in array. So now let us say the value of WS-EMPLOYEENUMBER is 3 and I am searching for this in internal array.

Here my requirement is I have to take the records from internal array which are having WS-EMPLOYEENUMBER is 3 and EMPLOYEETYPE is 16.
But whats happening is for given WS-EMPLOYEENUMBER array is executing for 5 times (because in array total number of EMPLOYEENUMBER are 5) without checking the AND condition. After it has executed 5 times subscript is incrementing to 6 and then abending with SOC7.

Please let me know how to handle this.

Regards,
Sunny.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Sep 27, 2007 2:49 pm
Reply with quote

Sunny,

One of the possible cause for S0C7 -

Quote:
Possible causes for this abend include:

Subscript error, referenced beyond table
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Sep 27, 2007 3:12 pm
Reply with quote

Hi Sunny,

Not clear enough.
Would you please paste the code for array delarartion & searching using code tab?
Back to top
View user's profile Send private message
sunnybunny

New User


Joined: 29 Nov 2005
Posts: 49

PostPosted: Thu Sep 27, 2007 3:39 pm
Reply with quote

Hello All,

Thanks for the replies.

I got the reason. I have not initialized the array.

Regards,
Sunny.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 27, 2007 10:12 pm
Reply with quote

Ooops. . . icon_smile.gif

Thank you for lettng us know you have the solution.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts How to load to DB2 with column level ... DB2 6
No new posts first column truncated in search result IBM Tools 13
No new posts Db2 SQL - how to switch among differe... DB2 18
Search our Forums:

Back to Top