[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Found it.  Don't like it, but I found it.

I don't know if this is a bug, or by design.  Apparently the Occurrence of a
MODS or variable is maintained at the module level.

I've posted a sample 3-module program at <
http://code.midrange.com/0078aaf460.html > to demonstrate, if you're

Actually, I'd like to know if that's still a true at i6.1 and/or at i7.1.
Depending upon the results, I may bring this to the RPG400 list (though I
suspect it may be by design).

The obvious answer is to put an unexported cmd_occurSession into each
module, but the maintenance of that could get messy.  Maybe the meat of that
routine needs to be /Copy?  Any ideas?

Dennis Lovelady
CONGRESS.SYS corrupted.  Reboot Washington DC <Y/N>? 

> I'm working on the task of separating FTPAPI into modules on a V5R3
> machine.
> (No promises yet; it's still early. ;) )  I got everything to compile
> and it
> looks well but I've run across an unexpected result.
> Basically, I had to create a new header file that's exclusive to the
> internal operation (so that, for example, wkSession may be shared among
> its
> peers).  When compiling one module, wkSession must be defined; when
> compiling any others, it must be imported.  And of course we cannot
> specify
> INZ on an imported field, so basically the definition looks like this:
> D wkSessionIdx    S             10I 0
> D                                     Export Inz(INT_NULL)
>  /Else
> D                                     Import
>  /EndIF
> < ... >
> D wkSession       DS                  occurs(MAX_SESSION)
> D                                     Export
>  /Else
> D                                     Import
>  /EndIF
> D  wkActive                      1
> D                                     Inz(*OFF)
>  /EndIF
> ------------- 8 data records excluded -------------------
> D  wkErrNum                     10I 0
> D                                     Inz
>  /EndIF
> D  wkSocket                     10I 0
> D                                     Inz(INT_NULL)
>  /EndIF
> The other thing you need to know for my question is that there's an
> FTPAPIINT and an FTPAPIEXT module.  It's not beautiful but it does
> compile.
> If you have other suggestions, I'm wide open.  :)   But the unexpected
> effect is that within FTPAPIINT (which is compiled with
> FTPAPI_INTERNAL_FUNCTIONS set) everything is fine.  But it appears as
> though
> its own
> copy, since changes to (in this case) wkSocket within FTPAPIINT don't
> seem
> to have an effect on wkSocket as referenced in FTPAPIEXT.
> So is my thinking off base here?  Shouldn't there be exactly one copy
> of
> wkSession, and shouldn't it be shared?  If there were two copies, then
> the
> CRTSRVPGM command would fail, right?
> When this code executes
> c                   if        selectSession(peSession) < 0
> c                   callp     SetSessionError
> c                   return    -1
> c                   endif
> c                   if        peNewDir = '..'
> c                   if        SendLine(wkSocket: 'CDUP') < 0
> c                   return    -1
> c                   endif
> c                   else
> c                   if        SendLine(wkSocket: 'CWD '+peNewDir)
> In debug mode, I can see that within selectSession(), wkSocket has a
> value
> of 4 upon its return.  But FTP_chdir() disagrees, having a value of -99
> for
> wkSocket, which we can see above should be an imported variable by
> virtue of
> the DS import.
> What might cause this effect?
> Dennis Lovelady
> http://www.linkedin.com/in/dennislovelady
> --
> "Nature gave man two ends - one to sit on and one to think with. Ever
> since
> then man's success or failure has been dependent on the one he used
> most."
>         -- George R. Kirkpatrick
> -----------------------------------------------------------------------

This is the FTPAPI mailing list.  To unsubscribe, please go to: