We have the need to capture the path from a text file once it is created by an ESP job and pass that path to the next job as an argument. Does anyone know of a good way to do this is ESP, I looked at TEXT_MON but don't see a way to capture the text string.
I am not sure I understand what you are asking.
Isn't the path aleady part of your TEXTFILE statement?
Can you post an excerpt of your TEXT_MON Workload Object?
Also please provide the target OS?
This is Windows, really don't have the TEXT_MON job setup yet just trying to see if it is possible to do this with TEXT_MON. Basically there will be a job to run a process in ESP, it creates a text file and in that text file it contains the dynamic path that need to be passed to the next job via args.
As a different thought. Could they create the file on the server with the name, instead of a file with the name inside? Then do a file trigger off the create. The name can be long. Something like the name below. Then add the https:\\ back in front and you have the full path.
The other method would be. This is not pretty or easy.....
JOB1) Process creates the file with the path inside
JOB2) Does an FTP to get the file.
JOB3) Read the file using some REXX. Store the path in a variable.
JOB4) Initiate the next job with the parameter.
I like Don's idea of making the file name out of the path, because then you should be able to take care of everything in the ESP PROC.
If that cannot be done I may have an alternate take on Don's "Other Method", but it would require the "Next Job" to be able to get the value of the path from and environment variable instead of a parameter.
Would that be possible?
If they cannot change the "Next Job" batch file, if you had access to the Windows server then this method would also work if you created a batch file to call "Next Job" batch file
Alternate Take (No FTP or REXX):
JOB2) ESP NT_JOB to get path from file and create file with variable to be sourced
JOB3) Initiate the next job with the ENVAR EWA_ENV_SRC_1 to source the file created aboveLet me know if you would like to pursue this method.
Thanks, I am going to check into Don's "Other Method" to see if it is possible, if not I'll have to look into the other options.
Thanks, I'll have to see if this is possible.
On the Agent side the information is in the transmitter.log and sent to the MF:
03/28/2018 08:22:46.342 EDT-0400 2 TCP/IP Controller Plugin.Transmitter pool thread <Slow:1>.CybTargetHandlerChannel.call[:780] - Message has been sent: 20180328 08094598+0400 ESPMSTD NT_WKSP000941F1 TEXTMON/TEXTMON.83/MAIN STATE COMPLETE SetEnd Status(Line 5) LStatus("Line 5:Dynamic Path=C:\Program Files\XYZ") Cmpc(0) Plugin(objmon) User(<Agent>) Host(<Host>)
In CSF on MF the STATUS field only contains the Line # of where the string is found, the information you want is in the LStatus field. It does not appear to be available in CSF.
Checking from Page Mode, both the List Application (LAP) and the LCSF commands do not have the value of the information available.
The information is available in the Job Output of the ESP Started Task:
08.22.46 WED 28MAR18 ESP6220I MgrMsg: NT_WKSP000941F1 TEXTMON/TEXTMON.83/MAIN STATE COMPLETE SetEnd Status(Line 5) LStatus("Line 5:Dynamic 08.22.46 WED 28MAR18 ESP6220I Path=C:\Program Files\XYZ") Cmpc(0) Plugin(objmon) User(<Agent>) Host(<Host>)
If you have OPS/MVS or other automation product could you key off of the ESP6220I message?
@Don/CA since the information is sent to the MF is there an easier method of getting it?
I need to set up a test but the command below may be able to get the LSTATUS value into a variable. This should be able to be put in the next job that needs the value. In the string below "JOB" below would be the name of the TEXT_MON job.
VAR1 = JOBDATA('JOB', 'LSTATUS').
Then VAR1 could be passed as the arg.
It does not appear to work for me.
I found the following in DocOps:
Note: If a variable that does not exist is requested, a null value is returned.
You can use the variable LSTATUS to retrieve the long status of SQL_JOB and DBSP_JOB
Does that mean this will not work on a TEXT_MON Workload Object?
I tried this but variable VAR1 is null so I'm thinking this does not work for TEXT_MON or I don't have something setup correctly.
TEXT_MON B35209_TEXT/*DELAYSUB 08:00AGENT WPVMESPAPPTST01TEXTFILE '/opt/ca/sharon.txt'TEXTSTRING 'agentparm' EXISTSEARCHRANGE LINE FROM(1)RELEASE ADD(B35209C)RUN DAILYENDJOB
UNIX_JOB B35209C AGENT WIL_VESPAPPTST01 VAR1 = JOBDATA('B35209_TEXT', 'LSTATUS') SE 'VAR1 = %VAR1' USER(B35209) USER causer ARGS %VAR1 SCRIPTNAME /home/causer/sharon.sh RUN DAILYENDJOB
JOB1) ESP NT_JOB to get path from file and create file with variable to be sourced
JOB2) Initiate the next job with the ENVAR EWA_ENV_SRC_1 to source the file created above
PROCEDURE_SECTION: APPL WINCMD
/* Replace <> with values for your environment. */ /* This will do the following: *//* WINCMD1 will search file for a string and create *//* and output file with an environment variable *//* WINCMD2 will source the environment variable */
/* in this example it just displays value, this */
/* would be replaced with your program */
AgentName = <Agent Name>
/* Command parts to eliminate continuation character */
C1='FOR /F "tokens=1,2 delims==" %A IN ' C2="('FINDSTR <Search Text> <Input File>') " C3='DO ECHO MyPath=%B > <Output File>' NT_JOB WINCMD1 AGENT %AgentName CMDNAME C:\WINDOWS\SYSTEM32\CMD.EXE /* Verify */ ARGS /c %C1%C2%C3 RUN ANYDAY RELEASE WINCMD2 ENDJOB NT_JOB WINCMD2 AGENT %AgentName CMDNAME C:\WINDOWS\SYSTEM32\CMD.EXE /* Verify */ ARGS /c "SET | FINDSTR MyPath" ENVAR EWA_ENV_SRC_1=D:\UPSData\ESP\MyPath.txt RUN ANYDAY ENDJOB
Just an update.
I was not able to get the LSTATUS to return provide the data. The manual shows this is only available for the SQL_JOB and DBSP_JOB job types.