Skip to main content
Question

Dynamically building fcd and keyblock in NET

  • August 18, 2026
  • 5 replies
  • 40 views

Peter Restorick
Forum|alt.badge.img+2

Is the use and setting of the FCD information different between native COBOL and NET COBOL?

My reason for asking is that I have taken the code from our native application straight across into a NET COBOL equivalent and I am finding that setting the address for the file name and key block is not being taken across to our external filehandler correctly.

5 replies

Chris Glazier
Forum|alt.badge.img+4

As far as I know the interface should be the same. Are you using the same FCD description in both, i.e., FCD2 or FCD3?


Peter Restorick
Forum|alt.badge.img+2

Hi Chris,

 

We are using FCD3. I am trying to write a sample set of programs with the external filehandler to submit if I can reproduce.

As I said it appears that even though I set the address for the filename and key block to something I have defined when it gets to the external filehander the address of these has been reset - possibly reverted to the original addresses set by the FD statement 

If you look at the code snippet below the last two lines where addresses are set for the filename and for the keyblock are the ones which are not passed

           SET ADDRESS OF FCD-BLOCK TO ADDRESS OF FH--FCD    OF ADMDT2.
SET ADDRESS OF LINK-KEY-BLOCK TO
ADDRESS OF FH--KEYDEF OF ADMDT2.

*
** Build key info...
perform build-key-block
MOVE KY-COMP-LEN(1,1) TO FCD-KEY-LENGTH.

*> these addresses are not coming through in the external filehandler.
*> It appears that they revert to the addresses set by the FD statement
SET FCD-FILENAME-ADDRESS TO ADDRESS OF SAV-ADMDT2-DATA.
SET FCD-KEY-DEF-ADDRESS TO ADDRESS OF KEY-BLOCK.

 


Chris Glazier
Forum|alt.badge.img+4

Hi Peter, I did some testing and it worked fine for me using either the managed file handler “EXTFH” or the native file handler call “NATIVEFH” after adding the correct NuGet package to the project and setting the correct file handling property on the Application ->Advanced packages settings.

I tested a .NET application calling a Micro Focus file handler. Are you trying to call your own custom file handler? I saw a limitation that said custom file handlers are not supported in .NET.


Peter Restorick
Forum|alt.badge.img+2

Hi Chris,

Yes we are using a custom filehandler which redirects actions if reading SQL tables. If the FCD is for a sequential or ISAM file then it is redirected to EXTFH.

It is very concerning that custom filehandlers are not supported in NET as everything we require using it works perfectly (and we have now been developing around this for nearly a year) apart from when using a generic FD and manipulating the definition as per above,

Thanks 


Peter Restorick
Forum|alt.badge.img+2

Hi Chris

I am trying to setup a test solution for this issue but when EXTFH is called I am getting a 173 error even though I have included the following nuget packages and set the filehandler to managed.

Neil is raising a case for this to see if there is something we can do.

Thanks for your assistance on this.