Problem:
The following happens on Server Express 5.0 (no fixpacks) and earlier.
Program A accesses a file in fileshare server 1, then chains to Program B. Program B successfully accesses a file in fileshare server 1 but, if it opens a file from a different fileshare server, it gets a 114 error in FHRSUB.
This is the outline of what happens:
DEMO1.cbl:
- Open input $$fsserver1/FS1FILE1
- access FS1FILE1
- close FS1FILE1
- CHAIN to DEMO2
DEMO2.cbl:
- Open input $$fsserver1/FS1FILE2
- access FS1FILE2
- close FS1FILE2
- Open input $$fsserver2/FS2FILE1
This is when the 114 error occurs.
If an access to a different file from $$fsserver2 is added in DEMO1.cbl, the error doesn't appear.
Resolution:
The problem is that the password module "fhrdrpwd" is being cancelled when the CHAIN occurs, but FHRSUB is still using the procedure-pointer to the cancelled module - hence the 114 error.
FHRSUB doesn't get canceled because it is a system program. fhrdrpwd is a user replacable module and, for this reason, it can not be a system program, therefore it gets cancelled.
As the password for FHRSUB is already obtained in the first program, it doesn't fail when accessing the first fileshare server, and it doesn't need to access to fhrdrpwd to obtain it.
The second server is accessed by the second program, so it doesn't have the password. It needs to call fhrdrpwd to get it but, as fhrdrpwd is not longer at the address where FHRSUB thinks it is, the 114 error is produced.
Attached to this article is a version of fhrdrpwd.cbl, which includes a $SET NOCANCEL directive which will prevent the module being cancelled on the chain.
Compile this module to gnt
cob -u fhrdrpwd.cbl
and place it in the $COBDIR/dynload directory, and the error should no longer occur. For testing simply place in the current directory.
If you are already using your own version of the fhrdrpwd module for security reasons, you simply need to recompile it, specifying the "NOCANCEL" checker directive at the beginning of the program:
$SET NOCANCEL
Specifying NOCANCEL for a program means it will NOT be cancelled by the Runtime for the duration of the run unit. This includes both implicit cancels (eg CHAIN) and explicit cancels (CANCEL).
The NOCANCEL directive will be documented as:
[NO]CANCEL
Parameters: None
Default: CANCEL
Phase: Syntax Check
Environment: All
$SET : Any
This problem will be addressed in Server Express 5.0 Websync 3.
Attachments:
#COBOL
#netexpress
#RMCOBOL
#AcuCobol
#ServerExpress