set autodeit variables from unix node

All questions about Control-M jobs definitions
Post Reply
User avatar
supertramp
Nouveau
Nouveau
Posts: 1
Joined: 31 Jul 2008 12:00

set autodeit variables from unix node

Post by supertramp » 31 Jul 2008 4:25

Hi,
I want to run a unix script on a server that sets a variable based upon file content and sets an autoedit variables with this value, so ControlM can then execute subsequent jobs passing in the value.
The first and subsequent jobs are in different servers, neither of which is the ControlM server.

OK, after more digging, it seems ctmvar can be run on agent nodes and i believe so can LIBMEMSYM.

My plan is to get a Unix script to read a value from a file, edit a LIBMEMSYM value using sed and then possible specify LIBMEMSYM in an extra susequent job to read in the new value from this file ready for the following job to pass this value to the next script.
I have used the set tab to specify LIBMEMSYM but get the error..
LIBMEMSYM FILE /home/ascadm/nigelf/controlm/iobvar.txt NOT FOUND

I have also tried a PRECMD of /usr/local/ctmagent/ctm/exe/ctmvar -action set -var %%\NF3 -varexpr "300
and get the following error...
Var name 'CTMERRNF3' in -VAR invalid: it must begin with %%

Can anybody help me please,
thanks.
(ps ControlM is on a windows Server and all nodes are Unix).

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 01 Aug 2008 11:08

Hi

First, LIBMEMSYM can only run on your Control-M Server.

About ctmvar try this:

ctmvar -action set -var '%%\NF3' -varexpr '300'

User avatar
Darvedd
Nouveau
Nouveau
Posts: 9
Joined: 31 Jul 2007 12:00

Post by Darvedd » 04 Aug 2008 3:25

Your problem stems from trying to use a script to set the value of the variable directly.

In Unix, the Control-M Server starts a Control-M Agent shell session on the target host, which then runs the actual script (in a child shell session), and captures the sysout and the return code.

Any variable values exported by the actual script from the child shell only make it to the Agent's shell session (the parent shell) - they do not get returned back to the Control-M environment itself.

The only things returned from the Agent session to Control-M Server is the return code of the script and the sysout.

You must manipulate the required global variable from the Set or Post-Proc tabs of the job definition itself. In this case I think you'll want to use the Post-Proc tab.

User avatar
mauriziog
Nouveau
Nouveau
Posts: 807
Joined: 08 Jun 2007 12:00
Location: Varese - Italy
Contact:

Post by mauriziog » 06 Aug 2008 12:29

Any variable values exported by the actual script from the child shell only make it to the Agent's shell session (the parent shell) - they do not get returned back to the Control-M environment itself.
Darvedd,
using the ctmvar utility is possible to set a variable from the script to controlm environment. An important functionality...

User avatar
mauriziog
Nouveau
Nouveau
Posts: 807
Joined: 08 Jun 2007 12:00
Location: Varese - Italy
Contact:

Post by mauriziog » 06 Aug 2008 12:36

My plan is to get a Unix script to read a value from a file, edit a LIBMEMSYM value using sed and then possible specify LIBMEMSYM in an extra susequent job to read in the new value from this file ready for the following job to pass this value to the next script.
Is possible but consider that the file specified in the LIBMEMSYM must be on the CTM\server machine.
I use this for local variables, for global variable the use of the ctmvar is more flexible.
I suggest also to manage global variables deleting at the end of the day that not used.

Post Reply