Search code examples
linuxcobolgnucobolcopybook

cobol : how to use a copy on linux?


I would like to know how to use a COPY statement. I am on Linux and I use GnuCOBOL with Visual Studio.

I have already tried several things but nothing works...

Here is my code:

   identification division.
   environment division.
   data division.
       working-storage section.
       copy laCopy.

   procedure division.

       accept w-user-entry.
       display w-user-entry.
       stop run.

and my copy :

   identification division.
  *environment division.
  *data division.
       working-storage section.
       01 variable.
          05 w-entreeUser PIC X(100).
       
   procedure division.
       stop run
  * GOBACK
       .

Each time I get the following error message:

laCopy:1: Error: Invalid indicator '' at column 7


Solution

  • I think the problem is that you have cobol code in your copybook.

    Your copybook should have only variable definitions and should be like this:

            01 variable.
              05 w-entreeUser PIC X(100).
    

    As @Robert stated above in cobol you can use the 8th column onwards.