SRCHFOR String Query



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

SRCHFOR String Query

Postby Aki88 » Thu Jun 26, 2014 12:14 pm

Hello,

This doth sound trivial; but I am stuck.
How do I SRCHFOR the below string:


I have tried a few combinations replacing the ' with '', but it is the comma which is giving me trouble; without the comma in the search string, it returns results (which includes strings - ABC'; whereas I need to search only ABC',); though asa the comma is added, the Invalid Parameter error is popped (this is irrespective of the many combinations attempted, just not able to find the right one):

Only one search string may be specified on this panel. Enter SRCHFOR with no operands for other options.


Thanks.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: SRCHFOR String Query

Postby prino » Thu Jun 26, 2014 2:15 pm

To use a quote in a quoted string, double the quote. It's a pretty universal rule...
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: SRCHFOR String Query

Postby Aki88 » Thu Jun 26, 2014 2:51 pm

Hi Prino,

Yup, manual does say about replacing ' by two single quotes in case the search string contains the same; the problem here is- a comma following the single quote in the SEARCH string; when this combination is being presented (as shown in the below example), the SEARCHFOR goes for a toss, throws the error (as shown in the previous post).

Thanks.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: SRCHFOR String Query

Postby BillyBoyo » Thu Jun 26, 2014 3:35 pm

Did you try quoting the string, "something'',"?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: SRCHFOR String Query

Postby Aki88 » Thu Jun 26, 2014 3:41 pm

Hello Billy,

Yup; I have tried either of the below as well:

"something''," --> double quotes
''something'',' --> two single quotes
''something'','
'something'',''... and many more of the above combinations....

All of them give the same error as reported before.

Thanks.

<Edit: The problem is arising because of the comma which follows the single quotes; is there a way to handle that>
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: SRCHFOR String Query

Postby enrico-sorichetti » Thu Jun 26, 2014 3:58 pm

did You try with

"(quote)any arbitrary string with apostrophes ( ')"(quote)
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: SRCHFOR String Query

Postby Aki88 » Thu Jun 26, 2014 4:11 pm

Hello Enrico,

I remember trying this also; though just popped it again for double confirmation, this is what I tried:

SRCHFOR "ABC',"   <-- these being Double quotes, please note that my search string has an Apostrophe followed by a comma


The error:

Invalid embedded quote
A quote may be used as a delimiter or specified as two quotes.


Thanks.

<Edit: Though my understanding is if there is an apostrophe in the search string then it should be replaced with two single quotes for the system to understand that there is an apostrophe in the search string. On trying the same embedded in the aforementioned search string, it didn't show correct result.>
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: SRCHFOR String Query

Postby prino » Thu Jun 26, 2014 4:19 pm

prino wrote:To use a quote in a quoted string, double the quote. It's a pretty universal rule...

Did you actually follow this advice?

NO, YOU DID NOT!

This, tested, works without any problems:

'----'','
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: SRCHFOR String Query

Postby Aki88 » Thu Jun 26, 2014 5:05 pm

Hello Prino,

Given below is the step by step process I've followed:

1. My job card has the following string to be searched:

VIEW       XXXXX.PDS.JCLLIB($XXXYYY) - 01.07   
Command ===>                                     
****** ***************************** Top of Data
000001 //XXXYYYA  JOB '','XXX FILE ABC',   <-- The ABC', are the search strings here


2. I entered the below command:

VIEW              XXXXX.PDS.JCLLIB                         Row 00001 of 00138
Command ===> SRCHFOR 'ABC'','                                 Scroll ===> CSR
           Name     Prompt       Size   Created          Changed          ID 
_________ $XXXYYY                 670  2014/06/26  2014/06/26 16:42:33  ABABAB



3. The Final Outcome is as below:

VIEW              XXXXX.PDS.JCLLIB                           Invalid parameter
Command ===>                                                  Scroll ===> CSR
           Name     Prompt       Size   Created          Changed          ID 
_________ $XXXYYY                 670  2014/06/26  2014/06/26 16:42:33  ABABAB


Only one search string may be specified on this panel. Enter SRCHFOR with no
operands for other options.                                                 


At this point I am really unsure of what part I missed out following; I did try a fair amount of permutations and combinations, all of them failing for just this one case, chars followed by an apostrophe, subsequently followed by a comma.
We're currently on ISPF 6.1, z/OS 1.12; unsure how this might help, but just in case...

Just a footnote, same thing when done in batch-mode, works.

Thanks again.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: SRCHFOR String Query

Postby prino » Thu Jun 26, 2014 7:22 pm

Invoke SRCHFOR without parameter.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Next

Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post