Mapping new drieve

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
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Mapping new drieve

Post by SWW »

Hey,

Below is coding that I have in a control job. It is suppose to map a remote drive so I can get and copy files from the remote (I use a batch script and parmeters).

As you can see from the error at the very bottom of this post that it does not recognize the drive. I have the drive mapped on the server and the server (which has the DS software) recognizes the drive. How do I get the job to recognize the drives? The coding below has worked in the past, but now I'm trying to map new drives.

Any suggestions!!

Thanks in advanced.

Steve


CODING IN CONTROL JOB
*Map remote network drive so we can copy files to local drive
Call DSLogInfo("Mapping to remote network server drive K", "Job Control")
Call DSExecute("NT", "net use K: \\SecureFtp\FTP Tote ", msgs, rtncd )
Call DSLogInfo("msgs is ":msgs, "Job Control")
Call DSLogInfo("rtncd is ":rtncd, "Job Control")
if rtncd = 2
then
Call DSLogInfo("Drive already mapped, continuing on with job", "Job Control")
end
else
Call DSLogInfo("Successfully mapped drive", "Job Control")
End


MESSAGE FROM THE LOG
Message:
CTRL_JOB_EQU_FTP..JobControl (Job Control): msgs is K: has a remembered connection to \\Secureftp\FTP TOTE. Do you
want to overwrite the remembered connection? (Y/N) [Y]:
No valid response was provided.



MESSAGE FROM LOG
Message:
CTRL_JOB_EQU_FTP..JobControl (Job Control): msgs is 1
New connections will be remembered.



Status Local Remote Network


-------------------------------------------------------------------------------
Unavailable F: \\sps\united Microsoft Windows Network
Unavailable G: \\sps\datawhse Microsoft Windows Network
Unavailable H: \\Airacct\Tote Microsoft Windows Network
Unavailable I: \\Swilbert\SteveWCD Microsoft Windows Network
Unavailable J: \\Sps\Datawhse\ToteSettlementProduction
Microsoft Windows Network
Unavailable K: \\Secureftp\FTP TOTE Microsoft Windows Network
Unavailable L: \\Swilbert\LACIE (E) Microsoft Windows Network
Unavailable R: \\emperor\groups Microsoft Windows Network
The command completed successfully.


The system cannot find the drive specified.
2
SWKYDERBY
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: Mapping new drieve

Post by ogmios »

The net use apparantly wants to ask you some extra questions, which don't get answered now. This would be a bit harder to script.

Try using the option "/persistent:no" in net use, or "delete" the shared drive before mapping it.

Personally I don't like mapping drives from within jobs, it makes problem solving very hard if you do this a lot.

Ogmios
In theory there's no difference between theory and practice. In practice there is.
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Post by SWW »

Is this how the coding should look?

Does it matter that part of the path has a space "FTP TOTE" instead of "FTPTOTE"?

Call DSExecute("NT", "net use K: \\Secureftp\FTP TOTE /PERSISTENT:NO", msgs, rtncd)

Thanks.
SWKYDERBY
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Post by SWW »

When using that coding this is the error that I get. Any suggestions?


CTRL_JOB_RGS..JobControl (Job Control): msgs is System error 1202 has occurred.


An attempt was made to remember a device that had previously been remembered.

Thanks
SWKYDERBY
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

SWW wrote: An attempt was made to remember a device that had previously been remembered.
This has nothing to do with DataStage but with net use. First try to get what you want do in a DOS box on your server just by typing in the "net use" commands.

Try this http://www.microsoft.com/resources/docu ... s/3844.asp

And yes spaces do matter, in your DOS box try to surround the path by double quotes (").

Ogmios
In theory there's no difference between theory and practice. In practice there is.
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Post by SWW »

Thanks for the input, I was starting to go crazy!
SWKYDERBY
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

If you get the "net use" to work outside of DataStage you can add a " to your command in DataStage using CHAR(34).

Code: Select all

Call DSExecute("NT", "net use K: " : CHAR(34) : "\\Secureftp\FTP TOTE" : CHAR(34) : " /PERSISTENT:NO", msgs, rtncd)
Ogmios
In theory there's no difference between theory and practice. In practice there is.
datastage
Participant
Posts: 229
Joined: Wed Oct 23, 2002 10:10 am
Location: Omaha

Post by datastage »

SWW wrote:Is this how the coding should look?

Does it matter that part of the path has a space "FTP TOTE" instead of "FTPTOTE"?

Call DSExecute("NT", "net use K: \\Secureftp\FTP TOTE /PERSISTENT:NO", msgs, rtncd)
I'm not sure I can completely help you on this problem, but a few things caught me eye. Here is your original and updated syntaxes:

Call DSExecute("NT", "net use K: \\SecureFtp\FTP Tote ", msgs, rtncd )

Call DSExecute("NT", "net use K: \\Secureftp\FTP TOTE /PERSISTENT:NO", msgs, rtncd)


1) The first time you had a space after the folder name FTP Tote and before the ". It's possible the trailing space caused an issue.

2) I don't think case sensitivity is an issue, but for sanity's sake I put it in the job control exactly as you see it in Windows Explorer. You switched from FTP Tote ot FTP TOTE.

3) As for you question about the space between FTP TOTE versus FTPTOTE it depends on whether the folder name really has a space there, if it does you need the space, but with the /PERSISTENT option you probably need some sort of identifier around FTP TOTE to it knows the space is part of the folder name and not a break in the command, possibly 'FTP TOTE' but I'm not sure what NT wants there.

4) I must admit I'm not familiar with the net use command, but I'm wondering if maybe the space after the K: is a problem as well, perhaps the command just looks for a single character and : and takes what is after that as the path to map the drive letter to and doesn't want a space there.


Hope this helps..
Byron Paul
WARNING: DO NOT OPERATE DATASTAGE WITHOUT ADULT SUPERVISION.

"Strange things are afoot in the reject links" - from Bill & Ted's DataStage Adventure
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Post by SWW »

Thanks for all the input. ogmios code with the CHAR(34) worked. The job was successful.

Thanks Again!!
SWKYDERBY
Post Reply