ESP Workload Automation

 View Only
  • 1.  How to put ESP job on hold

    Posted May 12, 2020 09:13 AM
    How can I hold a ESP job using Python or mainframes, may I get the code or command related to it.


  • 2.  RE: How to put ESP job on hold

    Broadcom Employee
    Posted May 12, 2020 09:42 AM
    Hi, 
    Below are some notes. 
    If you are at ESP 11.4 the WEBPORT is the only option.  This is a port in the Workstation server. Let me know if you need help with this.
    I do not have a Python example but you should be able to modify the syntax from either the curl or Perl examples. 

    In the examples below substitute the command that is shown for an AJ(APPLJOB) command with the correct syntax. The link is below.  The difficult part is how to make sure that the job in the correct application generation is held.  This generation number could be passed down into the script.  
    https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/reference/commands/appljob-aj-command-control-applications.html


    curl 
    curl -X POST -u POWDO03:An0ther -i --basic --data '{"info":{"status":"req","cont":"eom","type":"command"},"data":{"request":"PASSWORD UPDATE USER(useridhere) PASSWORD(passwordhere)"}}' http://mainfame.xx.com:6167/command

    Perl
    #!/usr/bin/perl

    use LWP::UserAgent;
    use JSON;
    #use Data::Dumper;

    $ua = LWP::UserAgent->new;

    my $req = HTTP::Request->new(
    POST => 'http://system:6167/command');
    $req->authorization_basic('useridhere', 'passwordhere');
    $req->content_type('application/json');
    $req->content('{"info":{"status":"req","cont":"eom","type":"command"},"data":{"request":"AGENT - LIST"}}');
    my $res =
    my $res = $ua->request($req);

    my $result = decode_json($res->content);

    print "status " . $result->{'info'}->{'status'} . "\n" ;
    for $i ( 0 .. $#{$result->{'data'}->{'list'}} ) {
    print "$i " . $result->{'data'}->{'list'}[$i] . "\n" ;
    }

    print "\n";

    ********************************************************************************************************************
    Note:
    In ESP 12.0 there is a new restful interface but this functionality is not enabled yet. 

    Let me know if you have questions

    Don


  • 3.  RE: How to put ESP job on hold
    Best Answer

    Broadcom Employee
    Posted May 13, 2020 09:43 AM
    Hi, 
    Below is an example of a Perl script that HOLDs a job. 

    #!/usr/bin/perl

    use LWP::UserAgent;
    use JSON;
    #use Data::Dumper;

    $ua = LWP::UserAgent->new;

    my $req = HTTP::Request->new(
    POST => 'http://system.xx.com:6165/command');
    $req->authorization_basic('useridhere', 'passwordhere');
    $req->content_type('application/json');
    $req->content('{"info":{"status":"req","cont":"eom","type":"command"},"data":{"request":"AJ DPTST020 HOLD APPL(TEMPLATE.1381)"}}');
    my $res =
    my $res = $ua->request($req);

    #print $res->as_string;
    #print $res->content;
    #print $res->headers->server;
    #print Dumper $res;
    #print "\n";

    my $result = decode_json($res->content);

    print "status " . $result->{'info'}->{'status'} . "\n" ;
    for $i ( 0 .. $#{$result->{'data'}->{'list'}} ) {
    print "$i " . $result->{'data'}->{'list'}[$i] . "\n" ;
    }

    print "\n";


    ********************************

    Don


  • 4.  RE: How to put ESP job on hold

    Broadcom Employee
    Posted May 15, 2020 04:30 PM
    Hi, 
    Below is the Python version of the REST all to ESP. 
    #########################################################################

    import requests
    from requests.auth import HTTPBasicAuth

    data={
    "info":{
    "status":"req",
    "cont":"eom",
    "type":"command"
    },
    "data":{
    "request":"AJ DONJOB.TEST HOLD APPL(TEMPLATE.399"
    }
    }
    x = requests.post(
    url = "http://XX11.yy.address.com.net:6167/command",
    auth=HTTPBasicAuth('useridhere', 'password'),
    json=data
    )

    print(x.text)



  • 5.  RE: How to put ESP job on hold

    Posted May 15, 2020 05:35 PM
    Hi powell,

    I am getting Connection abrupt error after giving this code. my URL and credentials are correct. still I'm facing that connection issue.

    Thanks & Regards
    Kiran






  • 6.  RE: How to put ESP job on hold

    Broadcom Employee
    Posted May 15, 2020 05:56 PM
    Hi, 
    Is the port correct?  This should be the port number for the WEBPORT defined in the ESP Workstation parm member. The WEBPORT port number can be found by looking at the ESPWSS STC logs and looking for WEBPORT. 

     What happens when you put URL into the browser address field. It should return something like the line below. 
    {"info":{"status":"fail","type":"."},"data":{"status":405,"code":405001,"message":"Method not allowed. GET not supported."}}

    Let me know if that does not help
    2¢ 
    Don


  • 7.  RE: How to put ESP job on hold

    Posted May 15, 2020 06:21 PM
    Hi powell,

    I have a ques. So where we are giving the port number, in that python code.
    We are providing URL, USERID, PASSWORD, JOB NAME. these are the only fields we are working on wright.

    Could you be specific in that port concept. For my understanding purpose.

    Correct me if I am wrong.






  • 8.  RE: How to put ESP job on hold

    Broadcom Employee
    Posted May 18, 2020 08:57 AM
    Hi, 
    You need to contact the ESP administrator.  They will need to have the ESPWSS started task running and have a WEBPORT defined. They will be able to provide the port number.  The port number is probably between 1 and approximately 30,000. 

    Send the administrator the statement above.  They will let you know whether WEBPORT is defined and the port number. 

    Don