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
 

 

Replacing Perform until with search verb

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Replacing Perform until with search verb
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

Site Director


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

PostPosted: Sat Mar 15, 2008 10:39 pm    Post subject:
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    Post subject: Reply to: Replacing Perform until with search verb
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    Post subject:
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    Post subject: Reply to: Replacing Perform until with search verb
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    Post subject:
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    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 Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm
No new posts Replacing Start Transid with LINK pkmurali CICS 12 Tue Apr 19, 2016 8:22 pm
No new posts How to perform Digest Access Authenti... vasanthz All Other Mainframe Topics 0 Tue Mar 15, 2016 4:47 pm
No new posts ADRDSSU Restore - How to prevent repl... Lipi.Prasannan JCL & VSAM 12 Fri Oct 02, 2015 12:13 am
No new posts Copy one PDS to another PDS based on ... alluri12 JCL & VSAM 10 Tue Sep 29, 2015 8:10 pm


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