I'm working under Microfocus Native cobol, and I want to create a Dynamic file name.
My Declaration is :
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUT-FILE ASSIGN TO DYNAMIC OUT-NAME
ORGANIZATION IS LINE SEQUENTIAL.
Then I read the file name from another file and place it into my OUT-NAME
and I create a file as:
OPEN OUTPUT OUT-FILE.
write OUT-RECORD.
CLOSE OUT-FILE.
This works fine when I have no spaces in the filename. But when I do, filename stops at the space
As an example we move a string into OUT-NAME
MOVE "C:\New Folder\Example.txt" INTO OUT-NAME
This creates a file in C:\
named New
As mentionned in the comments By Stephen Gennard the answer is to use double quotes inside single quotes
MOVE '"C:\New Folder\Example.txt"' INTO OUT-NAME