|
Hi Booth...
The QDCRDEVD API can give you the IP address of the PC that has
connected to an interactive session. Search archive.midrange.com and
you'll find examples (if you don't, let me know and I'll find one onmy
system... I know I have one, but I'm too lazy to look right now.)It's
Once you have the IP address, you can tell i5/OS to connect to it via
/QNTC by creating an IFS directory (if it doesn't already exist).
worth noting that i5/OS doesn't normally use IP address (it usuallyuses
the host's name instead) so you do have to create the directoriesmanually.
The
So here's (untested) program code that creates an IFS directory that
connects to a given PC. The IP address is the one retrieved from
QDCRDEVD. If first checks if the dir exists, if not it creates it.
act of creating it establishes the connection to the PC (which maytake
time, so I only want to do it if i have to):isn't
dirname = '/QNTC/' + %trim(IPADDR) + '/CSVShare';
if access(%trimr(dirname):F_OK) <> 0;
if mkdir(%trimr(dirname)) <> 0;
// check errno
endif;
endif;
Now that the share exists, you can write your CSV file to it
filename = %trimr(dirname) +'/' + 'myfile.csv';
fd = open( %trimr(filename) ... etc ... )
Again, you'll have a problem if the userid/password on the iSeries
acceptable to the PC, or if the PC doesn't have a share set up towrite
to, or doesn't allow the iSeries to connect, etc.suite.
A different approach is to use the smbclient tool from the Samba
It's a program that runs in PASE and is able to treat a Windows filealternative.
share like an FTP server. You sign in with userid/password, and then
can do things like put/get, etc... but that's a whole different
conversation -- still, it might be useful to know there's an
understand.
Booth Martin wrote:
Man... now i feel even more dense.
Scott, your explanation was, as always, concise and easy to
answer?
However I still can't figure out how to do it. Maybe I can ask the
question in a simple enough way that even I can understand the
authorized
Lets use, for an example, this problem: I want a user, any
user, to be able to take an i5 menu option, get a screen asking for a
datamonth and year, and then have the i5 gather the data and send that
in a .csv file to the desktop of the user that made the request. The
theordinary user will not know the name of his PC, nor the path to his
desktop. I can do almost all of that right now, including writing
desktop.file to the IFS (thanks to your work). But I can't write to the
megs
The issue has importance here because the .csv file is close to 90
in size, and opening the file from a mapped network drive to the IFS
takes forever to open in Excel. From the desktop it opens in under a
theminute. We haven't tested it yet but we are suspicious that opening
canfile from a Windows server will also be slow, so we are hoping we
wants,write directly to the desktop, which we suspect the user really
asanyway.
At first I felt it was just me being obtuse, stubborn, ans silly, but
toI ask others that I know are knowledgeable i5 users it becomes clear
me that while I may be dense, I am not alone in my denseness.
And! Scott, thank you.
And! Vern, thank you.
Scott Klement wrote:
Hi Booth,
I guess I don't really understand the problem. You say you want to
write to a windows PC. Let's assume that the Windows PC is named
BOOTHSPC and on that PC is a shared named "SharedDir".
You code your open statement like this:
filename = '/QNTC/BOOTHSPC/SharedDir/MyFile.txt';
fd = open( %trimr(filename): O_CREAT+O_WRONLY; S_IRWXU);
That's pretty much it. Just by starting the filename with
'/QNTC/BOOTHSPC/SharedDir' the system will automatically connect to
BOOTHSPC, log in (using the userid/password you're signed into i5/OS
onesunder) and create the file on that PC.
How could it be more easy/straightforward that that?
Things only get tricky when your Windows network won't let i5/OS
connect, or when your userid/password on i5/OS doesn't match the
forward.that Windows accepts.
Booth Martin wrote:
Man, I can be dense. None of these answers look easy & straight
of the
I am using Scott Klement's examples to write a PC file to the IFS
ItSystem i. It uses a path & file name, which of course I expect.
realoccurs to me that one can type in any path name and there is no
Am Ireason that it won't write directly to what ever is at that path?
But like so many things, it just isn't so. My first question is:
dreaming? Is it really simple, or is it a lot of hoop-jumping and
therefore of limited value??
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.