Highlighted
Contributor.
Contributor.
570 views

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

Jump to solution

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!

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

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)

 

 

–Ғɑɳօ

View solution in original post

4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

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)

 

 

–Ғɑɳօ

View solution in original post

Highlighted
Micro Focus Expert
Micro Focus Expert

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.

Blair McDonald

Highlighted
Contributor.
Contributor.

Thank you, Sir.

0 Likes
Highlighted
Contributor.
Contributor.
Thank you, Sir.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.