Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 9th October 2008, 11:55
bilmaa bilmaa is offline
Member
 
Join Date: Jul 2004
Location: Spain
Posts: 84
bilmaa is on a distinguished road
Baan: baan iv c4 sp20 - DB: oracle 10G - OS: win 2003
Lightbulb Ftp
Baan: Baan IVc4
C/S: Client

I need to create one ftp conection, and use the ftp command.
the scrip is this:
Code:
    ret_val = ftp.init()
    if (ret_val = 0) then
        Ftp.Connect("hostname", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.login("user","password",connection)
    endif
when the program call "ftp.connect" the conectión with bshell is broken and
in the Event viewer appear this:

Env BaanIV (e:\baan)
Prog bshell file \general\lib\al_1\al_wutil.c # 607
Keyword Stack trace
Username esbaand type S language 5
Process 0x2924
Lasterror 0
Errno 0
bdberrno 509 (Bad memory cursor; bad table pointer specified)
Message Exception C0000005 (Access violation)
FtpConnect+D3 (1:000fc2e3)
1:000cc6bf
1:00090995
1:00000998
1:000f82a9
ProcessIdToSessionId+209 (1:0002e23b)

what`s the solutión to this error?????

thanks in advantage.

Last edited by george7a : 9th October 2008 at 12:38. Reason: add code tags
Reply With Quote
  #2  
Old 9th October 2008, 19:34
_Ralph_'s Avatar
_Ralph_ _Ralph_ is offline
Senior Member
 
Join Date: Oct 2006
Location: Brazil
Posts: 209
_Ralph_ is on a distinguished road
Baan: LN 6.1 - DB: DB2 - OS: Unix
"hostname" anb connection are arguments.

You must specify then before call the function...

something like

Code:
ret = ftp.connect("100.0.50.125", connection)
or


Code:
string hostname

hostname = "ftp.baan.com"

ftp.connect(hostname, connection)
Reply With Quote
  #3  
Old 9th October 2008, 22:20
_Ralph_'s Avatar
_Ralph_ _Ralph_ is offline
Senior Member
 
Join Date: Oct 2006
Location: Brazil
Posts: 209
_Ralph_ is on a distinguished road
Baan: LN 6.1 - DB: DB2 - OS: Unix
Ftp Functions Exemple

The most recent Programmers Guide do not have this functions related

Extracted From:
Title Infor ERP LN 6.1 Programmers Guide
Version 7.6.0 2453
Publication date 9/26/2007 9:23:23 PM

Next code is a sample about how to connect to a remote host.
Code:
function void main()
{
    long ret_val
    long connection
    long secondconnection
    string response(500)

    | all next functions return 0 upon success, non-zero on
failure.
    | the connection identifier, retrieved during ftp.connect need
to be used in every subsequent call to an ftp function
    
    | provided functionality by ftp deamon varies per platform,
e.g. some commands are not understood, or ascii transfer of files
is not possible
    | you have to find out yourself what the ftp daemon provides as
functionality.
    | ftp.last.response usually tells a detailed cause for a
problem.

    | ftp.init function need to be called before any other ftp
function, otherwise the other ones will fail.
    ret_val = ftp.init()
    if (ret_val = 0) then
        ret_val = ftp.connect("hostname", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.login("anonymous","yourmailddress",
connection)
    endif

    | open a second connection
    if (ret_val = 0) then
        ret_val = ftp.connect("otherhostname", secondconnection)
    endif

    if (ret_val = 0) then
        ret_val = ftp.last.response(secondconnection, response)
    endif

    if (ret_val = 0) then
        ret_val = ftp.quit(secondconnection)
    endif

    | errorneous calls (connection is already closed, but bshell
should be able to handle this)
    if (ret_val = 0) then
        ret_val = ftp.quit(secondconnection)
    endif

    if (ret_val = 0) then
        ret_val = ftp.last.response(secondconnection, response)
    endif

    if (ret_val = 0) then
        | continue with first connection
        ret_val = ftp.chdir("pub", connection)
    endif

    if (ret_val = 0) then
        ret_val = ftp.mkdir("test", connection)
    endif

    | Check file.chmod for available mode flags
    if (ret_val = 0) then
        ret_val = ftp.chmod(S_IRWXU + S_IRWXG + S_IRWXO, "test",
connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    if (ret_val = 0) then
        ret_val = ftp.put("${BSE}/tmp/afile", "ftp.bc", FTP_BINARY,
connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    | retrieves dir/nlst from remote site and write output to file
(first argument)
    | note that current dir may be differ from user to user.
    if (ret_val = 0) then
        ret_val = ftp.nlst("dir.nlst", ".", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.dir("dir.dir", ".", connection)
    endif

    | when transferred from windows to unix, and now getting it in
ascii mode, you will get a cr/lf translated file
    if (ret_val = 0) then
        ret_val = ftp.get("${BSE}/tmp/afile.ftped", "afile",
FTP_ASCII, connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    if (ret_val = 0) then
        ret_val = ftp.rename("afile", "afile.renamed", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif
    if (ret_val = 0) then
        ret_val = ftp.del("afile.renamed", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    if (ret_val = 0) then
        ret_val = ftp.rmdir("test", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    | errorneous call
    if (ret_val = 0) then
        ret_val = ftp.rmdir("notexistingdir", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    if (ret_val = 0) then
        ret_val = ftp.chdir("..", connection)
    endif
    if (ret_val = 0) then
        ret_val = ftp.last.response(connection, response)
    endif

    | after quit, you need to setup a new connection.
    if (ret_val = 0) then
        ret_val = ftp.quit(connection)
    endif
}
Reply With Quote
  #4  
Old 19th May 2010, 16:37
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,933
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Cool - just had this thread pointed out to me. Needless to say the example posted by Ralph worked on my 4c4 system. Now I need to go see if the wiki has any help on these commands - could not find anything on my system.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #5  
Old 15th September 2015, 08:07
ashu2814's Avatar
ashu2814 ashu2814 is offline
Member
 
Join Date: Feb 2008
Posts: 69
ashu2814 is on a distinguished road
Baan: Baan 6.1 - DB: sql - OS: win2003
Hi,

I am able to transfer the file by using your code . The file is getting transferred but with 0 bytes.
What can be the possible error?

Regards,
Ashutosh
__________________
Regards,
ashu2814
Reply With Quote
Sponsored Links
  #6  
Old 15th September 2015, 08:48
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,322
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

It might be the permissions issue. Check the source file name permission.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #7  
Old 16th September 2015, 10:06
ashu2814's Avatar
ashu2814 ashu2814 is offline
Member
 
Join Date: Feb 2008
Posts: 69
ashu2814 is on a distinguished road
Baan: Baan 6.1 - DB: sql - OS: win2003
Hi,

I can do it manually with same permissions.

Is there some problem in my code?

ret_val = ftp.put("sourcepth/aa.txt",
"targetpath/aa_1.txt", FTP_BINARY, remote.connection)
__________________
Regards,
ashu2814
Reply With Quote
  #8  
Old 11th May 2016, 14:31
kruyoupatel kruyoupatel is offline
Junior Member
 
Join Date: Aug 2012
Posts: 23
kruyoupatel is on a distinguished road
Baan: BaanIV - DB: informix - OS: ms-win\
Hello Guys,

The FTP functions mentioned above all worked for me for single file knowing filename.

But, is there other functions to fetch one by one file from a directory.

Like there is "dir.entry" for Baan server directory.

This function fetches the filenames and the return value with the help of which we can loop in directory.

Also please mention where did you find this functions(including above all), because I did checked Programmers Guide 6.1 ver 7.6.0 but did not find any functions in it.
Reply With Quote
  #9  
Old 12th October 2016, 16:17
adapalak adapalak is offline
Junior Member
 
Join Date: Aug 2014
Posts: 10
adapalak is on a distinguished road
Baan: fp7 - DB: oracle - OS: windows
Hi
I am using FP7 i want to transfer the file to an sftp location which has password and user name.
How to transfer it
In the baan board i had seen function like ftp.connect etc
to use this what macros or #inclides<> do i need to use
any other way to transfer the files

Thanks and Regards,
Karthik
Reply With Quote
  #10  
Old 12th October 2016, 16:57
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,933
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
No specific includes I am aware of - the one time I tested it I only see ottdllbw. For connecting see the ftp.login statement by ralph. Another way to do this is to write a OS script to do the FTP and then just execute the script.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #11  
Old 12th October 2016, 17:37
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,322
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
The FTP functions are depreciated and also, they used to support FTP protocol only AFAIK.

As Mark already suggested, you can build a utility on your own using a bat file + winscp combination which will do the task.

Here is a link which might get you going.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #12  
Old 13th October 2016, 08:37
günther günther is offline
Guru
 
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 573
günther is on a distinguished road
Baan: IVc4 - DB: Informix - OS: HP-UX
Hi friends.

I agree that it's cool to have such functions even on Baan IV. BUT: In our company it's strictly forbidden to use ftp for new development, because this protocol is damned old, unsave, transfers Passwords and data in plain text and so on. We have to use sftp instead.

Regards
Günther

Last edited by mark_h : 13th October 2016 at 14:48. Reason: little editing for general public
Reply With Quote
  #13  
Old 13th October 2016, 14:49
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,933
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Agreed Gunther. We have to use sftp also.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is Better FTP (Standard Cost ) Or FIFO sharry66 Blogs and Web links 1 8th October 2008 07:25
FTP Session in Baan (ftp the file from Baan to External Server) mraguthu Tools Development 6 22nd April 2007 11:43
FTP in windows NT chilloutdude Tools Development 2 21st May 2002 09:54
DBsync gets ftp errors joergm Baan CRM & Front-Office 2 13th February 2002 10:37


All times are GMT +2. The time now is 17:28.


©2001-2017 - Baanboard.com - Baanforums.com