Пример #1
0
import mysql.connector
#Import the Z Open Automation Utilities libraries we need
from zoautil_py import MVSCmd, Datasets, Jobs
from zoautil_py.types import DDStatement
# Import datetime, needed so we can format the report
from datetime import datetime
# Import os, needed to get the environment variables
import os
import string
import time
#Take the contents of this data set and read it into content variables
USERID = os.getenv('USER')
hlq = Datasets.hlq()
print("running jobs for ", hlq)
damember = "%s.OUTPUT.SDSFDAS" % hlq
da_contents = Datasets.read(damember)
#ckmember="%s.OUTPUT.SDSFCKS" % hlq
#hc_contents = Datasets.read(ckmember)

now = datetime.now()
formatted_date = now.strftime('%Y-%m-%d %H:%M:%S')

#Submit the job
jclmember = "%s.JCL(SDSFJCL)" % hlq
jobid = Jobs.submit(dataset=jclmember)
while True:
    js = Jobs.list(job_id=jobid)[0]
    if (js["return"] != "?"):
        break
    else:
        print(js)
Пример #2
0
#Import the Z Open Automation Utilities libraries we need
from zoautil_py import MVSCmd, Datasets
from zoautil_py.types import DDStatement
# Import datetime, needed so we can format the report
from datetime import datetime
# Import os, needed to get the environment variables
import os

#Take the contents of this data set and read it into cc_contents
cc_contents = Datasets.read("MTM2020.PUBLIC.CUST16")

USERID = os.getenv("USER")
output_dataset = USERID + ".OUTPUT.CCINVALD"
#Delete the output dataset if it already exists
if Datasets.exists(output_dataset):
    Datasets.delete(output_dataset)

Datasets.create(output_dataset, "SEQ")

# Create a new SEQUENTIAL DATA SET with the name of output_dataset


#A function that checks to see if the number passed to it is even. Returns True or False (Boolean)
def is_even(num_to_check
            ):  # this is a function. num_to_check is what gets sent to it
    if ((num_to_check %
         2) == 0):  # a simple check to see if num_to_check is even.
        result = True  # We set result to True
        return result  # and then return it.
    else:  # if it isn't
        result = False  # set return to False
Пример #3
0
# Delete datasets if already exist
Datasets.delete("USR.MVSCMD.DFSORT.*")

# Create datasets
Datasets.create("USR.MVSCMD.DFSORT.MASTER", type="SEQ")
Datasets.create("USR.MVSCMD.DFSORT.NEW", type="SEQ")
Datasets.create("USR.MVSCMD.DFSORT.CMD", type="SEQ")
Datasets.create("USR.MVSCMD.DFSORT.MERGE", type="SEQ")

# Write command to USR.MVSCMD.DFSORT.CMD
Datasets.write("USR.MVSCMD.DFSORT.CMD", " MERGE FORMAT=CH,FIELDS=(1,9,A)")

# Write example text to USR.MVSCMD.DFSORT.MASTER
Datasets.write("USR.MVSCMD.DFSORT.MASTER", "Chang Joe 278 232 6043")
Datasets.write("USR.MVSCMD.DFSORT.MASTER",
               "DeBeer Jo 348 132 6023",
               append=True)
Datasets.write("USR.MVSCMD.DFSORT.MASTER",
               "White Belinda 178 222 5043",
               append=True)

# Write example text to USR.MVSCMD.DFSORT.NEW
Datasets.write("USR.MVSCMD.DFSORT.NEW", "Doe Jane 878 222 5043")
Datasets.write("USR.MVSCMD.DFSORT.NEW", "Smith Joe 778 232 6043", append=True)
Datasets.write("USR.MVSCMD.DFSORT.NEW", "Smyth Jo 748 132 6023", append=True)

rc = MVSCmd.execute(pgm="sort", args="MSGPRT=CRITICAL,LIST", dds=dd_statements)

if rc == 0:
    print(Datasets.read("USR.MVSCMD.DFSORT.MERGE"))