| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. RexxINET and FTP #7777 Posted by: misi01 2006-01-11 16:11:39 | I am looking at getting a list of members in a PDS from the mainframe (if you don't know what a PDS is, simply think of it as a directory with no sub-directories).
I'm getting it to work using FTP commands, but I've instead tried using the REXX Inet add-on DLL. I've managed to get it working (partially). Here's my code for anyone else who may need to access a mainframe.LIBRARY rexxinet
ineterr = "ERROR"
inetheading = 1
DO
inetopen()
CATCH ERROR
CONDITION("M")
RETURN
END
inetdial()
inetoption('USER', 'myuser', 'SET')
inetoption('PASSWORD', 'mypw', 'SET')
err = inetconnect("hsession", 'our.ftp.site', "ftp")
IF err \== "" THEN
DO
SAY err
SIGNAL close_session
END
inetdir("'MISI01.PLAS.COBOL'", "SET")
inetdir("dir", "GET")
DROP fred
err = inetmatchname('fred', '*')
DO WHILE err \== "DONE"
fred = STRIP(fred)
IF WORDS(fred) > 1 THEN
SAY WORD(fred,1) WORD(fred,4) WORD(fred,5)
ELSE
SAY fred
err = inetmatchname('fred', '*')
END
close_session:
err = inetclose("hsession")
IF err \== "" THEN SAY "InetClose failed:" err
RETURN What I'm seeing is that variation 1 fails whereas variation 2 works.
Secondly, even though I run through the code from start to finish in RPC (ie, I perform the InetClose), if I try and run it again immediately after, I get an error "Could not find routine INETOPEN". If I close RPC and restart, then it works. (ie, I can't run it twice in a row in RPC). The same happens with RxLaunch.exe.Michael | 2. Re: Listing of files from mainframe #7904 Posted by: misi01 2006-02-23 16:20:25 | I'll add this as a separate entry. After some testing, I notice that if I set the directory from above to a file that doesn't exist on the mainframe, I get no failures as such from the SET or GET commands (I suppose that's fair - I might want to be creating a new directory), but what did surprise me was the fact that the
err = inetmatchname('fred', '*')
gave no error or anything. In fact, I was forced to add
result = EXISTS('fred')
to check whether the call had found anything or not.
Is this what you'd expect, or should the inetmatchname have returned a "DONE" ??
BTW. It seems that another way of testing whether the file exists seems to be to check whether a dot has been added as a suffix to the directory name. For example,
err = inetdir("'MISI01.PLAS.EXISTS'", "SET")
err = inetdir("dir", "GET")
IF err \== "" THEN
SAY err
ELSE
SAY DIR
gives 'MISI01.PLAS.EXISTS' in dir, whereas
err = inetdir("'MISI01.PLAS.MISSING'", "SET")
err = inetdir("dir", "GET")
IF err \== "" THEN
SAY err
ELSE
SAY DIR
gives 'MISI01.PLAS.MISSING.' in dir (note the trailing dot)
Michael | 3. Re: Listing of files from mainframe #8028 Posted by: 2006-03-22 21:21:55 | There were two issues raised in the original post, the second of which has already been discussed, so I thought I'd address the first.What I'm seeing is that variation 1 fails whereas variation 2 works.
inetoption('USER', 'myuser', 'SET')
inetoption('PASSWORD', 'mypw', 'SET')
err = inetconnect("hsession", 'our.ftp.site', "ftp")
Your problem is that you don't have a handle to an FTP session until after you call inetconnect, therefore inetoption() will either receive an error from the underlying call to InternetSetOption(), or it won't even issue the call, depending on how much checkinghas been built into it. Have you checked the return value from inetoption?
I haven't done a test of this myself with a network trace, but I'm assuming that if you did the inetoption calls after you had an active session, you'd see the USER and PASS commands issued to change the authorisation of the session.
| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|