Community in read only mode June 18 & 19
This community will be set in READ ONLY mode for a while on Tuesday June 18 into Wednesday June 19 while we import content and users from our Micro Focus Forums community site. MORE INFORMATION
Melchor Diesta Contributor.
Contributor.
234 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
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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)

 

 

–Ғɑɳօ
4 Replies
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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)

 

 

–Ғɑɳօ
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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
Melchor Diesta Contributor.
Contributor.

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

Jump to solution

Thank you, Sir.

0 Likes
Melchor Diesta Contributor.
Contributor.

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

Jump to solution
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.