Retrieving the dataset names using REXX
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> TSO and ISPF

#1: Retrieving the dataset names using REXX Author: harsha vardhan reddy PostPosted: Mon May 09, 2011 10:16 am
    —
Is it possible to retrieve the datasets from a JOB(jcl) using rexx.

Thanks in advance..Smile

#2: Re: Retrieving the dataset names using REXX Author: harsha vardhan reddy PostPosted: Mon May 09, 2011 10:30 am
    —
Hi all,

Am new to REXX. I want to develop a REXX tool, which retrieves the dataset names from an jcl(Input & output).

This is mainly to save time by manually going through the jcl & make a note of input & output datasets. Because, we would run many jobs and we need to do the same work fro all the jobs..

#3:  Author: taltymanLocation: Texas PostPosted: Mon May 09, 2011 10:51 am
    —
yes...
Here is a sample, assuming that the DD ISPTABL is allocated.

/* REXX */
DDINFO = LISTDSI("ISPTABL" "FILE")
SAY SYSDSNAME
RETURN

#4:  Author: taltymanLocation: Texas PostPosted: Mon May 09, 2011 10:56 am
    —
ok, I mis-interpreted what you were asking. I assumed you meant a running job and not a scan of jobs.

#5:  Author: harsha vardhan reddy PostPosted: Mon May 09, 2011 11:20 am
    —
Hi tatlyman,

I need to scan the jcl and retrieve the datasets(input & output).

I can able to read the jcl from spool and written it to an output dataset. Now i need to read that dataset i.e the jcl and retrieve the datasets from it..

#6:  Author: kolusuLocation: San Jose PostPosted: Mon May 09, 2011 11:33 am
    —
harsha vardhan reddy,

Check this link

http://www.listserv.uga.edu/cgi-bin/wa?A2=ind9605&L=rexxlist&P=26392

Kolusu

#7:  Author: harsha vardhan reddy PostPosted: Tue May 10, 2011 9:48 am
    —
Hi kolusu,

Thanks fro the quick response and the link provided..

I am not to understand from where exactly it is retrieving the datasets..

Can we scan the jcl & retrieve the datasets... Is there any other approach to develop that kind of tool..

Thanks in advance..Smile

#8:  Author: kolusuLocation: San Jose PostPosted: Tue May 10, 2011 10:18 am
    —
harsha vardhan reddy wrote:
I am not to understand from where exactly it is retrieving the datasets..


harsha vardhan reddy,

The link provided is a rexx exec which scan all the DD names allocated to your TSO session.

did you miss reading this initial comment in the rexx exec?
Code:

/*********************************************************************/
/* THIS EXEC FIND THE DDNAMES & ASSOCIATED DSN'S ALLOCATED FOR A YOUR*/
/* TSO SESSION.  IT WORKS EITHER FROM TSO OR UNDER ISPF CONTROL.     */


harsha vardhan reddy wrote:
Can we scan the jcl & retrieve the datasets... Is there any other approach to develop that kind of tool..


If you are asking for a JCLSCAN tool , then there are more than a handful tools which provide you the cross references and also list the DSN names along with JCL syntax checking. Why do you want to re-invent the wheel?

Kolusu

#9:  Author: harsha vardhan reddy PostPosted: Tue May 10, 2011 10:52 am
    —
I have read that thing..

As i said i am trying to develop it in order to save my time for my project as i need to go through each & every job and make a note of datasets(input & output) corresponding to their jobs..

Is there any sample code which can help me in developing that..

#10:  Author: taltymanLocation: Texas PostPosted: Tue May 10, 2011 2:56 pm
    —
I'm not aware of any sample or free code that does what you want. There are commercial available tools. You could write some code in rexx or the language of your choice but it would not be trivial. It may be better to learn your application since all of its files should be or have been documented at one time. I know.... that may be a fairy tale.

#11:  Author: harsha vardhan reddy PostPosted: Tue May 10, 2011 7:30 pm
    —
Thats fine..

I have started already working on it..
Am getting struck how to read a jcl & search for a value in it, like by making use of EXECIO i could able to read line by line what i need is how to search for DSN or DISP in this...

Thanks in advance..

#12:  Author: dbzTHEdinosauerLocation: germany PostPosted: Wed May 11, 2011 1:06 am
    —
harsha vardhan reddy,

back up a minute and tell us exactly what kind of ds you are attempting to read,
and what you want to do with it.


it could be as easy as read the file to stem, check each stem element for existance of 'DSN' and going from there.

