[ctmcreate] Embedded Script

All questions about Control-M jobs definitions
Post Reply
User avatar
largonir
Nouveau
Nouveau
Posts: 2
Joined: 11 Apr 2011 12:00

[ctmcreate] Embedded Script

Post by largonir » 11 Apr 2011 4:32

Hi guys,

I succeeded to create a Job with Control M- Desktop using an "Embedded Script" (after checking the box and edit my command).
It works perfectly : I can define my own "Job name" and "File Name".

But I intend to create the same job via the ctmcreate command : this job would use the -EMBEDDED_SCRIPT.
My command line is, as instance :

Code: Select all

ctmcreate -TASKTYPE JOB -JOBNAME TEST -EMBEDDED_SCRIPT "/tmp/bar/foo"
The return is :

Code: Select all

ctmcreate -TASKTYPE JOB -JOBNAME TEST -EMBEDDED_SCRIPT "/tmp/bar/foo"
Output:
cannot open '/tmp/bar/foo' file. rc = 2
usage: ctmcreate
  -TASKTYPE       <JOB>
  [ -GROUP          <group> ]
  [ -APPLICATION    <applic> ]
  [ -DEBUG        <debug> ]
...
...
The problem is that the file exists and its rights are 777 ...


Thank you for your help..!

User avatar
largonir
Nouveau
Nouveau
Posts: 2
Joined: 11 Apr 2011 12:00

Post by largonir » 14 Apr 2011 6:02

No one to help me ?

User avatar
matom
Nouveau
Nouveau
Posts: 37
Joined: 29 Nov 2006 12:00
Location: Ile de France

Post by matom » 19 Apr 2011 4:11

Hi,

Try "ls /tmp/bar/foo"

Your command works :
ctrlm640 [15] ls -ltr /tmp/mm*
-rwxr----- 1 ctrlm640 controlm 23 Apr 19 15:59 /tmp/mm.ksh
ctrlm640 [16] ctmcreate -TASKTYPE JOB -JOBNAME TEST -EMBEDDED_SCRIPT "/tmp/mm.ksh"
new ORDER created, orderid:0004xa(6382) for JOBNAME=TEST.



Regards

User avatar
nicolas_mulot
Nouveau
Nouveau
Posts: 149
Joined: 07 Jan 2010 12:00

Post by nicolas_mulot » 22 Apr 2011 3:16

Largonir,

The problem is that ctmcreate does not work exactly like a job creation under Desktop.

When defining your job under Desktop, you may either edit your entire script, or load it (bottom left of the edit windows) from a file. This last option implies that your script resides in the neighbourhood of your desktop session.
When creating it using ctmcreate, the EMBEDDED_SCRIPT option will allow you to edit the script once the job has been ordered, but it is only equivalent to the “Load from file” option.
It does not allow you to enter a list of commands, which would make a script, as you can do under Desktop.

This implies that your script file must reside in the neighbourhood of the ctmcreate itself. In that case, one can question the interest of using the EMBEDDED_SCRIPT option. A regular job would do the same, with the same constraints.

Cheers
Nicolas Mulot

User avatar
felix_clerc
Nouveau
Nouveau
Posts: 6
Joined: 27 Dec 2007 12:00

Same problem - detailed resolution?

Post by felix_clerc » 21 Feb 2013 11:58

Hello,
I have the exact same problem as discussed here, but do not understand nicolas_mulot's answer.
What do you mean by "This implies that your script file must reside in the neighbourhood of the ctmcreate itself"?
I tried having the script in the same directory as teh ctmcreate executable, in /tmp, etc... even chmoded the script to 777 always the same result...
I then tried under Windows, again same result.
Could someone explain a bit how he went through this?
Thanks in advance,
Félix

User avatar
gglau
Nouveau
Nouveau
Posts: 317
Joined: 13 Jun 2007 12:00

Post by gglau » 21 Feb 2013 9:52

Did you invoke ctmcreate on CTM or on Agent?

Server utility invoked on Agent is actually executed at CTM. Agent UT process will connect with CTM to request for execution of utility and wait for output from CTM to be displayed at Agent.

When ctmcreate is executing at CTM, it expects the file to be a path local to CTM. The failure of "cannot open file", or to be exact "file not found" is because the utlilty is invoked at Agent with the file at Agent.

User avatar
felix_clerc
Nouveau
Nouveau
Posts: 6
Joined: 27 Dec 2007 12:00

Post by felix_clerc » 22 Feb 2013 1:58

@gglau: Thank you very much! I was doing my ctmcreate at the agent level, trying to embed a file on an agent's file system...
Once the file located on the CTM server, the command worked like a charm, and my job with embedded JCL has been created correctly.

I think this is not clearly indicated in BMC's documentation - or I shall have read it better...

Post Reply