0

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

raz_user
  • 127
  • 1
  • 1
  • 9
  • Thanks for the reply, I am using Windows, and I just forgot to use backslash in the below example, I edited my question – raz_user Aug 26 '15 at 22:05
  • @BillWoodger I found no solution to my problem. I tried to contact Microfocus, but they are asking so many questions, they want to make sure that I have the full edition before providing help, which I have, but I can't prove – raz_user Aug 27 '15 at 16:32
  • 1
    Have you tried quoting the filename eg: MOVE '"C:\New Folder\Example.txt" INTO OUT-NAME"' (note: the single quotes with a double quotes inside it) – Stephen Gennard Sep 02 '15 at 07:31
  • @StephenGennard it works, thank you so much, I would never thought about that. – raz_user Sep 08 '15 at 08:28
  • the answer was posted, thank You – raz_user Sep 08 '15 at 10:22
  • OK, thanks, tidying away the comments a bit then. – Bill Woodger Sep 08 '15 at 11:00

1 Answers1

1

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
raz_user
  • 127
  • 1
  • 1
  • 9