#13: Re: Retrieving the dataset names using REXX Author: stefanLocation: Germany PostPosted: Wed May 11, 2011 1:30 am
    —
harsha vardhan reddy wrote:
I want to develop a REXX tool, which retrieves the dataset names from an jcl(Input & output).

I'm not sure if I understood you correctly as I'm not a native speaker of English, but maybe you're in search of some kind of JCL scanner extracting dataset names, program names etc.
Years ago I've developed an ISPF edit macro which analyzes JCL and displays its information in an ISPF table format. Maybe you could have a look at it as a starting point for your own solution.
You'll find the code and a sample screenshot at the very bottom of this web site: http://sites.google.com/site/schlabb/home/code-snippets/edit-utilities

Hope this helps.

#14:  Author: harsha vardhan reddy PostPosted: Wed May 11, 2011 11:38 am
    —
Hi dbzTHEdinosauer,

Some datasets which are going to be created when we run that particular job & some input files(datasets) for that job to kick start...


By making use of stem i can able to read the DSN parameters, now i need to check if that particular data set is input or output for that jcl..

#15: Re: Retrieving the dataset names using REXX Author: harsha vardhan reddy PostPosted: Wed May 11, 2011 11:48 am
    —
Hi stefan,

The link which was provided by you is not any more available i think..

Yes stefan similar to that.. Not exactly for scanner but it needs to read the jcl as input file & could retrieve the datasets from that..

#16: Re: Retrieving the dataset names using REXX Author: kolusuLocation: San Jose PostPosted: Wed May 11, 2011 12:46 pm
    —
harsha vardhan reddy wrote:
Hi stefan,

The link which was provided by you is not any more available i think..

Yes stefan similar to that.. Not exactly for scanner but it needs to read the jcl as input file & could retrieve the datasets from that..


harsha vardhan reddy,

There is a dot at the end of the link. I edited the post and removed that and now the link works fine.

Check it now

Kolusu

#17: Re: Retrieving the dataset names using REXX Author: harsha vardhan reddy PostPosted: Wed May 11, 2011 7:18 pm
    —
Hi kolusu,

Thanks a lot..Smile

Now i can able to access that link

#18:  Author: papadi PostPosted: Fri May 13, 2011 3:58 pm
    —
"By making use of stem i can able to read the DSN parameters, now i need to check if that particular data set is input or output for that jcl.."
If a disp is OLD or SHR, how might you know if this is input or output (or both) . . .?

#19:  Author: misi01Location: Stockholm, Sweden PostPosted: Sat May 14, 2011 1:27 am
    —
Funny, I didn't have any problems following the links

#20:  Author: harsha vardhan reddy PostPosted: Sat May 14, 2011 7:49 pm
    —
Hi,

The jcl which i used to retrieve the datasets includes scratch statements from that i can get the output datasets & i will check whether they are cataloged or not.. The only problem is with the input datasets..

#21:  Author: harsha vardhan reddy PostPosted: Fri Jun 03, 2011 10:47 pm
    —
Hi,

Am able to retrieve the data sets which include input & out put.

I need small help in parsing a string..
LFTEST.R911V000.P2D1T.LF.LFFAPL.SLFBF

Say this is my input string. Now i need to parse this & get the count of the delimiter "."(period)

This should be done dynamically as the input parameter changes like
LF.STAGE.LOAD
LFTEST.R911V000.INT.LOAD


so need some help in parsing this data.. Please help me out..


Thanks in advance...Smile

#22:  Author: kolusuLocation: San Jose PostPosted: Sat Jun 04, 2011 1:39 am
    —
harsha vardhan reddy,

Code:

/* REXX */                                               
INSTR  = 'LFTEST.R911.INT.STAGE.LOAD'                     
SAY 'NO: OF . ARE : ' WORDS(TRANSLATE(INSTR,' ','.')) - 1
EXIT


Kolusu

#23:  Author: harsha vardhan reddy PostPosted: Mon Jun 06, 2011 11:42 am
    —
Thanks a lot Kolusu..

Its working fine..My requirement is almost done..

#24:  Author: harsha vardhan reddy PostPosted: Tue Jun 07, 2011 11:17 am
    —
Hi,

I need one more help from you guys..
I need to retrieve the data from spool from a particular job.
i have a step name say 'xyz' i need the data corresponding to that step name.

i can able to retrieve the data for jesjcl but not able to do for a particular step name..

Thanks in advance

