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 

Problem with Search All

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


Joined: 07 Feb 2006
Posts: 28
Topics: 7

PostPosted: Fri May 11, 2007 11:09 am    Post subject: Problem with Search All Reply with quote

I want to write distinct values into the table. When I used the below piece of code I am still getting duplicate values inserted. Can some one help me where I am missing here.

My approach to do below is
1. search table if the value is available
2. If not update

SEARCH ALL DIAG-TABLE
AT END
ADD 1 TO DIAG-CT
SET DIAG-IDX TO DIAG-CT
MOVE DIAG-CD TO DIAG-CODE(DIAG-IDX)
MOVE DIAG-CT TO DIAG-POINTER(DIAG-IDX)
WHEN DIAG-CODE(DIAG-IDX) = SERVLINE-DIAG-CD
END-SEARCH.

Thanks,
Sriram
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri May 11, 2007 11:16 am    Post subject: Reply with quote

Remove the "ALL" from the search command, once you start inserting rows in the table without regard to sequence, the binary search will produce unpredictable results.
If you just do a sequential search, you will always find the dups if they are there.
Alternately, you could use the binary search and do your inserting while keeping the table in sequence, but you would have to insert in the middle parts of the table most often.
Back to top
View user's profile Send private message
sriramkarumuri
Beginner


Joined: 07 Feb 2006
Posts: 28
Topics: 7

PostPosted: Fri May 11, 2007 1:01 pm    Post subject: Reply with quote

Thanks,

I changed to Search instead of Search all and it worked out

Regards,
Sriram
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