
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
COBDATA question
I'm running Micro Focus Enterprise Developer and can't seem to get it to recognize the directory where all my data files(.dat) are. I'm running a PowerShell script that sets up an environment variable, i.e.;
$env:dd_MYFILE = "MYFILE.dat"
In the script I also try to set COBDATA, before running the batch program,i.e.;
[Environment]::SetEnvironmentVariable("COBDATA", "c:\data", "User")
Then I run the batch program that opens this file but am getting an error 35 in the file status after the open. In the COBOL, the select looks like:
SELECT MYFILE ASSIGN TO "MYFILE"
ORGANIZATION IS INDEXED
If I change the PowerShell script to the full path, i.e.;
$env:dd_MYFILE = "c:\data\MYFILE.dat"
then the file opens successfully.
For Visual COBOL is there a different way to specify data file locations?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
The problem is that when you are assigning the file to an environment variable as in dd_MYFILE then it will not search the location specified in COBDATA.
It instead expects you to provide the complete path name including the filename within dd_MYFILE.
If you assign to just the actual filename in the select assign instead of to an environment variable then it will search COBDATA.
Example:
SELECT MYFILE ASSIGN TO "MYFILE.dat"
ORGANIZATION IS INDEXED
and COBDATA is set to c:\data then it will combine them and look for c:\data\myfile.dat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
So is there no way to combine an environment variable with COBDATA?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
this is exactly what i have been trying to figure out now for three weeks, have tried every single combination known, and still it wont find the file. Looked everywhere on the net, asked in all the forums, still none have even suggested an answer. I finally called overseas and asked tech support, but something like this should be easy, it like asking how can you do a binary sort in Algol. If i run this in GNUCOBOL will run, with no directives first time, but here no matter what directive you enter, for windows, like ; or "path/file" or "path" nothing works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Chris this is exactly what i have.
SELECT SALESFILE ASSIGN TO "SALES.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PRINT-FILE ASSIGN TO "SALESREPORT.DAT".
Then in my properties for the project in the
Micro Focus -> Build Configurations -> Build Environment I have
"c:\users\wizto\workspace\tictac"
and all i constantly get is
I/O error : file 'SALES.DAT'
error code: 3/5 (ANS85), pc=0, call=1, seg=0
13 File not found

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Is this is a managed code project or native code project

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Wow Steve if you can help me, youll save me 3 weeks of constant frustration with this stuff. So Here is the part from the File-Control Paragraph.
FILE-CONTROL.
SELECT SALESFILE ASSIGN TO "sales.dat"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PRINT-FILE ASSIGN TO "salesreport.dat".
Now I crated a simple Native Cobol Program in VC. the cbl program and the dat files are under that folder.
And its called tictac, so if i go to properties of the Navtive project -> Mcro Focus -> Build Configurations -> Build Environment ->
I have "c:\users\wizto\workspace\tictac" for the variable COBDATA
and all im getting again and again is
I/O error : file 'sales.dat'
error code: 3/5 (ANS85), pc=0, call=1, seg=0
13 File not found
Press any key to continue . . .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Steve when i first got here, last week, my question was how do i get VC to work with Eclipse. Well a long story short, in my current situation, i was never going to work, only due to either Eclipse or VC being so sensitive, with my current pc config, of many linux distros, wsl, upgrades to Windows 20 and such, spent weeks on that, at the same time also tried to set up files in Visual Studio VC, and couldn't get files to work.
So formatted PC, removed about 500 gigs of apps, including distros, office, adobe, SQL versions, Ruby, Phython, Visual Studio versions, VSCode you name all gone. Installed Eclipse for Java and VC, now i finally got VC to work. But now couldnt get the Eclipse preferences to work as they show in the MF videos, well turns out, its quite different in latest version of Eclipse, and doesnt work at all the way described in videos. Also instead used Eclipse for Enterprise seems a bit more pleasant. So, now the last issue is this COBDATA. Thats where im stuck now, not really for weeks in Eclipse, but have tried to access files now in VC for weeks starting first with Visual Studio, with no luck.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
*set assign(external)
identification division.
program-id. fileio.
environment division.
input-output section.
file-control.
select file-out assign to "TEST.DAT".
select file-in assign to "TEST.DAT"
file status is file-in-status.
data division.
file section.
fd file-in.
01 input-record pic x(80).
fd file-out.
01 output-record pic x(80).
working-storage section.
01 sub1 pic 99 value 0.
01 file-in-status pic xx value '00'.
procedure division.
open output file-out.
display 'Writing file'.
perform varying sub1 from 1 by 1
until sub1 = 11
move all 'A' to output-record
display 'Writing record ' sub1
write output-record
end-perform.
close file-out.
open input file-in.
display 'Reading input file'.
perform until file-in-status not equal '00'
read file-in
if file-in-status = '00'
display input-record
end-if
end-perform.
close file-in.
goback.
BAT File to Compile and Run
ECHO ASSIGN(DYNAMIC) > COBOL.DIR
cbllink -V fileio.cbl -UCOBOL.DIR
@ECHO RUNNING NATIVE COBOL PROGRAM WITH DYNAMICLY DEFINED FILES
FILEIO
Writes out a file with 10 record, reads it back in displaying them. File will be in current directory.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
ok so instead of using cobdata i simply entered the full path and file in the file-control paragraph, and now it can find the files, but it stops as soon as it tries to write to the file. well i think the cobdata may not work, again is since im using latest version of eclipse with latest version of VC

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Steve here is what i realized about VC at least this edition. Only if i place the full path in the program with the file does it work, if i use COBDATA, and trust me i have now at least 30 times, all kinds of ways, and nada. So for me, if i have to enter full path no problem, at least it works, i can deal with minor imperfections. At least now i can use VC normally and try out all kind of things, until i get to DB2 and CICS, but until then i should be fine. By the way Steve you may be using Micro Focus Cobol, im using the PE which i do think is why im not getting the same results as you. Steve thanks for taking your time, to help me out, it been three weeks of nightmares im happy its now over.