Page 1 of 2

Capturing job names and all the dataset associated with it

PostPosted: Sat Dec 07, 2013 9:34 am
by sandy86
Hi,
I am new to Mainframe technology and i have requirement like below:

1. I have a flat file which contains the job details with the expanded PROC with dataset name.
2. The datasets has so many JCLS in expanded order.
3. My requirement is to capture all the job names and the datasets associated with the job names.
4. I am planning to use string and unstring concept but not sure how to proceed the coding. Can someone please help?

I am pasting the details of the files below:

//ABCDEFGH JOB .....................MSGCLASS=X,CLASS=
..
...
...
..
..EXEC PROC
...
..
//-- DSN=a.b.c,Disp=shr
..
..

Please note that the position of //Jobname i.e //ABCDEFGH here is not in a particular position and can vary
i want to apply logic like-
a) Read the lines one by one
b) If a line contains the keyword (MSGCLASS or CLASS) or has the keyword JOB then after the "//" symbol it should be job name and i have to capture the job name here ABCDEFGH
c) then i have to capture all the datasets associated to this job name until the next job name comes.
d) please note that to capture the datasets i can use keyword DSN and some other criteria but i am not sure how to implement it.

Can you please help me

Re: Capturing job names and all the dataset associated with

PostPosted: Sat Dec 07, 2013 11:56 am
by enrico-sorichetti
http://ibmmainframes.com/about62106.html
double posting the same question on sibling forums will not get You a double number of answers.
did You notice that people providing definitive answers here are the same who provide answers there ???

Re: Capturing job names and all the dataset associated with

PostPosted: Sat Dec 07, 2013 12:24 pm
by steve-myers
I cannot assist you with your program; I am not a Cobol programmer.

In any event, what you propose is not necessarily complete. Data set names can be obtained from sources other than the JCL statements.
  • Data set names can be obtained by examining the system itself; a few months ago, for example, I was curious about how many members existed in user PDS data sets, so I wrote a program that scanned the VTOCs for PDS data sets; the program then allocated the data set, read its directory, and updated tables with the tally information.
  • It is possible to define temporary data sets with no data set names in JCL. Your program should be prepared for that situation.
  • Data set names can be specified using symbol substitution in JCL. For example:
    //APROC   PROC DS1='X.X.Y',DS2='X.Y.A'
    //STEP010 EXEC PGM=...
    //DS1      DD  DISP=(NEW,CATLG),...,DSN=&DS1
    //DS2      DD  DISP=SHR,DSN=&DS2
    This symbol substitution is very common in JCL for production jobs.
  • Data set names can be specified in control data sets of one sort or another, both system control data sets and control data sets used by an application; these data sets are then allocated using dynamic allocation.
I think you will find your task is far more complex than you initially thought.

A more realistic way to go about this task is to examine SMF data. This is also not so easy for a novice Cobol programmer, but the data is all in one place, sort of, and you don't have the complexities of symbol substitution and analyzing non JCL control data.

Whatever you ultimately decide to do, good luck.

Re: Capturing job names and all the dataset associated with

PostPosted: Sun Dec 08, 2013 10:50 am
by dick scherrer
Hello,

The duplicate topic in the "Other" forum has been locked.

Suggest you use this forum for your questions/doubts. This forum is intended for people without so much experience.

As has been mentioned both here and "there", this is not a simple grab some data and massage it to get what you want. . .

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 1:59 pm
by sandy86
Thanks dick and enrico,
i have started doing coding for the REXX program.
can you please let me know the logic of capturing only the job name by REXX. I have started with the code which reads the file and count each line and display the content-

/******REXX******/
ADDRESS TSO
"ALLOC F(INFILE) DSN('SKUMA4.JOBDET.TEST') SHR REU"
/* INFILE is a logical name for the file */
"EXECIO * DISKR INFILE ( FINIS STEM MYFILE."
/* MYFILE is the stem (array) that holds the data */
"FREE F(INFILE)"
I = 1
/* MYFILE.0 will have the number of */
/* elements in the stem             */
DO WHILE I <= MYFILE.0
   SAY ' LINE ' I ' : ' MYFILE.I
   I = I + 1
END
EXIT

------------------------------------
Here i have to add the logic that when it is reading records one by one and if it finds the keyword- "MSGCLASS=" and the key word "JOB" then i have to capture that jobname just after //

eg.
//ABCDEFGH JOB .....................MSGCLASS=X,CLASS=


here "MSGCLASS=" is there so i have to capture ABCDEFGH.

Please let me know how to implement this logic with sample code.

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 2:23 pm
by NicC
Please use the code tags when posting code and data. I have done this for you - see how your code now has its correct indentation and so is much easier to read?

You should not be searching for MSGCLASS to determine the first record of the job as the only keyword that has to be on the first record is JOB so search for ' JOB ' using POS and then extract the jobname using either PARSE or SUBSTR.

As you are using Rexx this topic is being moved to the Rexx forum.

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 3:28 pm
by sandy86
Thanks Nic,
Earlier i was thinking of writing a Cobol program for this, but many people suggested that REXX will be more easier for this kind of task. Also the length of the file is very huge. i.e. it has around 10 lakh records.
Here i understand that the JOB keyword will be definitely present after the job name but the problem is that there are so many lines and positions where "JOB" string is used apart from the job card.

Is it possible for you to provide a sample PARSE or SUBSTR code for the above criteria.

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 4:03 pm
by NicC
JOB preceded and succeeded by space(s) will only occur on the job card unless it is within a comment. If you have control cards with that string then you will be unlucky and control cards should really be kept as members of a PDS(E). I do not know how many records a lakh is - it is not a mainframe term. Actually I do know but it is still not a mainframe term and you should refrain from using it in this context. I million records is probably too many to process through Rexx unless this is a one-off process. You could cut this own by passing your input through sort first to select only job cards and lines with DSN= or DSNAME= on them.

As to the samples of PARSE and SUBSTR - look in the manual - that is what it is there for.

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 5:31 pm
by steve-myers
Given the size of your data set, I suspect Rexx is not an appropriate choice for an implementation language, not because Rexx can't do the job, but as an interpreted language its execution is rather slow.

By the way, you will have to handle situations like this --

//xxx JOB ...
//A EXEC xxx
//add DD DATA,DLM='XX'
//yyy JOB ...
//A EXEC zzz
XX

The second JOB statement is data, not JCL.

Re: Capturing job names and all the dataset associated with

PostPosted: Tue Dec 10, 2013 6:09 pm
by enrico-sorichetti
By the way, you will have to handle situations like this --

good luck :mrgreen: