COBOL - unable to rename output file

COBOL - unable to rename output file


Environment

OS Level : 4.1.2, 4.2.1, 4.3.3, 5.1
Compiler level: 1.1

Problem

I am unable to assign an external file in COBOL program.

The SELECT clause was of the form:

Select file-name assign TO lseqout

A file with the name lseqout was always created in the current working directory. The customer wanted the file name to be something other than "lseqout".

Solution

The solution is to change the clause to read:

Select file-name assign USING lseqout

One must also put the following entry in the Working-storage section.

01 lseqout pic x(50).

Lastly, one must add the following statement in the Prodecure division:

Move "/dir1/dir2/dir3/file-name-you-want" to lseqout

References

COBOL Language Reference Manual, Chapter 4, section on File-Control Paragraph.


[ Doc Ref: 76742271311101     Publish Date: Jan. 21, 2002]