As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I'm trying to ftp a file from a UNIX box to a Windows box from within a FEX. Code seems simple but does not work. It seems I'm logged into the remote box based upon the 'Connected' message but it is still prompting for the user/pw. Note: the abcd1234 box contains a virtual IIS directory (report_ftp) that points to the final destination box where remotefile1.xht will reside.
I don't know what that syntax is above. Can you just stack the windows userid and password on separate lines in your script as replies to prompts like you have with the other ftp commands. Not very secure but .....
I think I know why your code is not working. Every time you do a -UNIX or ! command, you shell out to the operating system. That worked great for the first command. Then you come back to the fex and issue another command to shell out again. But it is different.
It would probably be better if you put the ftp commands in a script file and just execute the script file from the focexec. That way you'd be going out to Unix just once, execute all the commands and then come back to the fex.
Also did you know that you can do ftp from Report Caster.
And lastly, please update your profile signature to indicate your product suite, releases, and platform so that we can better help you.
Here is a command that one of my users has in her focexec:
!/WebFOCUS/ibi/apps/sf_script/dl_sdays2.ksh
I don't know if that is what you are looking for.
Another thing I might suggest is that you go to a Unix prompt and try to run an ftp to your target box by typing the commands in by hand. If they don't work from there, they won't work from a script either and it might mean that something else is wrong.
Do this all the time. Here's the code from one of a fex.
-UNIX /opt/ibi/apps/yi684/yi684ftp.sh
Here's the script
#!/bin/csh
cd /opt/ibi/apps/reports
smbclient //s92x01/workgroups "password" -Iipaddr -Wdomain -Uuserid<< :end
cd "Child Welfare/Reports/YI684"
put yi684l.csv
put yi684bl.csv
put yi684cl.csv
put yi684dl.csv
put yi684el.csv
put yi684pl.csv
put yi602l.csv
quit
:end
As you can see we use smbclient to ftp to Windows servers from our Linux host. Works great.
One other thing, make sure your script is flagged as an executable.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006
Our webfocus server runs on windows and this is an example what I use to ftp from data from a UNIX box to a network drive on windows. This FEX builds the ftp script as a temp file and then executes it:
FILEDEF FTPSCR DISK ftpt0003.txt -RUN -* -WRITE FTPSCR open unix001 -WRITE FTPSCR user001 -WRITE FTPSCR psw001 -WRITE FTPSCR lcd "\\SOME\NETWORK\DRIVE\ON\WINDOWS" -WRITE FTPSCR ascii -WRITE FTPSCR cd /some/directory/on/unix001 -WRITE FTPSCR get unix001-file001 -WRITE FTPSCR bye -CLOSE -* DOS ftp -i -s:ftpt0003.txt -*
The ftp script can be copied and saved if needed.
Jim
WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005
Hi and thanks for helping! I just saw an older post of your re: ftp and was about to email you when I saw this response.
I am getting a 'cannot execute' message when trying to execute the script. I assume this is because it is not flagged as an executable?
Just how do I flag the 'sh' script file as an executable from WF Dev. Studio? One thing, it won't let me name the script with an 'sh' extension, so I have to go to a file manager to do that.
Haven't used smbclient before, so I'm looking forward to getting to the point of execution.
To change the permissions on the file in Unix, you have to log onto the box, go to the directory where the script is, and do a chmod to make the script executable.
You must own the file or be in the group that owns the file and have owner and group write permissions to do this.
Let's say that you have a file that when you do an ls -l on it, it comes back like this:
-rw-rw-r-- 1 userid sf 109 Nov 30 15:38 ftp_put_to_win.ksh
In this example the first group of triplets is the owner permissions, the second is the group, and the third is world or everyone. If you wanted to make it executable for you and everyone in your group, you could say:
chmod u+x,g+x ftp_put_to_win.ksh
Your result would be:
-rwxrwxr-- 1 userid sf 109 Nov 30 15:38 ftp_put_to_win.ksh
There are other ways to do chmod permissions like using octal numbers but I find this way more readable. You can get more detail by doing man chmod at your Unix prompt.
If you do not own the file, you will have to get an admin to change the permissions for you.
Connected to server001. 220 AD1HFDPST001 Microsoft FTP Service (Version 5.0). ---> SYST 530 Please login with USER and PASS. ---> QUIT 221 /path: user001: not found /path: pw001: not found /path: cd/report_ftp: not found /path: binary: not found /path: put: not found /path: bye: not found
Also tried using USER and PASS commands in script with same result.
As I mentioned before, please run your script from the Unix prompt to make sure that it works that way and take WF out of the equation. That way you will know you can get to the remote box from your Unix box.
Once that is working, try it again from WF. If it still doesn't work after all of that, then open a case with IBI.
Being a virtuoso, you know by now there are no stupid suggestions when it comes to FOCUS. I have tried what you suggested and in both UPPER and lower case. Result: no differences.
-UNIX cd /opt/app/ibi71/ibi/apps/dcl
-UNIX dcl.ftp
Where dcl.ftp is the unix ftp script. You need execute permission for the user that runs on Unix like several others have explained. Do you know what user you are running as?
Here is the script:
SERVER=app000000 # Name of Windows Server
DIR=/opt/app/ibi71/ibi/apps/dcl # Directory on Unix
DDIR=SomeWindowsDirectory # Directory on $SERVER
FILE="*.pdf" # File name pattern to transfer
USER=network\\\\\\\\wuser # User name on Windows network- must replace bslash with 8
PASS=password # Password of $USER
if [ ! -f $DIR/$FILE ] ; then # Check if file exists
echo $DIR/$FILE does not exist
exit 1
fi
cd $DIR # cd to directory containing file
(
echo "
open $SERVER
user $USER $PASS
bin
cd $DDIR
put $FILE
close
"
) | ftp -i -n > dclftp.out
WORDS=`wc -l <dclftp.out`
if [ $WORDS -ne 0 ] ; then
echo FTP errors
exit 1
fi