How to Search a ps file with different Strings?

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: How to Search a ps file with different Strings?

Postby steve-myers » Mon Jan 23, 2012 11:54 am

Perhaps a moderator will move this topic to Cobol.

Generally speaking, when the "key" term is used in our trade, the "key" is located at a fixed position in a record and it has a fixed length. What you want to do is search an entire record for your text. There's nothing wrong with that, but it is usually much slower than doing a compare at a fixed position, and it's worse for you because you want to test multiple "keys" for each record, and you may find yourself reading the entire "flat file 2" to check for your keys only to abandon the process.

You might be better off if you do the key search as part of your copy and then do something to delete the copy if there is no key match. If your shop uses the CA-1 tape management product, for example, you can define the copy as being catalog controlled, and delete the catalog entry for the copy if there is no key match. In a day or two, CA-1 will cycle the tape into the scratch tape pool. I think you can do something similar with the IBM RMM tape management product, but I don't know the mechanics. Talk to your support people to discuss the mechanics for the tape management product your shop uses.

The key (and I'm using the generic meaning here) to what you really want to do depends on the size of the dataset, how often the copy is not done because of a failure to match a key, and how deep you must read the source file before you match a key.
Global moderator
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Re: How to Search a ps file with different Strings?


Re: How to Search a ps file with different Strings?

Postby BillyBoyo » Tue Jan 24, 2012 1:38 am

3. I need to search the Key, anywhere in the flat file2 record.[/b][/color]


I need to ful fill the 3rd step here...
Could you provide me with some suggestion???

Onemore thing, Is it okay to continue this topic in JCL forums or do I need to start as a new topic in COBOL forums???

Pull the Cobol manuals up on your screen and start reading about INSPECT. Pay particular attention to the TALLYING part, but pick up the other stuff while you're there (always good to know the sort of things that you know are in the manual, then you know where to find them for next time).

If you can crack it with INSPECT, I'll show you an alternative as well. If you get stuck with INSPECT, let us know and someone will assist.
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to Search a ps file with different Strings?

Postby JCLKINGBY2013 » Wed Feb 15, 2012 8:56 am

I wrote the cobol program finally.......

Thanks to all...
Posts: 6
Joined: Sun Jan 22, 2012 12:10 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol


  • Related topics
    Last post