Using RM/Cobol Indexed Files with Fujitsu Cobol

We are migrating an application from RM/Cobol to Fujitsu Net Cobol for .Net.  As part of this, we want to be able to access indexed files from RM and Fujitsu programs concurrently.  Since the Fujitsu indexed file handler appears to have been licensed from RM back in the misty depths of time, this would appear to be a no-brainer.  Unfortunately, this turns to not be the case.  While RM files are compatible with Fujitsu programs, there are restrictions.  Here is what I have been able to find out so far:

  1. The Fujitsu indexed file handler is OLD!  If you want to be able to access an RM file from a Fujitsu program the file must be at version zero of the file structure.  This means that most RM files will have to be copied to a new file, in version zero format.  To do this you need to write a program to read the current file and write a new file in version zero format.  To make this happen you need to supply a supplementary configuration file to the reorg program, containing this option: RUN-INDEX-FILES DEFAULT-FILE-VERSION-NUMBER=0
  2. The default internal representation of signed USAGE DISPLAY fields is different for Fujitsu and RM.  In order to make the Fujitsu program use the RM representation you need to supply the /wc:DECIMAL(88) compiler option.
  3. Fujitsu programs behave differently that RM programs when the FILE STATUS IS clause is given on the SELECT statement.  RM programs write the file status to the WORKING-STORAGE variable and then the program aborts, unless a DECLARATIVES entry is present.  Fujitsu programs write the status to the WORKING-STORAGE variable and continue.  Even record lock “errors” are handled this way by Fujitsu.  That is, the program does not wait for the lock to be cleared.  It simply writes “99″ to the status variable and continues.  It also may or may not display an error dialogue.  The rules on this are somewhat unclear at the moment.  In any event, to completely suppress error dialogues you need to provide a DECLARATIVES entry for each file. You must also ALWAYS check the value of the status variable after EVERY I/O statement.  Either that or omit the FILE STATUS IS clause.
  4. By default Fujitsu opens indexed files for exclusive use.  To have Fujitsu behave in the same way as RM you must include LOCK MODE IS AUTOMATIC in the SELECT statement.

I will post more as I learn more.

Leave a Reply