Search a string in PDS with 2 lines prior & after.



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Search a string in PDS with 2 lines prior & after.

Postby Raja190 » Wed Mar 16, 2016 3:49 pm

Hi,

I need to find a string in members of a PDS and want to strip the lines in to spool with program names. I got the expected results using below job but I want to have results with n lines prior and after with specific to search string.


Example:

this is line number 1
this is line number 2
this is line number 3
this is line number 4
this is line number 5
this is line number 6


Expected result.

Srchfor 'line3' with 2 lines prior and after

this is line number 2
this is line number 3
this is line number 4
this is line number 5
this is line number 6


//SRCHFOR JOB (,,time,lines),'your name',CLASS=class
// EXEC PGM=ISRSUPC,
//NEWDD DD DSN=your.data.set.name,DISP=OLD
//OUTDD DD SYSOUT=*
//SYSIN DD *
SRCHFOR 'string1'
/*


Could you please help me to find a option for it.



Thanks
Raja.R
Raja190
 
Posts: 36
Joined: Mon Dec 14, 2015 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Search a string in PDS with 2 lines prior & after.

Postby NicC » Wed Mar 16, 2016 5:31 pm

Could you please help me to find a option for it


No - once again you have posted without using the code tags despite having been requested to do so. Why should we help you if you do not help us to help you?

Also, your inout and expected results do not match with what you wrote.
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: Search a string in PDS with 2 lines prior & after.

Postby Raja190 » Wed Mar 16, 2016 5:49 pm

let me rephrase the expected result.

Input:

this is line number 1
this is line number 2
this is line number 3
this is line number 4
this is line number 5
this is line number 6



Expected result.

Srchfor 'line4' with 2 lines prior and after

this is line number 2
this is line number 3
this is line number 4
this is line number 5
this is line number 6
Raja190
 
Posts: 36
Joined: Mon Dec 14, 2015 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Search a string in PDS with 2 lines prior & after.

Postby Terry Heinze » Wed Mar 16, 2016 6:43 pm

And where are the code tags Nic requested?
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Search a string in PDS with 2 lines prior & after.

Postby Raja190 » Wed Mar 16, 2016 6:55 pm

//SRCHFOR JOB (,,time,lines),'your name',CLASS=class
// EXEC PGM=ISRSUPC,
//NEWDD DD DSN=your.data.set.name,DISP=OLD
//OUTDD DD SYSOUT=*
//SYSIN DD *
  SRCHFOR 'string1'
/*


Code'd and silly line numbers removed.
Raja190
 
Posts: 36
Joined: Mon Dec 14, 2015 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Search a string in PDS with 2 lines prior & after.

Postby Akatsukami » Wed Mar 16, 2016 7:57 pm

Two requests for Code tags ignored. One more and I lock this thread :x
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Search a string in PDS with 2 lines prior & after.

Postby Terry Heinze » Wed Mar 16, 2016 8:59 pm

Raja190,
Click on PostReply, click the Code button, backspace the cursor to between the ] and the [, key in some JCL, click Preview. If it looks the way you want it, click Submit. An example follows:
JCL goes here
1
 2
  3
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Search a string in PDS with 2 lines prior & after.

Postby Raja190 » Thu Mar 17, 2016 12:12 am

Terry,

I have given tags for each JCL lines, I'm not sure what else you are expecting.
Raja190
 
Posts: 36
Joined: Mon Dec 14, 2015 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Search a string in PDS with 2 lines prior & after.

Postby BillyBoyo » Thu Mar 17, 2016 12:39 am

What do you mean by "tags"? I've Code'd your previous one for you. If you click on Quote, you can see what I've done. That is what is meant by the code tags.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Search a string in PDS with 2 lines prior & after.

Postby Terry Heinze » Thu Mar 17, 2016 1:17 am

Raja190,
Read my post of 10:29 again. I gave explicit instructions on how to use Code tags.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post