Home » Developer & Programmer » Forms » host procedure on 6i (limited characters on DOS)
host procedure on 6i [message #436816] Mon, 28 December 2009 11:53 Go to next message
marceloy
Messages: 11
Registered: December 2009
Location: Brazil
Junior Member
Hi everybody,

I've got a problem when I use the HOST procedure to work with DOS Prompt. When I access the DOS Prompt via Oracle Forms HOST Procedure, the name of files and folders got limited by 8 chars plus extension.
Lets suppose I want to copy a file and the file name is my_image.jpg. What I have to do is:

HOST('copy MY_IMA~1 C:\TEMP\IMAGE01');


I guess it sucks cause the function GET_FILE_NAME give me the filename as my_image.jpg.
Do I have to convert the filename every time?


Does everybody know a better way to this?


[]'s

[Updated on: Mon, 28 December 2009 12:01]

Report message to a moderator

Re: host procedure on 6i [message #436819 is a reply to message #436816] Mon, 28 December 2009 12:25 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Forms to test by myself, but - I guess it won't cost much if you try it.

How about such a workaround: create a DOS batch script (let's call it "cp.bat") with a simple copy command:
REM this is my "long file names" copy script

copy %1 %2

Now you'd call it from Forms as
host('cp.bat ' || first_file ||' '|| second_file);

In DOS, it would look like this:
C:\>cp a_long_file_name.txt short.txt

C:\>copy a_long_file_name.txt short.txt
        1 file(s) copied.

C:\>

What do you think?

[Updated on: Mon, 28 December 2009 12:26]

Report message to a moderator

Re: host procedure on 6i [message #436831 is a reply to message #436816] Mon, 28 December 2009 13:12 Go to previous messageGo to next message
marceloy
Messages: 11
Registered: December 2009
Location: Brazil
Junior Member
Nope, it didn't work.

The cp.bat file did exactly the same as the DOS copy command. The bat file recognized just the 8char files.


I don't understand, my XP prompt is working fine with long filenames. Why the host procedure on forms is doing wrong?



[]'s again
Re: host procedure on 6i [message #436838 is a reply to message #436831] Mon, 28 December 2009 14:37 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps you could build "cp.bat" during runtime; it is a simple batch file (copy one_file to_another_one) so it shouldn't be too difficult. Try with TEXT_IO. Once the batch file is done, execute it with HOST.
Re: host procedure on 6i [message #436841 is a reply to message #436838] Mon, 28 December 2009 17:46 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
I don't have forms either, but I have seen the same thing from other software that calls commands.

Two things that come to mind in that direction :

Is there a way to tell if the HOST command actually uses the cmd.exe shell or the command.com shell?

You could try putting the file names in double quotes. (which will then also handle files that have blanks in their names)
Re: host procedure on 6i [message #436895 is a reply to message #436816] Tue, 29 December 2009 07:14 Go to previous messageGo to next message
marceloy
Messages: 11
Registered: December 2009
Location: Brazil
Junior Member
I guess that's the point.

Even if a have XP on client and NT as server, the HOST procedure on Forms is loading command.com shell rather than cmd.exe shell. (1)

So, I tried the following syntax:

-- Open cmd, execute copy and then return to command.com shell
str := 'copy "long filename.jpg" "short.jpg" & exit | cmd'
host(str);


That code works fine when I execute on windows command.com prompt (Win+R), but when I run on Forms I got the message: "Too many parameters"


Any other idea?


PS. Double quotes didn't work.


(1) The documentation says that only Win95 loads command.com and NT would load cmd.exe (p. 253). I don't know why it's loading command.com.
Re: host procedure on 6i [message #437010 is a reply to message #436816] Wed, 30 December 2009 05:12 Go to previous messageGo to next message
marceloy
Messages: 11
Registered: December 2009
Location: Brazil
Junior Member
Hi there,

problem solved!!


I just had to use xcopy within the command.com shell .


str := 'xcopy "long filename.jpg" "new file.jpg"';
host(str);



Xcopy recognizes long filenames while it works with short ones.
And still, it works copying across network.


[]'s to all


Re: host procedure on 6i [message #437061 is a reply to message #437010] Wed, 30 December 2009 13:50 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, well ... who could guess?

Thank you for the feedback!
Re: host procedure on 6i [message #441003 is a reply to message #437061] Thu, 28 January 2010 05:41 Go to previous messageGo to next message
beginnerHere
Messages: 55
Registered: October 2009
Member
Hi,

I need a little help. I'm stuck with the same issue using the del command. Filenames or folder names of only 8 characters work.

eg I want to do HOST('DEL E:\NEW\NEWFILE108.TXT') and I'm unable to do that because of the above limitation.

I couldn't find any alternate command for del like for copy marceloy used xcopy.

Thanks in advance.

[Updated on: Thu, 28 January 2010 06:14]

Report message to a moderator

Re: host procedure on 6i [message #441023 is a reply to message #441003] Thu, 28 January 2010 06:26 Go to previous messageGo to next message
marceloy
Messages: 11
Registered: December 2009
Location: Brazil
Junior Member
I've got the same problem here ..

I cannot delete any file or folder whith the commands del or rmdir.
Re: host procedure on 6i [message #441035 is a reply to message #441023] Thu, 28 January 2010 06:42 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
which version you are using?
Please use/create your own thread.
don`t post in others.

sriram Smile
Re: host procedure on 6i [message #441041 is a reply to message #441035] Thu, 28 January 2010 07:03 Go to previous messageGo to next message
beginnerHere
Messages: 55
Registered: October 2009
Member
hi,

Sorry, but I thought that since I have nearly the same problem as marceloy, I should post here. I thought maybe if I create a new thread then I might get some objection that I created a thread already discussed. My issue is with the same host procedure, giving me, atleast, the impression that I should post in this same thread if I want to get a quick efficient response. Anyhow, my apologies.

I'm using Forms 6i just the same as marceloy. The issue is with the host command just as marceloy did, but the only difference is that I have issues with the del command's usage within the host command.

By the way marceloy your feedback really helped me with copying files by using xcopy. Thanks.

Regards.

[Updated on: Thu, 28 January 2010 07:11]

Report message to a moderator

Re: host procedure on 6i [message #441084 is a reply to message #441041] Thu, 28 January 2010 10:26 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
LOL, you're probably right; if you opened a new topic, you'd probably get the answer saying "Search". As far as I'm concerned, I don't mind you posting here. Moreover, it seems that @marceloy suffers from the same illness called 8+3, but this time while trying to delete a file.

I'm sorry, but I don't know the answer. All I had to say has already been said. Hopefully, you'll find a way, both of you.
Re: host procedure on 6i [message #441127 is a reply to message #441084] Thu, 28 January 2010 22:49 Go to previous messageGo to next message
beginnerHere
Messages: 55
Registered: October 2009
Member
Thanks Littlefoot. If I find anything I'll definitely post the solution.
Re: host procedure on 6i [message #445465 is a reply to message #441127] Tue, 02 March 2010 00:20 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Sorry that I have been so long in replying. Have you solved your problem?

You may have to do something very ugly like direct the output of two 'dir' commands, one with long names and the other with 8.3 names, to flat files then try and match them by size and date/time.

David
Re: host procedure on 6i [message #445809 is a reply to message #445465] Thu, 04 March 2010 04:09 Go to previous message
lancer26
Messages: 52
Registered: May 2006
Location: Pakistan
Member

hi,
you can also try "WIN_API_UTILITY.DELETE_FILE" procedure from d2kwutil library.
Previous Topic: What is the Difference between 1). Pre-form and 2) When-new-form-instance
Next Topic: Tree Form
Goto Forum:
  


Current Time: Thu Dec 08 00:40:33 CST 2016

Total time taken to generate the page: 0.12323 seconds