Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find pds member searching a datset name

Status
Not open for further replies.

LLuc

Technical User
May 1, 2018
20
FR
I need to translate the srchfor in rexx language like this job :

//SEARCH EXEC PGM=ISRSUPC,
// PARM=(SRCHCMP,ANYC,IDPFX,NOPRTCC)
//NEWDD DD DSN=my.input.dataset,DISP=SHR
//OUTDD DD SYSOUT=A
//SYSIN DD *
SRCHFOR 'vbporodk.std.datak'
/*

And I have to get the name of the member found in a variable.
 
I do not know exactly what you are asking. What do you mean by:
I have to get the name of the member found in a variable
?
Please give an example.


Nic
 
hi Nic,
it's for a delete define (idcams) as ==> //sysin dd dsn=my.input.dataset(&mbdef)
I have to retrieve the name of the member as a variable not in a sysout or output file as in the JCL as above
 
You can run your SRCHFOR in a Rexx program but you still need to process the sysout to extract the information that you want. Any program I may have had to do such a thing is, if I still have it at all, sitting on a hard drive that is dead.


Nic
 
Hi Nic,

I have a problem with ==> queue "Srchfor 'My DataSet ' " This way it works but when I want to put a variable it doesn't work anymore:
ex : file = 'my.dataset'
queue "srchfor 'file'" ==> not work
 
As dsn is a variable it must be outside of the string thus
Code:
"srchfor '"dsn"'"
If you do not need to quote the data set name (it is a data set not a 'file') then simply:
Code:
"srchfor "dsn


Nic
 
Thank you for your answer NIc
On the other hand when I execute only the part to find the member it works very well but when I insert in the whole procedure the variable is not translated?

 
That is so blurred that I can almost not read it. Could you not simply have cut and pasted it using the code tags (they are invoked using the button between what looks like a thinking man and a gift wrapped box)?
I see your superc ran with an RC of 16. What messages did it produce? In particular, what data set(s) did it think it was trying to read?


Nic
 
Hi Nic,

code_ep0ydc.png

you can open with paint software with 200% of view.

Sorry for the poor quality of my trace result.
In fact my variable ICSOR (name of the VSAM file) comes from an entry of an area under ISPF that I retrieve and then I search for the member where his delete define is located and I retrieve that member name to later be able to build my JCL.

For you what's wrong in this :
"ALLOC F(INPUT) DA(‘VBPRDK.SRC.PRD’) SHR REU"
"ALLOC F(OUTDD) NEW REU UNIT(VIO) SP(5,5) CYLINDERS"
"ALLOC F(SYSIN) NEW REU UNIT(VIO) RECFM(F B) LRECL(80)"
FICS = FICSOR
say 'Fics : ' FICS <======  value ok I see the file name of vsam
QUEUE "SRCHFOR '"FICS"'" <============ not translated
"EXECIO "QUEUED()" DISKW SYSIN (FINIS"
"CALL *(ISRSUPC) 'SRCHCMP,ANYC'"
"EXECIO * DISKR OUTDD (STEM SUPC. FINIS"
DO I = 1 TO SUPC.0
PARSE VAR SUPC.I WD1 WD2 WD3 WD4 .
IF WD2 = '---------' &,
WD3 = 'STRING(S)' &,
WD4 = 'FOUND' THEN
DO
/*-------------------------------------------------------- */
/* test member delete define */
/*-------------------------------------------------------- */
MEMBDEL = "'"VBPRDK.SRC.PRD’"(WD1)'" <== value of WD1 is empty
ztst3 = sysdsn(MEMBDEL)
if CODERR = 0 then do
if ztst3 /= "OK" then do
CODERR = 1
MESSERR1 = "Update impossible member not found"
end
end
END
END
 
Hi,
I have zero experience with REXX on mainframe, but on other platforms (iSeries, Windows, Linux).
If I want to execute the system command, then first I assemble it from variables into one string.
Then I can look into that string (with SAY) and try it eventually interactivelly if it works.
Finally, if it works I fire it from REXX.

So in your case you say that on the command line this works for you:
Code:
queue "Srchfor 'My_DataSet'"

When I look into your script, it seems that your dataset name is in the variable FICS
So I would try following
Code:
/* create command */
my_command = 'queue "SRCHFOR '''||FICS||'''"'
/* look at the command */
say "executing: "||my_command
/* execute the command */
my_command
 
Agree with mikrom - you need to get FICS outside of quotes so that Rexx can substitute its contents into the string that you are creating. If it is inside quotes then it is treated as a literal, not a variable. This will probably be the same for WD1.

But...I transferred your code to my editor and it looks as though the quotes all match up correctly. I did not use QUEUE on the mainframe, although I am now using it on my PCs. The way I would have done this is:
Code:
fics = "'"fics"'"   /* quotes the data set name */
myrec1 = "srchfor "fics /* creates the command string */
"EXECIO 1 DISKW SYSIN(STEM myrec FINIS"

Use TRACE R or TRACE I or, if running interactively, ?R or ?I. By using the ? you can step through the code and when you hit an error you can either enter code to fix the error or enter 'exit' without the quotes to quit the run.


Nic
 
yes very well, you have an example on the attached trace.

if I execute this part only, it works fine I have the value in wd1 but not with the whole procedure


"ALLOC F(INPUT) DA(‘VBPRDK.SRC.PRD’) SHR REU"
"ALLOC F(OUTDD) NEW REU UNIT(VIO) SP(5,5) CYLINDERS"
"ALLOC F(SYSIN) NEW REU UNIT(VIO) RECFM(F B) LRECL(80)"
FICS = FICSOR
say 'Fics : ' FICS <======  value ok I see the file name of vsam
QUEUE "SRCHFOR '"FICS"'" <============ not translated
"EXECIO "QUEUED()" DISKW SYSIN (FINIS"
"CALL *(ISRSUPC) 'SRCHCMP,ANYC'"
"EXECIO * DISKR OUTDD (STEM SUPC. FINIS"
DO I = 1 TO SUPC.0
PARSE VAR SUPC.I WD1 WD2 WD3 WD4 .
IF WD2 = '---------' &,
WD3 = 'STRING(S)' &,
WD4 = 'FOUND' THEN
DO
 
Can you put a TRACE I before the FICS = FICSOR line and a TRACE OFF after the EXECIO * DISKR.... line and cut and paste the output.


Nic
 
Hi Nic,
I think the problem comes from the RC (16) at the SRCHFOR, if it's a run-time problem when I call ISRSUPC, what would be the permission to set up under RACF?
 
If you already have RACF access to that data set then probably nothing more is needed but check with your RACF admin/TSO admin. Sometimes what you are allowed to do in foreground is restricted in background and vice versa.
What messages are you getting (this was requested last week!)?
Still need the trace.


Nic
 
that's why I think the member is not found
trace2_gztrj3.png
 
Difficult to tell from your screen shots. A simple cut and paste would be better instead of 'Prt Sc'.
It looks as though superc was invoked OK but it would be better, until you get it working OK, to write the SYSPRINT to file rather than having it trapped.

Also, a better way to find "string(s) found" is to use the 'POS' function:
Code:
 col = pos("string to find", string_to_look_in)
If col is not zero then the string has been found starting at column col. No need to 'PARSE' and have the convoluted 'IF' statement.


Nic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top