Calling FTP script within DataStage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kvercruy
Participant
Posts: 6
Joined: Fri Jan 27, 2006 7:22 am

Calling FTP script within DataStage

Post by kvercruy »

Hi,

We have a problem using FTP in DataStage. We created a script that uses the .netrc file to connect automatically to a remote FTP server.

The macro definition creates a new directory on the FTP server and looks like:
macrodef ftpmkdir
mkdir newdir
bye

However, when executing a script in DataStage containing the following text:
echo "\$ ftpmkdir" | ftp servername

we receive the following output:
Name (main-labotest.vmm.be:dsadm): User dsadm cannot log in.
Login failed.

When executing this script in command line on the local server the script runs successfully.

Does anyone have some experience using FTP in DataStage (not using the FTP Stage)?

Kind regards,

Kristine
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

.netrc and macros can be disabled on the target server. If any shell script works at the command line and not within DataStage DSExecute or ExecSH is either a permissions problem or a environment variable issue. All DataStage jobs run as phantoms and do not execute the .profile so your UNIX environment is different. The .netrc is only for a specific user. If you want then post your whole shell script and please change the passwords and server names or ip addresses. Please use code tags before and after.
Mamu Kim
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Usually I prefer to build a FTP script on the fly and remove it after I'm done.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
wvandegaer
Participant
Posts: 8
Joined: Tue Dec 13, 2005 4:14 am

Script content

Post by wvandegaer »

kduke wrote:paste code
.netrc file

Code: Select all

machine [i]servername[/i]        
        login [i]login[/i]
        password [i]password[/i]

macdef ftpmkdir
        mkdir $1
        bye

macdef ftpremovedir
        rmdir $1
        bye
scriptfile mkdir.sh

Code: Select all

ftp [i]servername[/i]
$ ftpmkdir $1
DSExecute

Code: Select all

. /path/mkdir.sh [i]newdirectory[/i]
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

scriptfile mkdir.sh
ftp servername
$ ftpmkdir $1
Does not look right. What is the $ on line 2. In your first post you said this was the command:

Code: Select all

echo "\$ ftpmkdir" | ftp servername
If you can pipe into ftp then do the whole thing that way.

Code: Select all


ftp $1 <<!
user password
mkdir $2
bye
!

Mamu Kim
wvandegaer
Participant
Posts: 8
Joined: Tue Dec 13, 2005 4:14 am

It should work on both ways (AIX help)

Post by wvandegaer »

kduke wrote:scriptfile mkdir.sh
ftp servername
$ ftpmkdir $1
Does not look right. What is the $ on line 2. In your first post you said this was the command:

Code: Select all

echo "\$ ftpmkd ...[/quote]

the $ on line 2 points at the macrodef in out .netrc file in the home dir of the dsadm user

However it doesn't work on both ways:
1) "echo "\$ ftpmkd .."
2) ". mkdir.sh newdir" with within the script: ftp servername <enter> $ ftpmkdir $1 

Our AIX help does tell us that this are the two ways the automatic ftp-login / script should work.
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: It should work on both ways (AIX help)

Post by ogmios »

I would first make sure the script works outside of DataStage running under the user that would execute the DataStage job.

If you can get it to work like that the problem you're having with DataStage is an "integration" problem.

So can you already make it work outside of DataStage? If it doesn't it's probably more of an AIX support question.

Ogmios
In theory there's no difference between theory and practice. In practice there is.
Post Reply