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

Replacing Perform until with search verb


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

New User


Joined: 13 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Sat Mar 15, 2008 9:40 pm
Reply with quote

Code:
PERFORM WITH TEST BEFORE
             VARYING fda-pure-ind FROM fda-pure-max BY -1
             UNTIL
                (fda-pure-ind < 2)
                 OR
                (pure-from-date IN tpapure (fda-pure-ind)
                 <= prerec-today IN CSCDATE2)

END-PERFORM


Please let me know how I can replace this piece of code by search verb
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: Sat Mar 15, 2008 10:39 pm
Reply with quote

Hello Nike and welcome to the forums,

You need to post the code showing the array definition as well as anything else that will hrlp us understand your requirement (i.e. why does the current process work from the highest entry to the lowest?

Yes, you probably can get what you want using SEARCH or SEARCH ALL.
Back to top
View user's profile Send private message
Nike123

New User


Joined: 13 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Tue Mar 18, 2008 3:51 pm
Reply with quote

Hi Dick,

The layout of the table is as follows

Code:
01  CSCPPURE.
         03 FDA-PURE-MAX               PIC S9(4) COMP.
         03 FDA-PURE-IND               PIC S9(4) COMP.
         03 TPAPURE                    OCCURS 1000 TIMES
                                       DEPENDING ON FDA-PURE-MAX
                                        IN CSCPPURE
                                       ASCENDING PUAG-SEQ-NO
                                        IN TPAPURE
                                        IN CSCPPURE
                                       ASCENDING RES-CODE
                                        IN TPAPURE
                                        IN CSCPPURE
                                       ASCENDING POAU-CODE
                                        IN TPAPURE
                                        IN CSCPPURE
                                       DESCENDING PURE-FROM-DATE
                                        IN TPAPURE
                                        IN CSCPPURE
                                       INDEXED BY TPAPURE-IX.
           05 PUAG-SEQ-NO              PIC S9(4) COMP-3.
           05 RES-CODE                 PIC X(4).
           05 POAU-CODE                PIC X(10).
           05 PURE-FROM-DATE           PIC S9(8) COMP-3.
           05 PURE-TO-DATE             PIC S9(8) COMP-3.
           05 PURE-REG-DATE            PIC S9(8) COMP-3.
           05 PURE-CHNG-DATE           PIC S9(8) COMP-3.



I feel since the date is in descending order, the row with the latest date satisfying the criteria is to be picked up. Please let me know, is it possible thru search in cobol without changing the sort order.

Thanks for all ur help.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Mar 18, 2008 4:53 pm
Reply with quote

If you would bother to read the documentation, you would find that if the table is sorted (according to your keys), then a binary search (search all) would work.

Depending upon the number of items in your internal cobol table, a SEARCH ALL would be more efficient that suffeling thru. But, if all you hits are within the first (or last) 10 or 20, suffeling would probably be faster.

but, you would have to test, your environment, your data.
Back to top
View user's profile Send private message
Nike123

New User


Joined: 13 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Tue Mar 18, 2008 5:05 pm
Reply with quote

Hi,

Search All will not work since the index is one of the search criterias. Also the second criteria of pure-from-date is "<=", which cannot be taken while usin search all.

I need to decrease the index of the table in a reverse order. I am not aware if we can do this. I have already tried.
Is the reversing of sort order only the way out.
Please pitch in with ur ideas

Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Mar 18, 2008 5:44 pm
Reply with quote

since FDA-PURE-IND does/will not change during a search of the internal cobol table, why are you wasting time interrogating it inside your search loop?


you can increment and decrement internal cobol table indexes.

what is your problem?
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
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 Use of Perform Thru Exit COBOL Programming 6
No new posts first column truncated in search result IBM Tools 13
Search our Forums:

Back to Top