Automic Workload Automation

 View Only
Expand all | Collapse all

How can I programmatically prompt a job's or script's JCL and edit it?

  • 1.  How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 09:53 AM

    Hi,


    What I am trying to accomplish involves having JOBS or SCRI in a "wait for manual release" state. Then, by opening the monitor of the JOBS/SCRI, you are prompted with the JCL of the process, which you can edit, save, and then "Release Manually" back from the Process Monitoring tab with the edited JCL. I want to be able to prompt up the JCL of a JOBS/SCRI programmatically in a PRPT, and then edit it, and then save and release from "wait for manual release" of that specific execution. Is there a way to do this via Java?

    Thanks!



  • 2.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 11:23 AM
    HI

    not sure if I understood your request completely..

    Whats wrong using a JOBS with a promptset - promting for the JCL?

    cheers, Wolfgang

    ------------------------------
    Support Info:
    if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
    Otherwise update/upgrade your system and check if the problem still exists.
    ------------------------------



  • 3.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 11:27 AM

    I'm trying to get a JOBS in a 'wait for manual release' state's JCL via Java, and I don't know how to do that. Once I get the JCL, I'm going to add that into a multiline-text field in a PRPT in the AWI. 

    After the JCL in the PRPT gets edited, I will use Java to set the edited JCL into the JOBS's monitor, and then release the job.




  • 4.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 11:33 AM
    When you say "JCL", are you referring to MVS operating system JCL (e.g. //STEP1 EXEC PGM1), or UC4 JCL which is a product of the UC4 task generate phase?

    If you are referring to UC4 JCL, then I would seriously question your solution design.  There are better ways to dynamically modify tasks.  But to be able to help you arrive at a better design, we would need to know more details about what you are trying to accomplish.

    ------------------------------
    Pete
    ------------------------------



  • 5.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 11:41 AM
    Edited by Andrei Gurau Feb 27, 2020 11:46 AM
    I'm talking about the UC4 JCL (not 100% certain). I'm trying to do something that has multiple steps. 

    The first step involves getting the JCL of a job in the 'waiting for manual release' phase. I know you can right click on the execution, and click 'Open Monitor' to prompt the JCL, which you can edit as if it were a Process. I'm trying to recreate this functionality programmatically.

    So I guess for starters, I need help trying to grab the JCL of an object via Java or Automic scripting


  • 6.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 02:08 PM
    I'm curious about the nature of the changes staff need to make to the JCL.  What types of things are they changing?

    Alternative process to consider:
    Could you turn on the "Generate at runtime" option so that the JCL is not generated in advance, and then alter the promptset inputs into the scripted process before the script has been generated?

    ------------------------------
    Pete
    ------------------------------



  • 7.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 27, 2020 02:33 PM
    Currently, users are unable to edit their own jobs in production, however, what we are trying to do is allow these users to edit their jobs for one execution via Execute Once and 'wait for manual release' with a change request. However, because they don't have access to Process Monitoring, they wouldn't be able to open the monitor for their execution. Hence that's why I need a way to programmatically retrieve the JCL.

    Also, we are using the RESTART_UC_OBJECT function to restart the job and wait for manual release programmatically, and we are looking for a way to edit this JCL programmatically as well. The RESTART_UC_OBJECT function will already generate the JCL once it's in the 'wait for manual release' step


  • 8.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 28, 2020 07:58 AM
    Hi Andrei,

    Just a very quick and dirty answer - haven't tested at all - did you have a look at

    Class JCL

    https://docs.automic.com/documentation/webhelp/english/AA/12.3/AE/12.3/API/index.html#

    I would tend to agree with what has already been said. Rather than edit the job's JCL and wait for manual release, why not identify which parts of this JCL should be variable and use a promptset to pass values on the fly?

    Best regards
    Antoine


  • 9.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 28, 2020 08:12 AM
    Also, rather than setting a manual release, why not have them start jobs in a queue with a "STOP" status or 0 available slots ?

    BR
    Antoine​


  • 10.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 28, 2020 01:17 PM
    Edited by Andrei Gurau Feb 28, 2020 01:29 PM
    I saw the JCL object class in the Java documentation, but do you know how I could grab the JCL of the object in Java? Because the constructor is taking in an XML, and I hope there's a way to get the JCL that's kinda like
    JCL jcl = execution.getJCL();​

    Also, rather than setting a manual release, why not have them start jobs in a queue with a "STOP" status or 0 available slots ?

    What do you mean by this? And is there a way to do this completely automated via a script or in Java? I'm fairly new to Automic so I'm not entirely sure what you mean


  • 11.  RE: How can I programmatically prompt a job's or script's JCL and edit it?

    Posted Feb 28, 2020 02:25 PM
    Edited by Pete Wirfs Feb 28, 2020 04:07 PM
    I suspect you don't know enough about the product to even know what you don't know, you know?

    The design concept you are working on; to make it easier for people to manipulate the process at the JCL level, is not a very wise approach.  We discourage manual manipulation of the JCL and we have never had a use-case that required it.  It would be very easy for a customer to create errors in the JCL, so it adds unnecessary risk!

    But to arrive at a more optimal design without JCL manipulation, an Automic solution expert would need to study and understand the entire application process.  I also recognize that you may have been stuck with making changes to a UC4 solution that was poorly designed from the beginning.  Poor designs are usually the hardest ones to work on.

    EDIT:
    Thought I should add that sometimes what looks like a poor design today is simply the best one could do under earlier versions of UC4.  New features are common.  For instance promptsets did not exist prior to V9.

    ------------------------------
    Pete
    ------------------------------



  • 12.  RE: How can I programmatically prompt a job's or script's JCL and edit it?
    Best Answer

    Posted Feb 28, 2020 02:32 PM
    Edited by Diane Craddock Mar 03, 2020 08:40 AM
    In concept, anything that needs to be changed in the JCL could be sourced from a variable in a promptset.  And then the customer would manipulate the value in the promptset before the object is restarted.

    For this concept to work, the task must have "generate at runtime" turned on.  This would cause it to re-build the JCL every time it runs, and therefore it would also pick up and apply changes that were made to the promptset variable.

    ------------------------------
    Pete
    ------------------------------