Re: determine job that created dataset?

2023-02-15 Thread Andrew Rowley
If you are not into SAS, here is Java to do a similar thing using 
EasySMF Java API:


public class DatasetAccess
{
    public static void main(String[] args) throws IOException
    {
    List targetDatasets = Arrays.asList(
    new String[]{
    "SYS1.PARMLIB",
    "SYS1.PROCLIB"
    });

    // SmfRecordReader.fromName(...) accepts a filename, a DD name 
in the
    // format //DD:DDNAME or MVS dataset name in the form 
//'DATASET.NAME'


    try (SmfRecordReader reader = SmfRecordReader.fromName(args[0])
    .include(14)
    .include(15)
    .include(17)
    .include(18)
    .include(61)
    .include(62)
    .include(64)
    .include(65)
    )
    {
    reader.stream()
    .map(record -> new AccessInfo(record))
    .filter(accessInfo -> 
targetDatasets.contains(accessInfo.dataset))

    .limit(1000)
    .sorted(Comparator
    .comparing(AccessInfo::getDataset)
.thenComparing(AccessInfo::getSmfDateTime))
    .forEachOrdered(accessInfo ->
    System.out.format("%-44s %-24s %-10s %-4s %-8s%n",
    accessInfo.getDataset(),
    accessInfo.getSmfDateTime(),
    accessInfo.getEvent(),
    accessInfo.getSystem(),
    accessInfo.getJobname()
    ));
    }
    }

    private static class AccessInfo
    {
    public AccessInfo(SmfRecord record)
    {
    smfDateTime = record.smfDateTime();
    system = record.system();
    switch (record.recordType())
    {
    case 14:
    case 15:
    {
    Smf14Record r14 = Smf14Record.from(record);
    event = record.recordType() == 14 ? "Read" : "Update";
    dataset = r14.smfjfcb1().jfcbdsnm();
    jobname = r14.smf14jbn();
    break;
    }
    case 17:
    {
    Smf17Record r17 = Smf17Record.from(record);
    event = "Scratch";
    dataset = r17.smf17dsn();
    jobname = r17.smf17jbn();
    break;
    }
    case 18:
    {
    Smf18Record r18 = Smf18Record.from(record);
    event = "Rename";
    dataset = r18.smf18ods();
    jobname = r18.smf18jbn();
    break;
    }
    case 61:
    {
    Smf61Record r61 = Smf61Record.from(record);
    event = "ICF define";
    dataset = r61.smf61enm();
    jobname = r61.smf61jnm();
    break;
    }
    case 62:
    {
    Smf62Record r62 = Smf62Record.from(record);
    event = "VSAM open";
    dataset = r62.smf62dnm();
    jobname = r62.smf62jbn();
    break;
    }
    case 64:
    {
    Smf64Record r64 = Smf64Record.from(record);
    event = "VSAM status";
    dataset = r64.smf64dnm();
    jobname  = r64.smf64jbn();
    break;
    }
    case 65:
    {
    Smf65Record r65 = Smf65Record.from(record);
    event = "ICF delete";
    dataset = r65.smf65enm();
    jobname = r65.smf65jnm();
    break;
    }
    default:
    {
    event = Integer.toString(record.recordType());
    dataset = "Unknown";
    jobname = "Unknown";
    break;
    }
    }
    }

    public String getEvent() { return event; }
    public String getSystem() { return system; }
    public String getDataset() { return dataset; }
    public String getJobname() { return jobname; }
    public LocalDateTime getSmfDateTime() { return smfDateTime; }

    private String system;
    private String event;
    private String dataset;
    private String jobname;
    private LocalDateTime smfDateTime;
    }
}

--
Andrew Rowley
Black Hill Software

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-15 Thread MXG Support
Thanks for your assistance to that poster.

I provided an answer to the poster's gmail address,
asking who is the MXG customer and is he with an
outsourcer but he has not replied.

Barry

Herbert W Barry Merrill, PhD
President-Programmer
Merrill Consultants
MXG Software
10717 Cromwell Drive
Dallas, TX 75229
www.mxg.com


-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bruce Hewson
Sent: Wednesday, February 15, 2023 12:38 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: determine job that created dataset?

Hi Bill,

my MXG code:-

options ls=160 ; 
 
MACRO STOPOVER MISSOVER %
 
  MACRO _DSNLIST 
 'dataset.name.one'  
 'cluster.name.two.DATA' 
%
 
 
 
%LET MACKEEP=%QUOTE( 
  MACRO _LTY64X  _NULL_ %
  MACRO _ETY64X %
  MACRO _VAR1415 
dsnresult (  
KEEP=DSNAME JOB SYSTEM OPENTIME SMFTIME  
PROGRAM DDNAME OPEN SMF64SMB 
ACBIN ACBOUT SITUATN 
JCTJOBID STEPNAME ID 
  )  
%
  MACRO _ETY1415 
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY1718 
 OPENTIME = READTIME;
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY64   
 DSNAME = ENTRNAME;  
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY77   
 DSNAME = RNAME   ;  
 OPENTIME = STARTIME ;   
 PROGRAM  = QNAME;   
 DDNAME   = SYSOWN1  ;   
 JOB  = JOBOWN1  ;   
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY64X ;
%
  ); 
 
