Page 1 of 1

Retrieve information from a Pre job routine

Posted: Sun Jul 28, 2002 9:20 pm
by nilotpalr
Hi All,
I need to retrieve the timestamp associated with a file on my Unix system. I am aware of the Unix command that will give me the timestamp. This command i can use with ExecSh Prejob routine. But How do I store the result of this command in a variable. Urgent help is needed.
Thanks in advance..
Nilotpalr

Posted: Sun Jul 28, 2002 11:05 pm
by chulett
Probably should do it in a controlling batch job that then runs your job. The batch could take in the filename as a parameter, execute the Unix command on the file, retreive the result and pass it to your job as another parameter.

-craig

Posted: Sun Jul 28, 2002 11:29 pm
by nilotpalr
Probably should do it in a controlling batch job that then runs your job. The batch could take in the filename as a parameter, execute the Unix command on the file, retreive the result and pass it to your job as another parameter.

-craig
Ya that is the logic.. but how do i retrieve the information.. The prejob routine is returning only the status.. If it was success or failure and not the result. Ineed to store the result in a variable/parameter.. Pls suggest how..
thanks

Posted: Mon Jul 29, 2002 11:02 am
by chulett
One of the arguments of 'DSExecute' returns the output from your command. Here is a psuedo code snippet from one of my routines that executes a Unix command and then pulls the results (assuming a single returned row) into a variable:

FileCmd = "whatever you need executed"
Call DSExecute("UNIX",FileCmd,CmdOutput,CmdReturnCode)
If CmdReturnCode <> 0 Then
Call DSLogInfo(FileCmd, "ERROR")
Call DSLogWarn(CmdOutput, "ERROR")
[Do something appropriate here]
End
DesiredResult=CmdOutput<1>

There may be a better way, but this works for me. You could then use DSSetParam to pass the result on to a job.

HTH,

-craig