TPT OS COMMAND OPERATOR ISSUE

Tools
Enthusiast

TPT OS COMMAND OPERATOR ISSUE

Hi All,

I have a TPT script which will export data from teradata to a file.

Once i load the file in a particular path in unix say example /dev/srcfiles/ i wrote the following operator to move to that particular directory and create a bkp file. My script is running in a different folder /dev/scripts/.

Issue is the the OS operator is not going to that directory where i need to create a bkp file but when i tried like 'cp /dev/srcfiles/test.txt /dev/srcfiles/test_bkp.txt' is working fine as a single command to OS.

I am trying to first set the directory where i need to create the bkp file and then execute the cp command.

PFB the code snippet of the operator i used:

DEFINE OPERATOR OS_OPERATOR

DESCRIPTION 'OS CMD OPERATOR FOR TPT'

TYPE OS COMMAND

ATTRIBUTES

(

VARCHAR PrivateLogName = 'OS_CMD_log',

VARCHAR ARRAY OsCmd = ['cd /dev/SrcFiles/','cp test.txt  test_bkp.txt'],

VARCHAR IgnoreError = 'NO'

);

STEP BACKUP_FILE

(

APPLY TO OPERATOR (OS_OPERATOR);

);

Thanks

1 REPLY
Teradata Employee

Re: TPT OS COMMAND OPERATOR ISSUE

"cd" will not work. There is no context when sending operating system commands.

The operator just issues the commands, but there is no shell from which these commands are being run or executed.

-- SteveF