I couldn't locate my input when I use select assign to '../../../' in a native cobol project

Good day.


Here's the piece of code that has being going through my head.

*******************************************************************************

file-control.
*
select my-file
assign to '../../../files/myfile.dat'
organization is line sequential.

*******************************************************************************

I keep getting below error:
MicroFocus.COBOL.Program.COBOLFileHandlingException: ''../../../files/myfile.dat' : 9/009 (ANS74)
9 Directory not found'

I wanted to retain '../../../' as part of the directory. Can anyone help me please?

Thanks a million!

Parents
  • Verified Answer

    The location of the file (../../../files/myfile.dat) is resolved from the location where your program actually resides.

    If you're building the program with the default output path, which .\bin\Debug\, then the ../../../files/ folder should be at the same level as the project folder.

     

    |_ProjectFolder
    | |_bin
    |   |_Debug (output path where the program is built)
    |_Files (where myfile.dat is)

     

     

  • Fano's excellent example is for Visual COBOL for Visual Studio. If you are instead using Visual COBOL for Eclipse (and using the default project location) this would be the directory structure:

    |_Directory *containing* Workspace Folder
    | |_Workspace Folder | |_Project Folder | |New_Configuration.bin (output path where the program is built) |_files (where myfile.dat is)

    So in Eclipse, the files directory would need to be in the directory *above* the Workspace location.

Reply Children
No Data