Highlighted
Absent Member.
Absent Member.
997 views

NetX 2 Visual COBOL - Method params.

Jump to solution

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?

Antonio João

Primavera do Leste / MT / Brasil

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: NetX 2 Visual COBOL - Method params.

Jump to solution

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)

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: NetX 2 Visual COBOL - Method params.

Jump to solution

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)

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: NetX 2 Visual COBOL - Method params.

Jump to solution

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.

Antonio João

Primavera do Leste / MT / Brasil

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.