#25:  Author: kolusuLocation: San Jose PostPosted: Tue Jun 07, 2011 11:45 am
    —
harsha vardhan reddy,

How about doing some leg work and searching instead of getting spoon fed every time?

A simple search for SDSF in "TSO and ISPF" forum produced the following

http://www.mvsforums.com/helpboards/viewtopic.php?t=3073&highlight=sdsf

http://www.mvsforums.com/helpboards/viewtopic.php?p=26539#26539

Kolusu

#26:  Author: harsha vardhan reddy PostPosted: Wed Jun 08, 2011 11:21 pm
    —
Hi,
Thanks for your quick responce..

I have a step name TSCRATCH in spool and the corresponding DDname is SYSIN. now i need to extract the data from it.

When am trying to do that i have one more ddname with same name SYSIN.It is retrieving tha data from the 1st SYSIN only..Can some one help me in this..

#27:  Author: papadi PostPosted: Thu Jun 09, 2011 11:14 am
    —
Quote:
How about doing some leg work and searching instead of getting spoon fed every time?

What have you tried? What happened?

di

#28:  Author: harsha vardhan reddy PostPosted: Thu Jun 09, 2011 11:25 pm
    —
HI,
I have tried with following code..
Code:


/***************REXX**************/
ADDRESS TSO
"alloc f(isfin) tracks space(1) reu"            /* used by sdsf     */
"alloc f(isfout) new delete reu " ,             /* used by sdsf     */
"tracks space(100,100) lrecl(133) recfm(f,b,a) dsorg(ps)"
"alloc f(temp1) da('z198.SAMPLE.output1') shr"

/*SAY 'ENTER JOBID:'
  PULL ID
  jobid = strip(ID)

  JOBID = 'JOB02911'

  SAY 'ENTER JOBNAME:'
  PULL JNAME
  JOBNM = STRIP(JNAME) */

RC = ISFCALLS(ON)
ISFPREFIX = "TB796"
ADDRESS SDSF "ISFEXEC ST"
IF RC <> 0 THEN
DO
 SAY 'ERROR'
 EXIT 20
END
LOOP = ISFROWS
DO I = 1 TO LOOP
 COLVAL = VALUE(JOBID.I)
 IF COLVAL = 'JOB07050' THEN
 DO
  ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.I"') PARM(NP ?)"
  IF RC <> 0 THEN EXIT
  DO J = 1 TO STEPN.0
    IF STEPN.J = 'TSCRATCH' THEN
      IF DDNAME.J = 'SYSIN' THEN
        do

QUEUE "PRE" TB796
queue "st"
/*queue "filter jobid eq "jobid*/
QUEUE "FIND " COLVAL
queue "++?"                                 /* open output of job    */
queue "find" SYSIN
queue "++S"
say ' am after sysin '
queue "print file temp1"                /* print to temp dataset */
queue "print 1 999999"
queue "print close"
queue "end"
queue "exit"
"execio" queued()" diskw isfin (finis"     /* input to sdsf batch   */
address ispexec "select pgm(isfafd) parm('++25,80')"/* invoke sdsf */
  END
  END
 END
END
RC = ISFCALLS(OFF)
--------------X--------------


when am trying to retrieve the data from stepname "TSCRATCH" with the dd name SYSIN it is gettting retrieved from the 1st SYSIN..But i need to retrieve the data corresponding to the TSCRATCH..

I know that by the code i have written it only retrieves it..
Am unable to proceed future..

Can some one help me on this..

Thanks in advance..

#29:  Author: kolusuLocation: San Jose PostPosted: Fri Jun 10, 2011 8:14 am
    —
harsha vardhan reddy,

Change your ISFAFD queue cards to pick the entire job instead of just sysin. Once you get the entire output start parsing with in the rexx.

Kolusu

#30:  Author: harsha vardhan reddy PostPosted: Fri Jun 10, 2011 10:47 am
    —
i have tried that thing as well.. But the problem is that i need to write the input and output datasets to two different files.

How to differenciate between input & output datasets..
If i able to retrieve the data from SYSIN Tscratch directly i will get the output datasets..Then i will parse the entire job to get the input datasets comparing them with output ones..

#31:  Author: harsha vardhan reddy PostPosted: Sat Jun 25, 2011 3:45 am
    —
Hi guys,

Is there any other way to retrieve the data sets from spool apart from which i have tried.

#32:  Author: papadi PostPosted: Sat Jun 25, 2011 3:40 pm
    —
