× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am about to give up on this as being hopelessly beyond my skills. The help has been generous and precise, but it just sends my head into a tailspin. Here's where I got to: (passwords, etc, are just made-up, btw)

My XP Pro PC has three accounts. The one I use for Client Access is "Booth, password "abc123"". The System i is "Booth, password "xyz987". I would like to put the data from the System i into a folder on the desktop called "RWFiles" I believe the path to the folder is "C:\Documents and Settings\Booth\Desktop\RWFiles"
and I believe I have it marked as shared.

I copied in a program that yields the IP address of the workstation, but it changes with each log-in. I tried the piece with QNTC but nothing works. Obviously it works for you, so its right, but I just can;t get it to connect.

The good news is that at least now I can get the ip address automatically. :)

Thanks for the help; its appreciated.





Scott Klement wrote:
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 on my system... I know I have one, but I'm too lazy to look right now.)

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). It's worth noting that i5/OS doesn't normally use IP address (it usually uses the host's name instead) so you do have to create the directories manually.

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. The act of creating it establishes the connection to the PC (which may take time, so I only want to do it if i have to):

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 isn't acceptable to the PC, or if the PC doesn't have a share set up to write to, or doesn't allow the iSeries to connect, etc.

A different approach is to use the smbclient tool from the Samba suite. It's a program that runs in PASE and is able to treat a Windows file 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 alternative.


Booth Martin wrote:
Man... now i feel even more dense.

Scott, your explanation was, as always, concise and easy to understand.

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 answer?

Lets use, for an example, this problem: I want a user, any authorized user, to be able to take an i5 menu option, get a screen asking for a month and year, and then have the i5 gather the data and send that data in a .csv file to the desktop of the user that made the request. The ordinary 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 the file to the IFS (thanks to your work). But I can't write to the desktop.
The issue has importance here because the .csv file is close to 90 megs 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 minute. We haven't tested it yet but we are suspicious that opening the file from a Windows server will also be slow, so we are hoping we can write directly to the desktop, which we suspect the user really wants, anyway.

At first I felt it was just me being obtuse, stubborn, ans silly, but as I ask others that I know are knowledgeable i5 users it becomes clear to 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 under) 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 ones that Windows accepts.


Booth Martin wrote:
Man, I can be dense. None of these answers look easy & straight forward.

I am using Scott Klement's examples to write a PC file to the IFS of the System i. It uses a path & file name, which of course I expect. It occurs to me that one can type in any path name and there is no real reason 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: Am I 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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.