Hello. New here. We're investigating an external 3rd party COBOL ISAM handler linked with callfh functionality. This library is fully functional with MF COBOL (and ACU and RM) and behaves according to established EXTFH standards.
Good news - Our example code runs perfectly under the BDB ISAM handler. Our library links and successfully creates files under our file system. Testing with OPEN OUTPUT, files are created under our file handler library and records added.
The unknown - Our simple example fails with error 23 when linked with callfh. as no records are added to table.
The first problem we noticed is that NOT OPTIONAL on OPEN I-O does not trigger a file create. If we first create a file loaded with records using OPEN OUTPUT, then running the example with OPEN I-O we get successful read of records.
Looking at GNUCOBOL source we noticed handling of NOT OPTIONAL doesn't seem complete for starters
That implies Bit 5 should be explicitly set when NOT OPTIONAL is specified with OPEN I-O or OPEN EXTEND. And, Bit 7 is for OPTIONAL and OPEN INPUT. This is what it seems is happening when our driver receives the FCD information, it is not what we expect and we only do what the FCD instructs.
We don't see OTH_NOT_OPTIONAL handling at all. (Then there's the -foptional-file flag consideration as well which is confusing in this regard and makes no difference with our library testing).
Is this support still lacking? Or are we missing something? Is there someone we should be directly talking to about complete EXTFH support such as MF provides? (We'd love to be working under GNUCOBOL! )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-02-11
As a ping I was able to test with the 4.0 early dev build and same results. I do see your extfh work has been abstracted out in the source which is encouraging!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-02-11
I should clarify - Same results as original post in that the extfh interface isn't behaving as our driver expects. Table is not created on OPEN I-O with SELECT NOT OPTIONAL clause.
GnuCOBOL 4.0 built and compiled cleanly (environment issue on my end with the trunk build before --- sorry!)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the extfh implementation is split-out but will stay sync'd to 3.x (so far it contains one unmerged changed in 4.x which is about handling of composite keys).
In any case you either dive into the C source-code to check or need to wait for @rjnorman74 to investigate, which is much more likely if you create a minimal program to reproduce this (which at least would make it clear how the test is done).
BTW: I highly suggest to register/login, otherwise a post of yours may stay "for days" until a human took the time to manually moderate your posts.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-02-12
"NOT OPTIONAL" is this equivalent to Micro Focus "NOOPTIONAL FILE" ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Longer answer, not sure. That seems to make all files non optional in terms of INPUT and IO modes, even if OPTIONAL is explicit in the SELECT? Or, I'm reading that entry as you need to use NOOPTIONAL-FILE to stick with Standard (OPTIONAL needs to be explicit) and implied with MF will all SELECT for input phrases being OPTIONAL by default?
Cheers,
Blue
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-02-13
As I remember it NOOPTIONAL-FILE (the default) will not create a file on an OPEN INPUT clause failing because the daateset was not found.
OPTIONAL-FILE will create a file and raise a '05' status code if the DSN associated with the OPEN is not found.
Obviously with NOOPTIONAL-FILE in effect a status code '35' will be raised on a data set not found at OPEN INPUT.
As I recall use of Micro Focus (MF) EXTFH referencing a SELECT CLAUSE and FD will populate the FCD with the NOOPTIONAL-FILE bit set ON.
Regarding ISAM / VSAM, OPEN I-O (or extend) I always do a test for Status Code '35', if '35' was raised I issue an OPEN OUTPUT, CLOSE, and OPEN I-O. On the mainframe (IBM) IDCAMS creates the VSAM dataset - I do not think you can OPEN an OUTPUT VSAM data set without IDCAMS services. - I think ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I'm the OP now registered. Attached (I hope it goes through) is a primitive example (Sorry, I'm far from a COBOL dev). It behaves differently between the default DB handler and ExtFH interface. To compile with our external handler we're using this:
cobc -x -fcallfh=myhandler test.cbl myhandler.so
I also see inconsistent behavior in ExtFH after a close and re-open of the table. The table is not created the second time (after it's closed and removed) and then an infinite READ loop with no error. Should be self explanatory from comments and output. Again, we think its just a few bits that aren't passed down in the FCD options. I tried to modify source, but probably missed a few strategic locations.
Unfortunately, I'm not at liberty to publicly disclose our external file handler. (I'm happy to have that discussion offline if that helps with testing.) --Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From testing today's current 3.2 build from 23 Oct I see the same behavior as I recall from before. The default handler runs as expected. A compiled in EXTFH handler behaves as I recall.
cobc -x -fcallfh=handler test2.cbl libhandler.so
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. New here. We're investigating an external 3rd party COBOL ISAM handler linked with callfh functionality. This library is fully functional with MF COBOL (and ACU and RM) and behaves according to established EXTFH standards.
Good news - Our example code runs perfectly under the BDB ISAM handler. Our library links and successfully creates files under our file system. Testing with OPEN OUTPUT, files are created under our file handler library and records added.
The unknown - Our simple example fails with error 23 when linked with callfh. as no records are added to table.
The first problem we noticed is that NOT OPTIONAL on OPEN I-O does not trigger a file create. If we first create a file loaded with records using OPEN OUTPUT, then running the example with OPEN I-O we get successful read of records.
Looking at GNUCOBOL source we noticed handling of NOT OPTIONAL doesn't seem complete for starters
In FCD
From MF documentation:
That implies Bit 5 should be explicitly set when NOT OPTIONAL is specified with OPEN I-O or OPEN EXTEND. And, Bit 7 is for OPTIONAL and OPEN INPUT. This is what it seems is happening when our driver receives the FCD information, it is not what we expect and we only do what the FCD instructs.
We find this in fileio.c:copy_fcd_to_file
We don't see OTH_NOT_OPTIONAL handling at all. (Then there's the -foptional-file flag consideration as well which is confusing in this regard and makes no difference with our library testing).
Is this support still lacking? Or are we missing something? Is there someone we should be directly talking to about complete EXTFH support such as MF provides? (We'd love to be working under GNUCOBOL! )
Thanks for your interest. @rjnorman74 possibly has some insights.
In any case: what version of GnuCOBOL do you currently run?
Thanks! This is testing with latest V3..1.2
I tried to pull current trunk and it compiled fine, however, the resulting cobc failed to compile our example. But that's life at the edge of a trunk.
As a ping I was able to test with the 4.0 early dev build and same results. I do see your extfh work has been abstracted out in the source which is encouraging!
I should clarify - Same results as original post in that the extfh interface isn't behaving as our driver expects. Table is not created on OPEN I-O with SELECT NOT OPTIONAL clause.
GnuCOBOL 4.0 built and compiled cleanly (environment issue on my end with the trunk build before --- sorry!)
Yes, the extfh implementation is split-out but will stay sync'd to 3.x (so far it contains one unmerged changed in 4.x which is about handling of composite keys).
In any case you either dive into the C source-code to check or need to wait for @rjnorman74 to investigate, which is much more likely if you create a minimal program to reproduce this (which at least would make it clear how the test is done).
BTW: I highly suggest to register/login, otherwise a post of yours may stay "for days" until a human took the time to manually moderate your posts.
"NOT OPTIONAL" is this equivalent to Micro Focus "NOOPTIONAL FILE" ?
Short answer: yes.
Longer answer, not sure. That seems to make all files non optional in terms of INPUT and IO modes, even if OPTIONAL is explicit in the SELECT? Or, I'm reading that entry as you need to use NOOPTIONAL-FILE to stick with Standard (OPTIONAL needs to be explicit) and implied with MF will all SELECT for input phrases being OPTIONAL by default?
Cheers,
Blue
As I remember it NOOPTIONAL-FILE (the default) will not create a file on an OPEN INPUT clause failing because the daateset was not found.
OPTIONAL-FILE will create a file and raise a '05' status code if the DSN associated with the OPEN is not found.
Obviously with NOOPTIONAL-FILE in effect a status code '35' will be raised on a data set not found at OPEN INPUT.
As I recall use of Micro Focus (MF) EXTFH referencing a SELECT CLAUSE and FD will populate the FCD with the NOOPTIONAL-FILE bit set ON.
Regarding ISAM / VSAM, OPEN I-O (or extend) I always do a test for Status Code '35', if '35' was raised I issue an OPEN OUTPUT, CLOSE, and OPEN I-O. On the mainframe (IBM) IDCAMS creates the VSAM dataset - I do not think you can OPEN an OUTPUT VSAM data set without IDCAMS services. - I think ?
Just to drop that note here, too: Ron will have a look at this sometime the next weeks.
Thanks. I'm the OP now registered. Attached (I hope it goes through) is a primitive example (Sorry, I'm far from a COBOL dev). It behaves differently between the default DB handler and ExtFH interface. To compile with our external handler we're using this:
cobc -x -fcallfh=myhandler test.cbl myhandler.so
I also see inconsistent behavior in ExtFH after a close and re-open of the table. The table is not created the second time (after it's closed and removed) and then an infinite READ loop with no error. Should be self explanatory from comments and output. Again, we think its just a few bits that aren't passed down in the FCD options. I tried to modify source, but probably missed a few strategic locations.
Unfortunately, I'm not at liberty to publicly disclose our external file handler. (I'm happy to have that discussion offline if that helps with testing.) --Cheers
Here is my simple example.
This second example is probably a better one. The first was too "clean".
@cwbaileymo is this still open with a GC 3.2 snapshot? Then we should have a look at fixing this after the rc is out.
From testing today's current 3.2 build from 23 Oct I see the same behavior as I recall from before. The default handler runs as expected. A compiled in EXTFH handler behaves as I recall.
cobc -x -fcallfh=handler test2.cbl libhandler.so