In a single list, post what you have tried and what happened.

#33:  Author: harsha vardhan reddy PostPosted: Sun Jun 26, 2011 9:54 am
    —
Code:

/***************REXX**************/
ADDRESS TSO
"alloc f(isfin) tracks space(1) reu" /* used by sdsf */
"alloc f(isfout) new delete reu " , /* used by sdsf */
"tracks space(100,100) lrecl(133) recfm(f,b,a) dsorg(ps)"
"alloc f(temp1) da('z198.SAMPLE.output1') shr"

/*SAY 'ENTER JOBID:'
PULL ID
jobid = strip(ID)

JOBID = 'JOB02911'

SAY 'ENTER JOBNAME:'
PULL JNAME
JOBNM = STRIP(JNAME) */

QUEUE "PRE" TB796
queue "st"
/*queue "filter jobid eq "jobid*/
QUEUE "FIND " COLVAL
queue "++?" /* open output of job */


RC = ISFCALLS(ON)
ISFPREFIX = "TB796"
ADDRESS SDSF "ISFEXEC ST"
IF RC <> 0 THEN
DO
SAY 'ERROR'
EXIT 20
END
LOOP = ISFROWS
DO I = 1 TO LOOP
COLVAL = VALUE(JOBID.I)
IF COLVAL = 'JOB07050' THEN
DO
ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.I"') PARM(NP ?)"
IF RC <> 0 THEN EXIT
DO J = 1 TO STEPN.0
IF STEPN.J = 'TSCRATCH' THEN
IF DDNAME.J = 'SYSIN' THEN
do

queue "find" SYSIN
queue "++S"
queue "print file temp1" /* print to temp dataset */
queue "print 1 999999"
queue "print close"
queue "end"
queue "exit"
"execio" queued()" diskw isfin (finis" /* input to sdsf batch */
address ispexec "select pgm(isfafd) parm('++25,80')"/* invoke sdsf */
END
END
END
END
RC = ISFCALLS(OFF)
--------------X--------------

I tried to extract the output data sets from spool with corresponding to ddname & step name.i.e TSYSIN is my stepname & SYSIN is my ddname when i tried to extract the data from it but it always retrieves the data from the 1st occurence of SYSIN..

so how to retrieve the data from the required ddname & corresponding step name..

#34:  Author: harsha vardhan reddy PostPosted: Sun Jun 26, 2011 9:56 am
    —
I have more than one occurence of SYSIN.. so how to keep that in a loop in order to retrieve the data..

Thanks In advance..

#35:  Author: harsha vardhan reddy PostPosted: Sat Jul 02, 2011 8:45 pm
    —
Hi Guys,


Is this possible to set the cursor position to the desired position in the above code which i have tried..

With the help of above code i can find the desired location but how to read that data from that location..

I can able to get the line number from a variable j.. how to position the cursor to that specific location..

Thanks in advance..Smile

#36:  Author: papadi PostPosted: Sat Jul 02, 2011 9:31 pm
    —
Your topic of the same title has been locked in the other forum.

If you are caught double-posting again, you will be banned from those forums.

di

#37:  Author: harsha vardhan reddy PostPosted: Sat Jul 02, 2011 10:02 pm
    —
Hi guys,

Its an urgent requirement for me.. I have been working on this from the past one month..

I haven't got the solution so i have opted for help that's the reason i have posted on multiple forums.

#38:  Author: papadi PostPosted: Sun Jul 03, 2011 1:34 am
    —
Quote:
Its an urgent requirement for me..
Then you need to tell your management / project team you need someone more experienced to help.

Quote:
I haven't got the solution so i have opted for help that's the reason i have posted on multiple forums.
Bad choice. Possibly a few weeks ago would have been a good time to change your approach. You may still need to look for another way.

di

#39:  Author: papadi PostPosted: Sun Jul 03, 2011 12:45 pm
    —
Follow on. . .

If this has been getting basically nowhere for a month (and assuming your manager had expectations that this would not be a show-stopper), it would have been far better to tell the manager of the difficulties long ago.

Managers do not like "bad" surprises, and they really do not like last-minute bad surprises.

A suggestion for the future. YOU are the single resuorce you can count on (maybe a co-woorker or manager). It is never a good idea to bring critical issues to a forum where you may or may not even get an answer.

As soon as you determine you do not know how to do a "thing" you should let people know this will be a learning experience and the time required may be quite unpredictable.

fwiw,

di



MVSFORUMS.com -> TSO and ISPF


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group