ESP Workload Automation

 View Only
Expand all | Collapse all

ESPLMI and APPLINS Command

  • 1.  ESPLMI and APPLINS Command

    Posted Aug 23, 2019 03:45 PM
    Hello!

    We are building a self-service portal to give user the ability to run ADHOC jobs in non-prod.  We are using PowerShell to call esplmi and pass an applins command like this:  

    APPLINS APPL(ADHOCAPP.0) STATEMENTS( 'AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS;AGENT TESP500;SCRIPTNAME /tech/prod/scripts/ESPTST01;ENDJOB')

    However, when passing this in to esplmi as a parameter, the statements are split up seemingly because it doesn't 'like' the semi colons.

    We have reviewed the following community post:

    https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=732187#bma5b2edd0-4ca6-4904-895b-9df56cefb5ed

    However, since there were no details on how web services were used, and current documentation does not seem to have informaton on issueing commands, this was not helpful!

    Thanks!

    Jonathan


  • 2.  RE: ESPLMI and APPLINS Command

    Broadcom Employee
    Posted Aug 26, 2019 10:29 AM
    Hi Jonathan, 
    I read through the other link. 
    One suggestion was to update the ESPLMI command. I don't see that happening. 

    Some options. 
    1) The new REST interface would be the ultimate method.  That is only available in R12. 

    2) Issue a TRIGGER command and pass the values as USER() parameters.   

    Let me know if either of these seem like an option.  I may have "Missed the boat" 
    Don



  • 3.  RE: ESPLMI and APPLINS Command

    Posted Aug 26, 2019 11:53 AM
    The splitting up is being done by PowerShell ... not the ESPLMI command  ...  you either need to encapsulate the parameter with quotes(/double quotes) or escape the semi-colon ...  I have run into this with PowerShell before ...

    with the Rest-Method now available in ESP 12 ... there may be a better way to do this not having to use ESPLMI ... 

    I have done such adhoc job request but did not use ESPLMI ... but the ESPMGR command to call an open appl to trigger an event passing information via the USER fields.


  • 4.  RE: ESPLMI and APPLINS Command

    Posted Aug 26, 2019 01:40 PM
    ​All,

    We have R12 installed in our test invironment which is the target for this project.  However, when looking at the Rest-API documentation, it does not seem to include a way to issue page mode /line mode commands.  We would prefer this method.

    Thanks!

    <JC>


  • 5.  RE: ESPLMI and APPLINS Command

    Posted Aug 26, 2019 02:05 PM
    ​The splitting is not being done in PowerShell. Attempting to pass the command that Jonathan listed above as an argument to ESPlmi.exe via -c"command" returns: APPL(ADHOCAPP.0) STATEMENTS('AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS

    ESPWSS900I ENDING QUOTE ASSUMED, 'AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS

    -->AGENT+ TESP500

    ESPWSS101W INVALID COMMAND, AGENT+

    -->SCRIPTNAME /tech/prod/scripts/ESPTST01

    ESPWSS628W INVALID COMMAND NAME SYNTAX

    -->ENDJOB')

    ESPWSS101W INVALID COMMAND, ENDJOB')


    I can log in interactively via ESPlmi.exe and the statement passes without issue, but if you attempt to pass it as an argument/switch it fails. This occurs when using PowerShell or command prompt. I've attempted escaping the semicolons via ` or ^ for both and the same error is returned. Other commands appear to function, but they do not require a semicolon in the middle of the command.


  • 6.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 10:31 AM
    Tre,
       my experience with Powershell may be limited ... however when I needed to pass a semi-colon ... I needed to build that argument as a strict variable encapsulated with quotes ... then in my command string I reference the variable  ...  also in PowerShell the escape character is  a backslash ... so you should have been passing a "\;" to pass a semicolon ...  PowerShell attempts to try and figure out what you are doing but does always do what you want ...


  • 7.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 10:49 AM
    ​Nicolas,

    I appreciate the reply. I have a ton of PowerShell experience, but very little with ESP. The escape character for PowerShell is actually the grave character (`). If this was an issue with PowerShell, I'd receive an error indicating that the next part of that command was not recognized as a cmdlet, function, etc... I have tried a number of different characters (including backslashes) hoping to escape the semicolon that the executable is having an issue with, but we receive the same message from ESP. As a side note, I've tried passing this as an argument via command prompt (not PowerShell) as well and we receive the same message from that too. From what I can tell based on the documentation and everything I've tried, this appears to be a defect with the executable. But if anyone has any further suggestions, please let me know.


  • 8.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 12:06 PM
    Tre,
        thanks for your response ... and correction   :) ..   I did a little reading and how about using the "--%" after the ESPLMI to stop Powershell from parsing the string and send it to the command as one token ?


  • 9.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 12:51 PM
    Nicolas,
    Would you happen to have any examples of that in use? I tried adding that to the end of the statement and the end of the command with no success so far.


  • 10.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 01:55 PM
    here is the link I was reading https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1

    The stop-parsing symbol is effective only until the next newline or pipeline character. You cannot use a continuation character (`) to extend its effect or use a command delimiter (;) to terminate its effect.
    ----------------------
    icacls X:\VMS --% /grant Dom\HVAdmin:(CI)(OI)F

    PowerShell sends the following command string to the Icacls program:

    X:\VMS /grant Dom\HVAdmin:(CI)(OI)F

    -----------------------
    if you want an example of the ESPMGR command  I have a KORN shell script I wrote many years ago to do a do many of the functions using it ... 
    Actually had a long discussion with Ray Nissan (ESP originator) on why I used this command rather than ESPLMI (which was new at the time).  I could pass it along ...




  • 11.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 02:00 PM
    ​All,

    Any examples of using ESPMGR would be very helpful.  While we are developing in Windows, I'm sure we could "translate" the Korn shell script to suit our needs.

    Thanks!

    <JC>



  • 12.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 02:22 PM
    here is a sample of how I used the ESPMGR command ... not the environment variables I export at the top ... these are needed for the command to work ... it needs to know the details about the manger ... unlike the ESPLMI command ... you don't need an ID or Password coded ... it will run under the authority of the event ID ... so you control the access on MVS ... and you may need to use the MAPUSER command to map the server ID to the MVS ID.

    #!/bin/ksh
    
    # this is required for when the ESPmgr command is issued from the command line
    # and not part of an existing ESP managed script
    
    ESPAGENTDIR=/ESP_Agent/prod
    ESPAPPLMGR=ESP_MANAGER
    export ESPAGENTDIR ESPAPPLMGR
    
    EVENT=PRODID.USER_REQ_JOBS
    
    
    # user1 is set to the first arg. To TRACKING ID 
    USER4=$1
    # user2 is set to the second arg. To JOBNAME  
    USER1=$2	
    # user3 is set to the third arg. To Rundate
    USER2=$3
    # user4 is set to the forth arg. Time 
    USER3=$4
    # This is used to add a time stamp qualifier to the ESP WOB.
    QUAL=`date +%H%M%S`
    
    
    
    # This sets the job name to the clientid.
    JMFLINK=$USER4
    
    
    
    # Here the ESPmgr command is issued. The applname used is FTFAPPL. This man not
    # be the final production appl. For the ESPmgr command to work the FTFAPPL must
    # be opened on the ESP Queue.
    
    
    /ESP_Agent/prod/ESPmgr "$JMFLINK.$QUAL/FTFAPPL.0/main ACTION INSERT Type(LINK) Process LateEnd('now plus 5 min') Statements(ESP TRIGGER $EVENT USER1('$USER1') USER2('$USER2') USER3('$USER3') USER4('$USER4') cs)"



  • 13.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 02:10 PM
    Thanks for that link. I wish the issue was in PowerShell. There are tons of little tricks like this, but it's definitely an issue at the executable level. Regardless of how I call the executable, it splits all semicolons passed in an argument for the command. As we can verify by the response coming from ESP.


  • 14.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 03:00 PM
    Tre,
       I found an old ESPLMI document I have ... in it is an example of putting all the commands in a text file and then have the command read the input from the text file...  have you tried that? 

    esplmi -sHost:Port -uUserID -pPassword -c@Path




  • 15.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 03:07 PM
    Nicolas,
    I have and I get the same results unfortunately.


  • 16.  RE: ESPLMI and APPLINS Command

    Posted Aug 28, 2019 05:11 PM
    ​What is the resolved format that you're trying to send with 'AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS;'
    I'm more inclined to believe it has to do with the single dot after PORTALTST before a variable name than the semi-colon.
    Are you wanting PORTALTST.094020?   if so, use two dots   PORTALTST..%ESPAHH%ESPAMN%ESPASS;
    Are you wanting PORTALTST094020?  if so, then take out the dot  PORTALTST%ESPAHH%ESPAMN%ESPASS

    Worth a try, fingers crossed for you. Loraine


  • 17.  RE: ESPLMI and APPLINS Command

    Posted Aug 29, 2019 08:10 AM
    I'm receiving the same errors trying both unfortunately.


  • 18.  RE: ESPLMI and APPLINS Command

    Broadcom Employee
    Posted Aug 27, 2019 11:44 AM
    Agree, ESPMGR can also be used. It has ACTION INSERT to insert a job directly without triggering an event.


  • 19.  RE: ESPLMI and APPLINS Command

    Broadcom Employee
    Posted Aug 27, 2019 11:09 AM
    I tested with the interactive mode for ESPLMI utility, and the command below works fine:
    Note: I ONLY changed the application name and gen, and agent name.
    C:\agent>esplmi -sxxxx:8995 -uuser1 -pxxxx
    -->APPLINS APPL(ENCORE.90) STATEMENTS( 'AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS;AGENT LUCY1;SCRIPTNAME /tech/prod/scripts/ESPTST01;ENDJOB')APPLINS APPL(ENCORE.0) STATEMENTS( 'AIX_JOB PORTALTST.%ESPAHH%ESPAMN%ESPASS;AGENT LUCY1;SCRIPTNAME /tech/prod/scripts/ESPTST01;ENDJOB')

    And I can see the job was inserted from CSF:
    Job Name           ApplName Gen# 
    ___ CYBLZ        ENCORE    90 
    ___ PORTALTS ENCORE    90 

    So I wouldn't think there is any problem with the command, or with ESPLMI utility.

    Lucy




  • 20.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 11:14 AM
    I was also able to get this to work interactively. It only fails when being passed as an argument to the executable.


  • 21.  RE: ESPLMI and APPLINS Command

    Broadcom Employee
    Posted Aug 27, 2019 11:42 AM
    You are right, Tre. I overlooked your previous post.

    And the problem seems related to the semicolon in the job statements, which is considered as the end of the command.

    When use ESPLMI interactively, the whole string after '-->' is considered as ONE command.

    I can't find a way to get it around.

    As you may not know, ESPMGR utility can be used to insert a job too, maybe it can be used instead.

    Lucy





  • 22.  RE: ESPLMI and APPLINS Command

    Posted Aug 27, 2019 12:56 PM
    Lucy,

    Thank you for the follow-up. I'm not familiar with ESPMGR, so I've reached out to Jonathan to see how we can use that.


  • 23.  RE: ESPLMI and APPLINS Command
    Best Answer

    Posted Sep 26, 2019 11:11 AM

    Just to provide an update:

    We decided to pass the TRIGGER command instead of the APPLINS command when calling ESPLMI from powershell. Values for the job definition are passed to the USER fields and the corresponding event is triggered based on job type. Within the application there is a link workload object that uses the APPLINS command to insert the job definition in the latest generation of our ADHOCAPP application. See below example of the link workload object used for Unix job types:

    JOB ADHOCPTL LINK PROCESS
    RUN TODAY
    ESP APPLINS APPL(ADHOCAPP.0)+
    STATEMENTS('UNIX_JOB %USER1..%ESPATIME;+
    AGENT %USER2;+
    SCRIPTNAME %USER3;+
    USER %USER4;+
    ENDJOB')
    ENDJOB