Skip to main content

We are a batch system that is converting from NetExpress 5.1 to Visual Cobol 2022. When compiling we are getting errors with the file name and assign name being the same. This compiles without an errors in NetExpress.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
C01 IS H-O-F.
INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT G05 ASSIGN TO G05
FILE STATUS IS GT-STATUS
ACCESS IS SEQUENTIAL.

DATA DIVISION.
FILE SECTION.

FD G05
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 CODE-REC.

The error is COBCH0005, User-name G05 not unique
the error is on the SELECT G05 Assign to G05 line. Do we have to make the file name and assign names different or is there another way?

We are a batch system that is converting from NetExpress 5.1 to Visual Cobol 2022. When compiling we are getting errors with the file name and assign name being the same. This compiles without an errors in NetExpress.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
C01 IS H-O-F.
INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT G05 ASSIGN TO G05
FILE STATUS IS GT-STATUS
ACCESS IS SEQUENTIAL.

DATA DIVISION.
FILE SECTION.

FD G05
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 CODE-REC.

The error is COBCH0005, User-name G05 not unique
the error is on the SELECT G05 Assign to G05 line. Do we have to make the file name and assign names different or is there another way?

Hello,
Are your files mapped or ASSIGNED externally via an environment variable (external) or are you looking to move a filename into a working storage data item (dynamic)?

If externally, you need to set the compiler directive: assign"external". The default is assign"dynamic". In the dynamic case it is expecting a data item called G05 where you would move the actual physical file name into...e.g.:

move "myfile.dat" to G05.

As of now there is a conflict with the FD and the fact it is expecting a working storage data item called G05. 

If your intention is to map the G05 to file name that is externally assigned via environment variable, then set the directive assign"external"


Hello,
Are your files mapped or ASSIGNED externally via an environment variable (external) or are you looking to move a filename into a working storage data item (dynamic)?

If externally, you need to set the compiler directive: assign"external". The default is assign"dynamic". In the dynamic case it is expecting a data item called G05 where you would move the actual physical file name into...e.g.:

move "myfile.dat" to G05.

As of now there is a conflict with the FD and the fact it is expecting a working storage data item called G05. 

If your intention is to map the G05 to file name that is externally assigned via environment variable, then set the directive assign"external"

The same error occurs in Net Express 5.1 if you are not using the assign"external" directive.

I think perhaps you might have forgotton to bring over your COBOL.DIR or other directives file from NX?

You should ensure that you are using the same set of directives under both or your will run into problems...