%include sourclib(vmac1415,vmac1718,vmac64,vmac77);  
%include sourclib(vmacsmf,imackeep); 
 
DATA 
_VAR1415 
_VAR1718 
_VAR64   
_VAR77   
_SMF 
_CDE1415 
_CDE1718 
_CDE64   
_CDE77   
   

Re: determine job that created dataset?

2023-02-15 Thread Jack Zukt
Hi,
Just a few days ago I have had to produce something like that for someone
that wanted to know where some files were being created. For some time now
that I try to use SORT to solve this kind of requests.
This is what I used to get the desired results (just for the 02/09/2023 SMF
records), using SORT to read the SMF records directly (bypassing IFASMFDP):

//SYMNAMES DD  *
SMF-TYPE,6,1,BI
TYPE014,X'0E'
TYPE015,X'0F'
SMF-DATE,12,3,PD
SMF-ID,15,4,CH
SMF-JOBNAME,19,8,CH
SMF-USERID,35,8,CH
SMF-OPEN-TIME,49,4,BI
SMF-DSN,69,44,CH
SMF-HLQ,69,8,CH
SMF-OPEN-DATE,269,04,PD
SMF-STEPNAME,331,8,CH
SMF-PGMNAME,339,8,CH
SMF-JOBID,347,8,CH
/*

and

//SYSINDD  *
  SORT FIELDS=COPY
  OPTION VLSHRT
  INCLUDE COND=(SMF-TYPE,EQ,TYPE015,&,* SMF 015
  SMF-OPEN-DATE,EQ,0123040,&, * SMF DATE = 09/02/23 Julian
  SMF-HLQ,EQ,C'DSNHLQ.') * DSN = DSNHLQ.**
*
  OUTFIL FNAMES=OUT001,
 CONVERT,REMOVECC,
 OUTREC=(SMF-TYPE,TO=ZD,
 X,
 SMF-OPEN-DATE,DT1,
 X,
 SMF-OPEN-TIME,TM1,
 X,
 SMF-ID,
 X,
 SMF-JOBNAME,
 X,
 SMF-USERID,
 X,
 SMF-DSN,
 X,
 SMF-STEPNAME,
 X,
 SMF-PGMNAME,
 X,
 SMF-JOBID)
/*

This will give you a file with records like these:

015 20230209 000507 PROD JOBP080D OPCPUSR  DSNHLQ.UCS9900.SORTSPS.G4852V00
 PS020SORT J0641824
015 20230209 000529 PROD JOBP085D OPCPUSR  DSNHLQ.UCS.D91ICFO.G4859V00
 PS010BATCHPEM J0641898
015 20230209 000538 PROD JOBP831D OPCPUSR  DSNHLQ.ZDD831.ZD1655I
 ZDF831RO IDCAMS   J0641929
015 20230209 000538 PROD JOBP923D OPCPUSR  DSNHLQ.UCS.ZD1802I
ZDD923C1 IDCAMS   J0641933


It is highly probable that Kolusu can enhance this SORT

Best Regards,
Jack

On Wed, 15 Feb 2023 at 06:38, Bruce Hewson <
0499d3d5e892-dmarc-requ...@listserv.ua.edu> wrote:

> Hi Bill,
>
> my MXG code:-
>
> options ls=160 ;
>
> MACRO STOPOVER MISSOVER %
>
>   MACRO _DSNLIST
>  'dataset.name.one'
>  'cluster.name.two.DATA'
> %
>
>
>
> %LET MACKEEP=%QUOTE(
>   MACRO _LTY64X  _NULL_ %
>   MACRO _ETY64X %
>   MACRO _VAR1415
> dsnresult (
> KEEP=DSNAME JOB SYSTEM OPENTIME SMFTIME
> PROGRAM DDNAME OPEN SMF64SMB
> ACBIN ACBOUT SITUATN
> JCTJOBID STEPNAME ID
>   )
> %
>   MACRO _ETY1415
>  IF  DSNAME IN ( _DSNLIST )
> THEN  OUTPUT work.dsnresult ;
> %
>   MACRO _ETY1718
>  OPENTIME = READTIME;
>  IF  DSNAME IN ( _DSNLIST )
> THEN  OUTPUT work.dsnresult ;
> %
>   MACRO _ETY64
>  DSNAME = ENTRNAME;
>  IF  DSNAME IN ( _DSNLIST )
> THEN  OUTPUT work.dsnresult ;
> %
>   MACRO _ETY77
>  DSNAME = RNAME   ;
>  OPENTIME = STARTIME ;
>  PROGRAM  = QNAME;
>  DDNAME   = SYSOWN1  ;
>  JOB  = JOBOWN1  ;
>  IF  DSNAME IN ( _DSNLIST )
> THEN  OUTPUT work.dsnresult ;
> %
>   MACRO _ETY64X ;
> %
>   );
>
> %include sourclib(vmac1415,vmac1718,vmac64,vmac77);
> %include sourclib(vmacsmf,imackeep);
>
> DATA
> _VAR1415
> _VAR1718
> _VAR64
> _VAR77
> _SMF
> _CDE1415
> _CDE1718
> _CDE64
> _CDE77
>
> proc sort data=work.dsnresult ;
>   by opentime   ;
>
>
> options linesize=150 nocaps;
>
> proc print  uniform noobs split='*' ;
> var dsname
> job
> stepname
> system
> opentime
> smftime
> program
> ddname
> open
> acbin
> acbout
> SMF64SMB
> jctjobid
> id
> ;
> title 'Dataset access report';
>
>
>
> hopefully it does not lose the formatting.
>
> Regards
> Bruce Hewson
>
> On Tue, 14 Feb 2023 04:29:15 -0600, Bill Giannelli <
> billgianne...@gmail.com> wrote:
>
> >Is there a way to determine what job created a dataset?
> >thanks
> >Bill
> >
> >--
> >For IBM-MAIN subscribe / signoff / archive access instructions,
> >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-14 Thread Bruce Hewson
Hi Bill,

my MXG code:-

options ls=160 ; 
 
MACRO STOPOVER MISSOVER %
 
  MACRO _DSNLIST 
 'dataset.name.one'  
 'cluster.name.two.DATA' 
%
 
 
 
%LET MACKEEP=%QUOTE( 
  MACRO _LTY64X  _NULL_ %
  MACRO _ETY64X %
  MACRO _VAR1415 
dsnresult (  
KEEP=DSNAME JOB SYSTEM OPENTIME SMFTIME  
PROGRAM DDNAME OPEN SMF64SMB 
ACBIN ACBOUT SITUATN 
JCTJOBID STEPNAME ID 
  )  
%
  MACRO _ETY1415 
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY1718 
 OPENTIME = READTIME;
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY64   
 DSNAME = ENTRNAME;  
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY77   
 DSNAME = RNAME   ;  
 OPENTIME = STARTIME ;   
 PROGRAM  = QNAME;   
 DDNAME   = SYSOWN1  ;   
 JOB  = JOBOWN1  ;   
 IF  DSNAME IN ( _DSNLIST )  
THEN  OUTPUT work.dsnresult ;
%
  MACRO _ETY64X ;
%
  ); 
 
%include sourclib(vmac1415,vmac1718,vmac64,vmac77);  
%include sourclib(vmacsmf,imackeep); 
 
DATA 
_VAR1415 
_VAR1718 
_VAR64   
_VAR77   
_SMF 
_CDE1415 
_CDE1718 
_CDE64   
_CDE77   
 
proc sort data=work.dsnresult ;  
  by opentime   ;
 
 
options linesize=150 nocaps; 
 
proc print  uniform noobs split='*' ;
var dsname   

Re: determine job that created dataset?

2023-02-14 Thread Steve Beaver
Look at the 14 and 15 records


Steve Beaver


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Gadi Ben-Avi
Sent: Tuesday, February 14, 2023 4:37 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: determine job that created dataset?

SMF should have that information, if you collect it.

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bill Giannelli
Sent: יום ג 14 פברואר 2023 12:29
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: determine job that created dataset?

Is there a way to determine what job created a dataset?
thanks
Bill

--
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-14 Thread Mike Shaw
On Tue, Feb 14, 2023, 5:29 AM Bill Giannelli 
wrote:

> Is there a way to determine what job created a dataset
>

The job name is in the F8 DSCB in the VTOC entry for the dataset IF the
dataset resides in the Extended Addressing Space (EAS) on an Extended
Addressing Volume (EAV).

Mike Shaw
MVS/QuickRef Support Group
Chicago-Soft, Ltd.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-14 Thread Gadi Ben-Avi
As far as I remember, It's SMF type 14 or 15, and maybe 60 for the catalog 
operation.
I would use DAF to scan the SMF file and find the information.

You can get DAF here 
https://sites.google.com/site/michaeljosephcleary/michael-joseph-cleary/zos-freeware

Gadi

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bill Giannelli
Sent: יום ג 14 פברואר 2023 12:56
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: determine job that created dataset?

Thank you for your response.
Might you know the IFCID and the field?

--
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-14 Thread Bill Giannelli
Thank you for your response.
Might you know the IFCID and the field?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: determine job that created dataset?

2023-02-14 Thread Gadi Ben-Avi
SMF should have that information, if you collect it.

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bill Giannelli
Sent: יום ג 14 פברואר 2023 12:29
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: determine job that created dataset?

Is there a way to determine what job created a dataset?
thanks
Bill

--
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN