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

How to Search a ps file with different Strings?

Postby JCLKINGBY2013 » Sun Jan 22, 2012 12:28 am

I have 2 PS files.

1. Keys file
2. PS file with some data

1. Keys file
field1  field2         field3
101      89237598   20119283982349
101      89237598   20119283643410
102      89237598   20119283947351
103      89237598   20119283364352
104      89237598   20119283982311
105      89237598   20119283982372
106      89237598   20342483982349
107      89237598   20119543987645
108      89237598   20119282382394



2. Another PS file with some information. say file2

Requirement ?

We need to search the PS file with all the keys (field3) in the key file.

find, If any one of the key is presented in the file2 or not?
if presented, copy the file2 from disk to tape.

How would I fulfill this requirement?

NOTE: If one key found, copy dataset to tape. no need to check the remaining keys

Please help me out from this issue?

Thanks in Advance...
JCLKINGBY2013
 
Posts: 6
Joined: Sun Jan 22, 2012 12:10 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby steve-myers » Sun Jan 22, 2012 1:26 am

  • JCL is not a programming language. It is used to prepare an environment that programs specified in the JCL can use when they run. That is all JCL can do.
  • You are asking for the work product of professionals. Professionals expect to be paid. If you are willing to pay a professional to perform this task, leave a message here and someone may contact you using the private mail facility in this forum with their expected rates.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

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

Postby NicC » Sun Jan 22, 2012 10:22 am

This is, basically, the same request as in the Rexx part of the forum. Do NOT multi-post either within the forum or across forums. Did you not read the forum rules?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby JCLKINGBY2013 » Sun Jan 22, 2012 11:25 am

Why don't yo guys suggest me with some strategy? I am not getting the way to do it.
JCLKINGBY2013
 
Posts: 6
Joined: Sun Jan 22, 2012 12:10 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby BillyBoyo » Sun Jan 22, 2012 4:11 pm

"Hey guys, I want to skin a cat. Any ideas?"

But there is more than one way, so we need to narrow-down by what you are actually considering.

To do that, we need to know more about the task specifically, and more about the skills that you have available.

This could, for instance, be done by a language (Cobol, PL/I, Assembler even, whatever), rexx (another languague, left seperate for a reason), your Sort product. Other, obscure, ways.

If you want some ideas, provide some more information.

Good work with the Code tags, by the way. Thanks.

Nice nickname, but you have to work at it :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby NicC » Sun Jan 22, 2012 4:20 pm

You also have to remember it is the weekend so many people do not look on the forums as they may have a life to lead on Saturdays and Sundays. I don't - I am on holiday and life does not start until after 6pm. :D
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby JCLKINGBY2013 » Sun Jan 22, 2012 5:45 pm

BillyBoyo wrote:"Hey guys, I want to skin a cat. Any ideas?"

But there is more than one way, so we need to narrow-down by what you are actually considering.

To do that, we need to know more about the task specifically, and more about the skills that you have available.

This could, for instance, be done by a language (Cobol, PL/I, Assembler even, whatever), rexx (another languague, left seperate for a reason), your Sort product. Other, obscure, ways.

If you want some ideas, provide some more information.

Good work with the Code tags, by the way. Thanks.

Nice nickname, but you have to work at it :-)


I would like to go with COBOL program, if it is going to help me out.
JCLKINGBY2013
 
Posts: 6
Joined: Sun Jan 22, 2012 12:10 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby BillyBoyo » Sun Jan 22, 2012 6:02 pm

OK, so we need more information on the files.

We've seen the keys file, what about the 2nd file? There, is the key to search for in the same position each time, or are your searching "anywhere in the record/some part of the record"?

In the simplest case, you are searching in fixed position. Ensure that both files are sequenced on the keys for matching, and look at the "sticky" at the top of the Cobol forum here for matching two files.

For the more complex possibility, are the number of keys to search for limited in some way (is there a maximum number, actual or reasonable)? You'd store the keys in a table, read the second file, and then need some code to do the searching.

The "tape" part is just a thing in the JCL. You could do all your testing with disk datasets without invalidating anything, then do the final stuff with tape. z/OS has "device independence" which means that the JCL knows about tape/disk/whatever, your program doesn't need to know, it just knows it has a "file".

Get us some answers to the above and we see where to go next.

Hopefully when a moderator is around this topic can now be moved to the Cobol forum here.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby steve-myers » Sun Jan 22, 2012 6:14 pm

JCLKINGBY2013 wrote:... I would like to go with COBOL program, if it is going to help me out.
Then it might make more sense to open this topic in the Cobol section of this forum. Don't expect people to write code for you; they won't. However, you may receive a suggestion that you should write pseudo code before you start writing a program, like this -
read search keys into the search key table
open input dataset
for every record in input dataset
  read record from input dataset
  for each key in search key table
   compare key in record with key in search key table
   if key matches call copy code and exit these loops
Of course, you will need something similar to this for your copy code.

Now that wasn't so hard, was it?

And that's more than enough for nothing.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

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

Postby JCLKINGBY2013 » Mon Jan 23, 2012 10:38 am

BillyBoyo wrote:OK, so we need more information on the files.

We've seen the keys file, what about the 2nd file? There, is the key to search for in the same position each time, or are your searching "anywhere in the record/some part of the record"?

In the simplest case, you are searching in fixed position. Ensure that both files are sequenced on the keys for matching, and look at the "sticky" at the top of the Cobol forum here for matching two files.

For the more complex possibility, are the number of keys to search for limited in some way (is there a maximum number, actual or reasonable)? You'd store the keys in a table, read the second file, and then need some code to do the searching.

The "tape" part is just a thing in the JCL. You could do all your testing with disk datasets without invalidating anything, then do the final stuff with tape. z/OS has "device independence" which means that the JCL knows about tape/disk/whatever, your program doesn't need to know, it just knows it has a "file".

Get us some answers to the above and we see where to go next.

Hopefully when a moderator is around this topic can now be moved to the Cobol forum here.


Billy and Steve-myers.....

I started working on this program.
1. Read the Key1 from keys file.
2. Read the 1st record from Flat file2.
3. I need to search the Key, anywhere in the flat file2 record.
4. Prepared code for Copying dataset.

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???
JCLKINGBY2013
 
Posts: 6
Joined: Sun Jan 22, 2012 12:10 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post