Per Job license model

To generate a report that summarizes your monthly per-job license usage, you can generate a license metric tag file (SLMTag). The SLM tag that is generated applies the 10 monthly jobs pricing method where, the job count increments by 1 for every 10 successfully executed jobs you run and 1 job is counted when you run anywhere from 1 to 10 jobs. For example, if you run 34 jobs, 4 licenses are counted.

In the optman global options, use the licenseType keyword to define the pricing model. If you set the licenseType keyword to byWorkstation, you can then define the pricing model to be applied for each single workstation at creation time, specifying either perServer or perJob. If you select the perServer setting in optman, see Processor Value Unit license model for more information about tracking license consumption.

The queries listed below apply when you select either the byWorkstation or perJob pricing models in optman to return the license consumption tracking. If you select the byWorkstation value, the queries listed below return the number of records with license type=J generated by successful jobs on workstations which are set to license type=perJob.

You can optionally retrieve consumption information for a subset of workstations. To obtain this information, remove the comment before the lines:
-- “((Actual_workstation_name_in_run ='WKS_NAME1' AND
-- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
-- (Actual_workstation_name_in_run = 'WKS_NAME2' AND
-- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and "
remove the double dashes (—), and replace the '/FOL_WKS1/', 'WKS_NAME1', '/FOL_WKS2/', 'WKS_NAME2' strings with your folder and workstation couples.

The master domain manager centrally maintains the history of the jobs that you run in your environment. By using the optman global option, statsHistory, you can set the number of days for which you maintain the history of the jobs. To track your monthly per-job license usage, set the value of statsHistory to 400 (which is the default value). For more information about statsHistory, see Global options - detailed description.

For the SQL statement to generate the SLMTag file, see the following samples:
  • For DB2 database type:
    SELECT '<SchemaVersion>2.1.1</SchemaVersion>
    <SoftwareIdentity>
    <Name>IBM Workload Automation</Name>
    <PersistentId>3303c35cbc08435080502d621d5cdbff</PersistentId>
    <InstanceId>/opt/IBM/TWA</InstanceId>
    </SoftwareIdentity>' as xml from sysibm.sysdummy1
    UNION
    SELECT xml_metrics as xml
    FROM (SELECT CONCAT ('<Metric logTime="',CONCAT(current_date,CONCAT
    ('T',CONCAT(replace(current_time, '.', ':'),CONCAT('+00:00">
    <Type>10_MONTHLY_JOBS</Type>
    <Value>',CONCAT(JobNbr,CONCAT('</Value>
    <Period><StartTime>',CONCAT(Year,CONCAT('-',CONCAT
    (trim(VARCHAR_FORMAT(Month,'00')),CONCAT('-01T00:00:01+00:00</StartTime>
    <EndTime>',CONCAT(Year,CONCAT('-',CONCAT(trim(VARCHAR_FORMAT(
    Month,'00')),CONCAT('-',CONCAT(LAST_DAY,'T23:59:00+00:00</EndTime>
    </Period></Metric>'))))))))))))))))  as xml_metrics
    FROM (SELECT Year, Month,
    CASE
    when Month = 2 then '28'
    when Month = 4 then '30'
    when Month = 6 then '30'
    when Month = 9 then '30'
    when Month = 11 then '30'
    else '31'
    end as LAST_DAY,
    (COUNT(*)+9)/10 AS JobNbr,
    current date as current_date,
    current time as current_time
    from (SELECT unique year(Job_run_date_time) AS Year,
    month(Job_run_date_time)AS Month, day(Job_run_date_time) AS day,
    JOB_STREAM_WKS_FOL_NAME, JOB_STREAM_WKS_NAME_IN_RUN, JOB_STREAM_FOLDER_NAME, JOB_STREAM_NAME_IN_RUN,
    JOB_NAME_IN_RUN FROM MDL.JOB_HISTORY_V
    WHERE Job_status='S' and Workstation_license_type='J' and
    -- ((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND 
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and
    (Actual_WKS_FOLDER_NAME_IN_RUN, Actual_workstation_name_in_run) not in
    (select FOL_PATH, WKS_NAME from MDL.WKS_WORKSTATIONS W JOIN MDL.FOL_FOLDERS
    F ON W.FOL_ID=f.FOL_ID where W.WKS_AGENT_TYPE='E'))
    GROUP BY Year, Month))
    ORDER BY xml desc
  • For Oracle database type:
    SELECT '<SchemaVersion>2.1.1</SchemaVersion>
    <SoftwareIdentity>
    <Name>IBM Workload Automation</Name>
    <PersistentId>3303c35cbc08435080502d621d5cdbff</PersistentId>
    <InstanceId>/opt/IBM/TWA</InstanceId>
    </SoftwareIdentity>' as xml from dual
    UNION
    SELECT xml_metrics as xml
    FROM (SELECT '<Metric logTime="' || cdate || 'T' || ctime || '+00:00">
    <Type>10_MONTHLY_JOBS</Type>
    <Value>' || JobNbr || '</Value>
    <Period>
    <StartTime>' || Year || '-' || trim(TO_CHAR(Month,'00')) ||
    '-01T00:00:01+00:00</StartTime>
    <EndTime>' || Year || '-' || trim(TO_CHAR(Month,'00')) || '-'
    || LAST_DAY || 'T23:59:00+00:00
    </EndTime></Period></Metric>'  as xml_metrics
    FROM (SELECT Year, Month,
    CASE
    when Month = 2 then '28'
    when Month = 4 then '30'
    when Month = 6 then '30'
    when Month = 9 then '30'
    when Month = 11 then '30'
    else '31'
    end as LAST_DAY,
    CAST((COUNT(*)+9)/10 AS INT) AS JobNbr,
    TO_CHAR(SYSDATE, 'YYYY-MM-DD') as cdate,
    TO_CHAR(SYSDATE, 'HH24:MI:SS') as ctime
    from (
    SELECT unique EXTRACT(year FROM Job_run_date_time) AS Year,
      EXTRACT(month FROM Job_run_date_time) AS Month,
      EXTRACT(day FROM Job_run_date_time) AS Day,
      JOB_STREAM_WKS_FOL_NAME,
      JOB_STREAM_WKS_NAME_IN_RUN,
      JOB_STREAM_FOLDER_NAME,
      JOB_STREAM_NAME_IN_RUN,
      JOB_NAME_IN_RUN
      FROM JOB_HISTORY_V
      WHERE Job_status='S' and Workstation_license_type='J' and
    -- ((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and
       (Actual_WKS_FOLDER_NAME_IN_RUN, Actual_workstation_name_in_run) not in
      (select FOL_PATH, WKS_NAME from WKS_WORKSTATIONS W JOIN FOL_FOLDERS F ON
    W.FOL_ID=f.FOL_ID where W.WKS_AGENT_TYPE='E'))
    GROUP BY Year, Month))
    ORDER BY xml desc
  • For IDS database type:
    SELECT '<SchemaVersion>2.1.1</SchemaVersion><SoftwareIdentity><Name>IBM
    Workload
    Automation</Name><PersistentId>3303c35cbc08435080502d621d5cdbff</Persistent
    Id><InstanceId>/opt/IBM/TWA</InstanceId></SoftwareIdentity>' as xml FROM
    SYSTABLES
    UNION
    SELECT xml_metrics as xml FROM (SELECT CONCAT ('<Metric
    logTime="',CONCAT(current_date,CONCAT('T',CONCAT
    (current_time,CONCAT('+00:00"><Type>10_MONTHLY_JOBS</Type><Value>',CONCAT(r
    ound(JobNbr,0),CONCAT('</Value><Period><StartTime>',CONCAT(Year,CONCAT ('-
    ',CONCAT(Month,CONCAT('-01T00:00:01+00:00</StartTime><EndTime>
    ',CONCAT(Year,CONCAT('-',CONCAT(Month,CONCAT('-',CONCAT(LAST_DAY,'T23:59:00+00:00</EndTime> </Period></Metric>'))))))))))))))))  as xml_metrics
    FROM (SELECT Year,
    replace(TO_CHAR(Month, "**"),'*','0') AS Month,
    CASE
    when Month = 2 then '28'
    when Month = 4 then '30'
    when Month = 6 then '30'
    when Month = 9 then '30'
    when Month = 11 then '30'
    else '31'
    end as LAST_DAY,
    (COUNT(*)+9)/10 AS JobNbr,
    TO_CHAR(today,'%Y-%m-%d') as current_date,
    TO_CHAR(extend (current, hour to second),'%H:%M:%S') as current_time
    FROM (SELECT unique year(Job_run_date_time) AS Year,
    month(Job_run_date_time) AS Month, day(Job_run_date_time) AS day,
    JOB_STREAM_WKS_FOL_NAME, JOB_STREAM_WKS_NAME_IN_RUN,
    JOB_STREAM_FOLDER_NAME, JOB_STREAM_NAME_IN_RUN,
    JOB_NAME_IN_RUN
    FROM MDL.JOB_HISTORY_V
    WHERE Job_status='S' and Workstation_license_type='J' and
    -- ((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and
    not exists (select 1 from MDL.WKS_WORKSTATIONS W JOIN MDL.FOL_FOLDERS F ON
    W.FOL_ID=F.FOL_ID where W.WKS_AGENT_TYPE='E' AND
    Actual_wks_folder_name_in_run = F.FOL_PATH AND
    Actual_workstation_name_in_run = W.WKS_NAME))
    GROUP BY Year, Month))
    ORDER BY xml desc
  • For MSSQL database type:
    SELECT '<SchemaVersion>2.1.1</SchemaVersion>
    <SoftwareIdentity>
    <Name>IBM Workload Automation</Name>
    <PersistentId>3303c35cbc08435080502d621d5cdbff</PersistentId>
    <InstanceId>/opt/IBM/TWA</InstanceId>
    </SoftwareIdentity>' as xml
    UNION
    SELECT b.xml_metrics as xml
    FROM (SELECT '<Metric logTime="' + CONVERT(nvarchar(19), a.datetime, 126)
     + '+00:00">
    <Type>10_MONTHLY_JOBS</Type>
    <Value>' + CONVERT(varchar(10), a.JobNbr) + '</Value><Period>
    <StartTime>' + CONVERT(varchar(10), a.Year) + '-' + RIGHT('00' +
    CONVERT(varchar(2),
    a.Month), 2) + '-01T00:00:01+00:00</StartTime>
    <EndTime>' + CONVERT(varchar(10), a.Year) + '-' + RIGHT('00' + CONVERT(varchar(2),
    a.Month), 2) + '-' + a.LAST_DAY + 'T23:59:00+00:00</EndTime>
    </Period></Metric>'as xml_metrics
    FROM (SELECT Year, Month,
    CASE
    when Month = 2 then '28'
    when Month = 4 then '30'
    when Month = 6 then '30'
    when Month = 9 then '30'
    when Month = 11 then '30'
    else '31'
    end as LAST_DAY,
    (COUNT(*)+9)/10 AS JobNbr, SYSDATETIME() as datetime,
    CONVERT (date, SYSDATETIME()) as cdate,
    CONVERT (time, SYSDATETIME()) as ctime
    FROM (SELECT distinct year(Job_run_date_time) AS Year,
    month(Job_run_date_time) AS Month, day(Job_run_date_time) AS day,
    Job_stream_wks_fol_name, Job_stream_wks_name_in_run,
    Job_stream_folder_name, Job_stream_name_in_run,
    Job_name_in_run
    FROM MDL.JOB_HISTORY_V
    WHERE Job_status='S' and Workstation_license_type='J' and
    --((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- Actual_wks_folder_name_in_run = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND Actual_wks_folder_name_in_run = '/FOL_WKS2/')) AND
     not exists (select 1 from MDL.WKS_WORKSTATIONS W JOIN MDL.FOL_FOLDERS F ON
    W.FOL_ID=F.FOL_ID where W.WKS_AGENT_TYPE='E' AND
    Actual_wks_folder_name_in_run = F.FOL_PATH AND
    Actual_workstation_name_in_run = W.WKS_NAME)) r
    GROUP BY Year, Month) a) b
    ORDER BY xml desc
The following example shows a license metric tag file with the 10 monthly jobs that ran in your environment:
<SchemaVersion>2.1.1</SchemaVersion>
<SoftwareIdentity>
<Name>IBM Workload Scheduler</Name>
<PersistentId>3303c35cbc08435080502d621d5cdbff</PersistentId>
<InstanceId>/opt/IBM/TWA</InstanceId>
</SoftwareIdentity>
<Metric logTime="2019-04-09T16:07:20+00:00">
<Type>10_MONTHLY_JOBS</Type>
<Value>2</Value>
<Period><StartTime>2019-03-01T00:00:01+00:00</StartTime>
<EndTime>2019-03-31T23:59:00+00:00</EndTime></Period>
</Metric>
<Metric logTime="2019-04-09T16:07:20+00:00">
<Type>10_MONTHLY_JOBS</Type>
<Value>22</Value>
<Period><StartTime>2019-02-01T00:00:01+00:00</StartTime>
<EndTime>2019-02-28T23:59:00+00:00</EndTime></Period>
</Metric>

Queries to verify the number of jobs you run every month

An SQL query is provided that accesses the job history in the database to verify the number of jobs that you run every month in your environment. The job runs calculated with this query are not grouped in groups of 10 as with the previous queries, but are instead, the total number of jobs that ran.

You can run the SQL query either from the command-line interface of your database, or by creating your custom SQL report tasks from the Dynamic Workload Console.

  • For DB2 database type:
    SELECT Year, Month, count(*) AS JobNbr from
    (SELECT unique year(Job_run_date_time) AS Year,
    month(Job_run_date_time) AS Month, day(Job_run_date_time) AS day,
    JOB_STREAM_WKS_FOL_NAME, JOB_STREAM_WKS_NAME_IN_RUN,
    JOB_STREAM_FOLDER_NAME, JOB_STREAM_NAME_IN_RUN,
    JOB_NAME_IN_RUN
    FROM MDL.JOB_HISTORY_V
    WHERE Job_status='S' and Workstation_license_type='J' and
    -- ((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and
     (Actual_WKS_FOLDER_NAME_IN_RUN, Actual_workstation_name_in_run) not in
    (select FOL_PATH, WKS_NAME from MDL.WKS_WORKSTATIONS W JOIN MDL.FOL_FOLDERS
    F ON W.FOL_ID=f.FOL_ID where W.WKS_AGENT_TYPE='E'))
    GROUP BY Year, Month
    
  • For ORACLE database type:
    SELECT Year, Month, cast (count(*) AS INT) AS JobNbr from
    (SELECT unique EXTRACT(year FROM Job_run_date_time) AS Year,
      EXTRACT(month FROM Job_run_date_time) AS Month,
      EXTRACT(day FROM Job_run_date_time) AS Day,
      JOB_STREAM_WKS_FOL_NAME,
      JOB_STREAM_WKS_NAME_IN_RUN,
      JOB_STREAM_FOLDER_NAME,
      JOB_STREAM_NAME_IN_RUN,
      JOB_NAME_IN_RUN
      FROM JOB_HISTORY_V
      WHERE Job_status='S' and Workstation_license_type='J' and
    -- ((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND
    -- ACTUAL_WKS_FOLDER_NAME_IN_RUN = '/FOL_WKS2/')) and
     (Actual_WKS_FOLDER_NAME_IN_RUN, Actual_workstation_name_in_run) not in
      (select FOL_PATH, WKS_NAME from WKS_WORKSTATIONS W JOIN FOL_FOLDERS F ON
    W.FOL_ID=f.FOL_ID where W.WKS_AGENT_TYPE='E'))
    GROUP BY Year, Month
    
  • For MSSQL, Azure SQL, and Google Cloud SQL for SQL server database types:
    SELECT Year, Month, count(*) AS JobNbr from
    (SELECT distinct year(Job_run_date_time) AS Year, month(Job_run_date_time) AS Month,
    day(Job_run_date_time) AS day, Job_stream_wks_fol_name,
    Job_stream_wks_name_in_run, Job_stream_folder_name,
    Job_stream_name_in_run, Job_name_in_run
    FROM MDL.JOB_HISTORY_V
    WHERE Job_status='S' and Workstation_license_type='J' and
    --((Actual_workstation_name_in_run = 'WKS_NAME1' AND
    -- Actual_wks_folder_name_in_run = '/FOL_WKS1/') OR
    -- (Actual_workstation_name_in_run = 'WKS_NAME2' AND
    -- Actual_wks_folder_name_in_run = '/FOL_WKS2/')) AND
    not exists (select 1 from MDL.WKS_WORKSTATIONS W JOIN MDL.FOL_FOLDERS F ON
    W.FOL_ID=F.FOL_ID where W.WKS_AGENT_TYPE='E' AND
    Actual_wks_folder_name_in_run = F.FOL_PATH AND
    Actual_workstation_name_in_run = W.WKS_NAME)) r
    GROUP BY Year, Month
    
    
Note:
  • All jobs processed or managed by IBM Workload Scheduler are counted, but the same job counts once if repeated more than once during the same day. To meet this requirement and be considered as the same job, jobs must contain the same jobstream_workstation_name, jobstream_name and job_name strings and not run on a remote engine.
  • The SQL queries select only jobs that run successfully. The SQL queries do not count shadow jobs, jobs that run on agent for z/OS, and rerun jobs.