Hello everyone,
Could you please teach me if there is a solution that I can retrieve current jcl job's DSN name and show it in log?
For example the current jcl job's DSN name is "USER.MEMBER.PDS(LIST05)", I want add some code(use some system function(like &SYSUID,&SYSDATE...) or some automatic method instead of manually input) in this jcl to show the DSN(current job) in the log after the job was executed.
Thanks!
Geo
Retrieve current DSN
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Retrieve current DSN
The system doesn't really track the source for a job -- once the job enters JES, it is converted / interpreted into control blocks and tokens that are what the system uses to execute the job. The source is kept for the output listing, but the origination of the source is not stored anywhere that I'm aware of. So there's nothing really to tell you the source of the job -- not in SAS, not in the system, not anywhere. Use documentation by writing a SAS program to run one-time to create a comment line with the source PDS and member name; some job schedulers will track the source of the job for you (which is good for production but not for test at most sites).
Re: Retrieve current DSN
Thank you very much for the quick and informative response!
as you said the source is not stored. I feed that is very make sense, so that is why in "=s.st" page we can use sj to see a jcl code only and not the full path of that jcl code. am I right?
Thanks!
as you said the source is not stored. I feed that is very make sense, so that is why in "=s.st" page we can use sj to see a jcl code only and not the full path of that jcl code. am I right?
Thanks!
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Retrieve current DSN
Yes, the source JCL is kept for the job output, but where that source came from isn't tracked. You might be able to modify the SUBMIT command to track where the job came from (I haven' t checked to see if that is possible), but you would still miss anything coming in from the internal reader.
Re: Retrieve current DSN
So I think the only possible way so far to do this is retrieve that from CVT or not.
-
- Global moderator
- Posts: 2105
- Joined: Thu Jun 03, 2010 6:21 pm
- Skillset: Assembler, JCL, utilities
- Referer: zos.efglobe.com
Re: Retrieve current DSN
GeorgeQ wrote:So I think the only possible way so far to do this is retrieve that from CVT or not.
The data set and member containing the source of a submitted job is not kept anywhere. If you want this insert it as a JCL comment in the JCL. You have to do this yourself unless you can alter the agent that submits the job (such as the TSO SUBMIT command) to do it for you.
-
- Posts: 1
- Joined: Sat Jun 17, 2017 9:29 am
- Skillset: OPC, TWS, JCL, REXX, MyExtra Attachmate Macro Editor
- Referer: Google
Re: Retrieve current DSN
What exactly do you want to achieve here? Can you please elaborate?
- prino
- Posts: 641
- Joined: Wed Mar 11, 2009 12:22 am
- Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
- Referer: Google
- Location: Vilnius, Lithuania
- Contact:
Re: Retrieve current DSN
Add this exec (suitably changed) to SYSEXEC, and call if LOGSUB (or change the name below). It was written to prevent the submission of non-conforming jobs on "that" system, and also logs the dataset/member of the JCL.
Note to moderators: Please do not remove contact details!
Then change a (probably) global site-command table and include this entry:
And note that the above only works in ISPF, submitting a job with the actual TSO SUBMIT command, or from READY mode will not log anything.
Note to moderators: Please do not remove contact details!
Code: Select all
/* REXX edit macro to prevent the submission of some jobs */
/*** trace ?r ***************************************************** \| *
* (C) Copyright Robert AH Prins, 2010-2010 *
************************************************************************
* ------------------------------------------------------------------ *
* | Date | By | Remarks | *
* |------------+------+----------------------------------------------| *
* | | | | *
* |------------+------+----------------------------------------------| *
* | 2010-05-07 | RAHP | Check for > 5 jobs on output queue | *
* |------------+------+----------------------------------------------| *
* | 2010-03-29 | RAHP | Initial version | *
* |------------+------+----------------------------------------------| *
************************************************************************
* LOGSUB is a REXX edit macro to prevent the submission of jobs that *
* do not follow certain rules: *
* *
* 1) The JOBNAME must start with the userid of the submitter *
* 2) It is not allowed to use any PRTY= keywords *
************************************************************************
* Send questions, suggestions and/or bug reports to: *
* *
* robert(a)prino(d)org / robert(d)a(d)h(d)prins(a)gmail(d)com *
* *
* Robert AH Prins *
* Ožkinių gatvė 48 *
* Vilnius 08410 *
* Lithuania *
************************************************************************
* More z/OS tools @ <https://prino.neocities.org/zOS/zOS%20Tools.html> *
************************************************************************
* This program is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/> *
***********************************************************************/
parse source source
parse value source with . . moi .
"isredit macro (parm) PROCESS"
"ispexec control errors return"
user = userid()
if user = someone_special |,
user = maybe_me |,
user = the_boss |,
user = another_exception? then
do
"isredit builtin submit"
exit
end
"isredit (STATE) = user_state"
"isredit (DSN) = dataset"
"isredit (MEM) = member"
id = '//* Submit ID: 'dsn'('mem')'
zedsmsg = ''
zedlmsg = ''
"isredit (L) = line 1"
parse value l with '//' jobname ' ' .
/***********************************************************************
* Check that the JOBNAME starts with the USERID *
***********************************************************************/
if abbrev(jobname, user) = 0 then
zedlmsg = 'SUBMIT cancelled, JOBNAME must start with' user
else
do
/*******************************************************************
* Do not allow users to jump the queue *
*******************************************************************/
"isredit f 'PRTY=' first"
if rc \= 0 then
"isredit f '/*PRIORITY' first"
if rc = 0 then
zedlmsg = 'SUBMIT cancelled, jumping the queue is NOT allowed'
end
trap = outtrap('st.')
/***********************************************************************
* Will always capture at least one line, the TSO session *
***********************************************************************/
"st" user
/***********************************************************************
* Will always capture at least one line, either a job with this name, *
* or the 'JOB xxxxxxxx NOT FOUND' message *
***********************************************************************/
if length(jobname) - length(user) > 1 then
"st" jobname
trap = outtrap('OFF')
/***********************************************************************
* This allows them to have no more than 4 jobs on the output queue *
***********************************************************************/
if st.0 > 6 then
do
zedlmsg = 'SUBMIT cancelled, too many jobs on the output queue.',
'Please remove them before resubmitting this job.'
end
if zedlmsg = '' then
do
"isredit f ' EXEC ' first"
if rc = 0 then
"isredit line_before .zcsr = (ID)"
"isredit builtin submit"
"isredit f ' Submit ID:' first"
if rc = 0 then
"isredit del .zcsr .zcsr nx all"
end
else
do
"ispexec setmsg msg(ISRZ001)"
if st.0 > 5 then
do
zcmd = ";sdsf;pre" user"*;owner" user"*;st"
"ispexec control nondispl end"
"ispexec display panel(isr@prim)"
end
end
"isredit user_state = (STATE)"
exit
Then change a (probably) global site-command table and include this entry:
Code: Select all
Verb T Action
SUBMIT 3 ALIAS LOGSUB
And note that the above only works in ISPF, submitting a job with the actual TSO SUBMIT command, or from READY mode will not log anything.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Retrieve Subsystem Name executing under
by drowelf » Wed Feb 02, 2022 3:44 am » in Operating Systems - 0
- 1947
-
by drowelf
View the latest post
Wed Feb 02, 2022 3:44 am
-
-
-
Can anyone tell me how to retrieve the vsam system timestamp
by jdechirico » Tue Jun 18, 2024 9:22 pm » in VSAM/SMS - 1
- 1544
-
by enrico-sorichetti
View the latest post
Tue Jun 18, 2024 10:06 pm
-
-
-
How to obtain only current YEAR and subtract years from it?
by prisgs » Thu Nov 17, 2022 7:13 pm » in JCL - 3
- 2436
-
by sergeyken
View the latest post
Thu Nov 17, 2022 11:24 pm
-
-
-
How to obtain only current YEAR and subtract years from it?
by prisgs » Thu Nov 17, 2022 11:27 pm » in DFSORT/ICETOOL/ICEGENER - 3
- 1978
-
by prisgs
View the latest post
Fri Nov 18, 2022 6:27 pm
-