Skip to main content

[Migrated content. Thread originally posted on 04 January 2012]

Hello,

The following compiler directive has to be set in order to enable the C$Century call (or some other RM/COBOL subroutine like C$DevEnv,...) to return a value:

RM "GIVING"

But If I use this compiler directive, the Visual Cobol subroutines doesn't work.
For exemple, the CBL_GET_PROGRAM_INFO subroutine doesn't work; when I use it in a program, it displais the next:
wsfuncion = 0000000000 status-code = 0538976288                               
wsfuncion = 0000000004 status-code = 0538976288                                 
wsfuncion = 0000000006 status-code = 0538976288                                 
wsfuncion = 0000000003 status-code = 0538976288                                 
PROGRAM-ID: 


When I don't use the compiler directive RM "GIVING", the the CBL_GET_PROGRAM_INFO subroutine works correctly:
wsfuncion = 0000000000 status-code = 0000000000                                 
wsfuncion = 0000000004 status-code = 0000000000                                 
wsfuncion = 0000000006 status-code = 0000000000                                 
wsfuncion = 0000000003 status-code = 0000000000                                 
PROGRAM-ID: TESTPROGRAMID


I need to use RM/COBOL subroutines and Visual Cobol subroutines in the same program. What can I do??

Thank you

[Migrated content. Thread originally posted on 04 January 2012]

Hello,

The following compiler directive has to be set in order to enable the C$Century call (or some other RM/COBOL subroutine like C$DevEnv,...) to return a value:

RM "GIVING"

But If I use this compiler directive, the Visual Cobol subroutines doesn't work.
For exemple, the CBL_GET_PROGRAM_INFO subroutine doesn't work; when I use it in a program, it displais the next:
wsfuncion = 0000000000 status-code = 0538976288                               
wsfuncion = 0000000004 status-code = 0538976288                                 
wsfuncion = 0000000006 status-code = 0538976288                                 
wsfuncion = 0000000003 status-code = 0538976288                                 
PROGRAM-ID: 


When I don't use the compiler directive RM "GIVING", the the CBL_GET_PROGRAM_INFO subroutine works correctly:
wsfuncion = 0000000000 status-code = 0000000000                                 
wsfuncion = 0000000004 status-code = 0000000000                                 
wsfuncion = 0000000006 status-code = 0000000000                                 
wsfuncion = 0000000003 status-code = 0000000000                                 
PROGRAM-ID: TESTPROGRAMID


I need to use RM/COBOL subroutines and Visual Cobol subroutines in the same program. What can I do??

Thank you
The RM"GIVING" directive changes the default call-convention that is used from Visual COBOL to RM.

In order to call Visual COBOL subroutines in a program that has the RM"GIVING" directive on you need to specify a call-convention of 0 when calling the Visual COBOL subroutines.

Example:


      $SET RM"GIVING"
       program-id. testProgram.
       special-names.
          call-convention 0 is VisualCOBOLcall.
       data division.
       working-storage section.
       01 wsfunction             pic x(4) comp-5.
       01 param-block.
          05 cblte-gpi-size      pic x(4) comp-5.
          05 cblte-gpi-flags     pic x(4) comp-5.
          05 cblte-gpi-handle    usage pointer.
          05 cblte-gpi-prog-id   usage pointer.
          05 cblte-gpi-attrs     pic x(4) comp-5.
       01 return-buf             pic x(100).
       01 return-buf-len         pic x(4) comp-5 value 100.
       01 status-code            pic x(4) comp-5 value 0.
       01 wsname                 pic x(10) value "PATH".
       01 wsvalue                pic x(1024) value spaces.
       01 wsreturn               pic 9(9) binary.
       procedure division.

           CALL "C$GetEnv" USING wsname, wsvalue wsreturn
           display wsvalue
                     
           move length of param-block to cblte-gpi-size
           move length of return-buf to return-buf-len
           move 3 to cblte-gpi-flags
           
         *> Establish the current program and return handle           
           
           move 0 to wsfunction
           perform 100-call-program-info
           display "program name = " return-buf
           
         *> Get first entry point in program
           move 4 to wsfunction
           perform 100-call-program-info
           display "entry point = " return-buf
         
         *> Close the handle that was established
           
           move 6 to wsfunction
           perform 100-call-program-info
           stop run.
       
       100-call-program-info.
                 
           call VisualCOBOLcall "CBL_GET_PROGRAM_INFO"
              using
                 by value wsfunction
                 by reference   param-block
                 by reference   return-buf
                 by reference   return-buf-len
             returning      status-code
            end-call.
           


[Migrated content. Thread originally posted on 04 January 2012]

Hello,

The following compiler directive has to be set in order to enable the C$Century call (or some other RM/COBOL subroutine like C$DevEnv,...) to return a value:

RM "GIVING"

But If I use this compiler directive, the Visual Cobol subroutines doesn't work.
For exemple, the CBL_GET_PROGRAM_INFO subroutine doesn't work; when I use it in a program, it displais the next:
wsfuncion = 0000000000 status-code = 0538976288                               
wsfuncion = 0000000004 status-code = 0538976288                                 
wsfuncion = 0000000006 status-code = 0538976288                                 
wsfuncion = 0000000003 status-code = 0538976288                                 
PROGRAM-ID: 


When I don't use the compiler directive RM "GIVING", the the CBL_GET_PROGRAM_INFO subroutine works correctly:
wsfuncion = 0000000000 status-code = 0000000000                                 
wsfuncion = 0000000004 status-code = 0000000000                                 
wsfuncion = 0000000006 status-code = 0000000000                                 
wsfuncion = 0000000003 status-code = 0000000000                                 
PROGRAM-ID: TESTPROGRAMID


I need to use RM/COBOL subroutines and Visual Cobol subroutines in the same program. What can I do??

Thank you
Thanks for the reply. Now it works correctly.