NetX 2 Visual COBOL - Method params.

Hi.

In Advance, sorry for my poor english.

I have this, in NetExpress:

THE CALLER

[CODE FLAGMENT - BEGIN]

*------------------------------
WORKING-STORAGE SECTION.
*------------------------------

78       NumItens VALUE 10.
78       NumMinas VALUE 12.

*
01       wParametros.
  05     wJogando PIC 9(001).
  05     wTiros PIC 9(002).
  05     wMinasAchadas PIC 9(002).
01       wCampoMinado.
  05     wNumitens PIC 9(002) VALUE NumItens.
  05     wNumMinas PIC 9(002) VALUE NumMinas.
  05     wArea.
    10   wFiller Occurs NumItens.
      15 wTerreno PIC X(002) Occurs NumItens.

[CODE FLAGMENT - END]

THE CALLED CLASS

[CODE FLAGMENT - BEGIN]

Method-id. "Inicializacoes".

*------------------------------
 linkage                Section.
*------------------------------
01       lsParametros.
  05     lsJogando PIC 9(001).
  05     lsTiros PIC 9(002).
  05     lsMinasAchadas PIC 9(002).
01       lsCampoMinado.
  05     lsNumitens PIC 9(002).
  05     lsNumMinas PIC 9(002).
  05     lsArea.
    10   lsFiller Occurs NumItens.
      15 lsTerreno PIC X(002) Occurs NumItens.

******************************************************************
 procedure            division using lsParametros
                                     lsCampoMinado.
******************************************************************

[CODE FLAGMENT - END]

I am calling the method like this:

Invoke type ajMinefield.Campo::Inicializacoes(wParametros, wCampoMinado)

Visual COBOL compile with the error "Could not find method 'Inicializacoes' with this signature".

How i declare/use an method in VC?

  • Verified Answer

    Since you are invoking a method on the class itself using the type keyword:

      Invoke type ajMinefield.Campo::Inicializacoes(wParametros, wCampoMinado)

    it is expecting a static method and not an instance method.

    To fix this you can add the static keyword to the method like:

    Method-id. "Inicializacoes" static.

    It should then compile OK.

    If you want to call the instance method as defined then you will need to create an instance of the class and call that instead:

     declare myinstance as type ajMinefield.Campo = new ajMinefield.Campo

     invoke myinstance::Inicializacoes(wParametros, wCampoMinado)

  • Hey man, thank you very much.

    I used "declare myinstance..."

    It is ok.

    Everybody know that man don´t cry, but when I saw the method in running, a tear almost came down from my eye.