Title: Does isCOBOL support C$REDIRECT?

isCOBOL allows you to create a file system interface in COBOL. There is a sample showing how to do this in the $ISCOBOL/sample/trigger folder.

The functions in your file system interface can be made to call isCOBOL's default file system. This allows you to add code before and/or after a file operation at the interface level.

For example, suppose you want to call subprograms named BEFOREWRITE and AFTERWRITE before and after ever WRITE operation. You could edit the sample file system interface ($ISCOBOL/sample/trigger/CobTrigger.cbl) and change the "write" method to the following:


       IDENTIFICATION DIVISION.
       METHOD-ID. MY-WRITE AS "write".
       WORKING-STORAGE SECTION.
       77  RETURN-VALUE OBJECT REFERENCE JLONG.
       LINKAGE SECTION.
       77  THERECORD  OBJECT REFERENCE JBYTEARRAY.
       77  OFFS       OBJECT REFERENCE JINT.  
       77  RECSIZE    OBJECT REFERENCE JINT.     
       77  FLAGLOCK   OBJECT REFERENCE JBOOL.
       PROCEDURE DIVISION USING THERECORD,
                                OFFS,
                                RECSIZE,
                                FLAGLOCK
                      RETURNING RETURN-VALUE.
       MAIN.       

      *Trigger action - start
           CALL "BEFOREWRITE" USING THERECORD, OFFS, 
                RECSIZE, FLAGLOCK.
      *Trigger action - end

           SET RETURN-VALUE TO MY-ISAM:>write (THERECORD,
                                          OFFS,
                                          RECSIZE,
                                          FLAGLOCK).
      *Trigger action - start
           CALL "AFTERWRITE" USING THERECORD, OFFS, 
                RECSIZE, FLAGLOCK.
      *Trigger action - end

           GOBACK.
       END METHOD.  

Please keep in touch and let Veryant Support know how you use or plan on using this feature.

Authored by: Veryant Support on Fri, Mar 25th, 2011 at 7:00 PM
This question has been viewed 6613 times so far.
Online URL: http://support.veryant.com/support/phpkb/question.php?ID=167

Powered by PHPKB Knowledge Base Software