BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

Can any one suggest how to read sdsf jobid into a sas program?

I am running a SAS Job in z/OS and I want to print the sdsf Jobid in SAS Log then how can this be achieved.
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
SDSF is an output display / management tool accessible through TSO (and batch as well). The JES (Job Entry Subsystem) facility actually assigns the JobID (also called the JES job number to some).

When you refer to "..sdsf Jobid.." - are you actually interested in printing the JES JobID in the SASLOG? And would that be the JOB_NAME or assigned JOB_NUMBER?

If this is the case, I suggest you look at printing the SAS automatic macro variables that are available - issue this command in your job to display them (and choose the appropriate one of interest) - there is a SYSJOBID but that is the JOB_NAME:

%PUT _AUTOMATIC_;

If you are looking to extract the JES-assigned job_number, you will need to investigate using CALL SYSTEM possibly to invoke a REXX EXEC - here is a REXX-related post/article:

http://itknowledgeexchange.techtarget.com/itanswers/can-you-find-out-the-name-of-the-job-calling-a-r...

However, the simplest approach would be to issue a FILENAME statement to allocate an unused and allocate it to SYSOUT=* in your SAS program. Then you can use the PATHNAME CALL function to get back the JES-assigned dataset name, which will include your JOB_NAME and JOB_NUMBER - parse it and display as needed, either with a DATA step or with MACRO language.

Some history: when SAS re-vamped its software with SAS 6.0x in the early '90s, printing of the JOB_NAME and JOB_NUMBER went away and it was up to users to display this information.


Scott Barry
SBBWorks, Inc.
OS2Rules
Obsidian | Level 7
I've always used this code (MVS and z/OS) to extract the JES Job Number:

data _null_;

LENGTH JOBNO $8;
ASCBADDR=PEEK(548,4);
ASSBADDR=PEEK(ASCBADDR+336,4);
JSABADDR=PEEK(ASSBADDR+168,4);
JOBNO=PEEKC(JSABADDR+20,8); /* JOB NUMBER */
PUT JOBNO=;

run;
Robert_Bardos
Fluorite | Level 6
And here's a bit of the collection that I've been using (based on some REXX code I found in MVS forums):
[pre]
%let tiot_pointer = %sysfunc(peek(%sysfunc(peek(540))+12));
%let job_name = %sysfunc(peekc(&tiot_pointer,8));
%let proc_step = %sysfunc(peekc(&tiot_pointer+8,8));
%let step_name = %sysfunc(peekc(&tiot_pointer+16,8));
%let jscb_pointer = %sysfunc(peek(%sysfunc(peek(540))+180));
%let pgm_name = %sysfunc(peekc(&jscb_pointer+360,8));
%let ssib_pointer = %sysfunc(peek(&jscb_pointer+316));
%let job_id = %sysfunc(peekc(&ssib_pointer+12,8));
%let job_number = %sysfunc(peekc(&ssib_pointer+15,5));
%let jct_pointer = %sysfunc(peek(&jscb_pointer+260));
%let job_class = %sysfunc(peekc(&jct_pointer+47,1));
%let msg_class = %sysfunc(peekc(&jct_pointer+22,1));
%let act_pointer = 00%sysfunc(peekc(&jct_pointer+56,3),hex6.);
%let act_pointer = %sysfunc(inputn(&act_pointer,hex8.));
%let pgmr_field = %sysfunc(peekc(&act_pointer+24,20));
%let system_id = %sysfunc(peek(%sysfunc(peek(16,4))+196,4));
%let system_id = %sysfunc(peekc(&system_id+16,4));
%let user_id = %sysfunc(peek(%sysfunc(peek(548))+108));
%let user_id = %sysfunc(peekc(&user_id+192,8));
[/pre]
Can't tell whether they're still valid with the latest and greatest of z/OS releases (we are at z/OS 1.10 now). Nor can I guarantee for the field names being super-accurate 😉
Peter_C
Rhodochrosite | Level 12
sorry I missed this a couple of weeks ago.
Here is how I get %sysjesID to provide the JES job ID.
%put the sdsf jes job-id is %sysJesID ;
based on my little macro[pre]%macro sysjesid() /des='get jes/sdsf jobID ' ;
%local ascb assb jsab ; %*******mvs jargon ! ;
/* ASCB is at 548 */
/* ASSB is at ASCB+336 */
/* JSAB is at ASSB+168 */
%let ascb = %sysfunc( peek( 548) );
%let assb = %sysfunc( peek( %eval( 336 + &ascb ) ) );
%let jsab = %sysfunc( peek( %eval( 168 + &assb ) ) );
/* now get job ID as in JES/sdsf */
%sysfunc( PEEKc(%eval( 20 + &jsab), 8 ))
%mend sysjesid;
/* demo
%put %sysjesid;
*******************/
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Simplest approach - four lines, no control block references with PEEK:

FILENAME MYDUMMY SYSOUT=*;
%LET MYPATH = %SYSFUNC(PATHNAME(MYDUMMY));
%PUT %SYSFUNC(SCAN(&MYPATH,3,%STR(.)));
FILENAME MYDUMMY CLEAR;

Scott Barry
SBBWorks, Inc.
Peter_C
Rhodochrosite | Level 12
thanks Scott,
:-( but I like function macros that can be used within statements.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The process can be done either in a DATA step or with using SAS macro language (invocation) statements.

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1815 views
  • 0 likes
  • 5 in conversation