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?
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
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?
So is there no way to combine an environment variable with COBDATA?
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?
So is there no way to combine an environment variable with COBDATA?
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?
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.
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
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
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.
How are you expecting it to find the file, specifying the fully qualified name directly or via a variable as part of the select assign or via an environment variable at run time. Both are supported but the compiler option you specify will vary based on your answer.
Is this is a managed code project or native code project
How are you expecting it to find the file, specifying the fully qualified name directly or via a variable as part of the select assign or via an environment variable at run time. Both are supported but the compiler option you specify will vary based on your answer.
Is this is a managed code project or native code project
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 . . .
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 . . .
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.
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.
Here is a simple command line program and bat file to compile.
*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.
How are you expecting it to find the file, specifying the fully qualified name directly or via a variable as part of the select assign or via an environment variable at run time. Both are supported but the compiler option you specify will vary based on your answer.
Is this is a managed code project or native code project
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
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
I'm also on the latest version so it should be fine. For your issue writing, define file status for the files and if it's non-zero display it then you'll have an idea why your having the problem.
I'm also on the latest version so it should be fine. For your issue writing, define file status for the files and if it's non-zero display it then you'll have an idea why your having the problem.
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.
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
Hi Chris,
Since im using Personal Edition of VC i was not able to use COBDATA instead i had to fully qualify the path and file in the FILE-CONTROL paragraph otherwise i will always get file not found. I guess its a bug, but i can live with it. Thanks.
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.
Perhaps, what version/edition. The personal version does have some limitations. Otherwise it's likely process.
As for needing to put the full path in the program. Not required. You compile with the directive ASSIGN(EXTERNAL) and when you run it will resolve via environment variable
SELECT IN-FILE ASSIGN TO IN-FILE.
In DOS or Project Environment set
(Dos)
SET INFILE=D:\\DATA\\SALES.DAT
Hi Chris,
Since im using Personal Edition of VC i was not able to use COBDATA instead i had to fully qualify the path and file in the FILE-CONTROL paragraph otherwise i will always get file not found. I guess its a bug, but i can live with it. Thanks.
There are some limitations built into personal edition since it's designed for learning not building production apps. COBDATA being one.
There are some limitations built into personal edition since it's designed for learning not building production apps. COBDATA being one.
wow, would have saved me time. Ok now you know i have PE, will be using that for now. In my VC editor, all my periods when i save jump to a new line, yes has to do with smart editing, though its not that smart it seems. not sure where to turn that off. any ideas.
wow, would have saved me time. Ok now you know i have PE, will be using that for now. In my VC editor, all my periods when i save jump to a new line, yes has to do with smart editing, though its not that smart it seems. not sure where to turn that off. any ideas.
so i got rid of format on save, which now dont add the periods on new line, but now all the rest of smart editing dont work, like wraps, alignments and all.
There are some limitations built into personal edition since it's designed for learning not building production apps. COBDATA being one.
Steve thanks a lot, finally im able to cruise along in Cobol with VC, all i needed to know was a simple thing, how to access files. Thanks. Until next time.
Steve thanks a lot, finally im able to cruise along in Cobol with VC, all i needed to know was a simple thing, how to access files. Thanks. Until next time.
Look under Tools -> Options -> Text Editor- >Micro Focus COBOL. You can tweak quite a lot in terms of how editing works.
Good Luck
Look under Tools -> Options -> Text Editor- >Micro Focus COBOL. You can tweak quite a lot in terms of how editing works.
Good Luck
yes i had to go there quite a lot however, what you really need to do, was
go to preferences of eclipse since many of those colors are only set there,
and cant be set in the preferences of microfocus cobol. There is still one
color i still have no clue from where to change it. its the one that
highlights the same verb or data field in all places in the program. so say
i have a data-field the the procedure division called ws-company, then it
highlights it everwhere in the program, the font color i use is light since
i use dark background, but then when it highlights it, is also use light
colors and then you can see the font. Anyways looked for that cant change
the color of the background highlighter for matching data-fields or verbs.
yes i had to go there quite a lot however, what you really need to do, was
go to preferences of eclipse since many of those colors are only set there,
and cant be set in the preferences of microfocus cobol. There is still one
color i still have no clue from where to change it. its the one that
highlights the same verb or data field in all places in the program. so say
i have a data-field the the procedure division called ws-company, then it
highlights it everwhere in the program, the font color i use is light since
i use dark background, but then when it highlights it, is also use light
colors and then you can see the font. Anyways looked for that cant change
the color of the background highlighter for matching data-fields or verbs.
Ok so im a new Eclipse user, and unlike Visual Studio, turning off and on options is a piece of cake. Now yes MF cobol does have preferences, but like i said, many of the preferences are really set in the pref of Eclipse not MF Cobols preferences, these are two different things. To find where this highlight of code , you need to dig deep very deep, and turning things of and on, just dont cut it. So not to waste your time, and make you want to go back to using, Visual Studio, which i find very slow compared to Eclispe. Eclipse has a button on the toolbar, somewhere a third from the left, its called "toggle mark occurrences", its right after the "use step filter" button. Wow that took long to figure out. Anyways, if you are going to MF Cobol in Eclipse, be ready for a long, annoying, no useful help, learning curve. Before using MF Cobol in Eclipse, would suggest you first become an expert in eclipse. Last week i wasnt even able to create one program in MF with eclipse, now im creating like 10 new cobol programs a day. The next big learning curve will be using JCL in MF, not sure if it exists. In either case ill close this thread.
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.
Hello CobolWhiz,
By default, Visual COBOL applications look for (and create) data files in the current Present Working Directory which is in effect while the program is running.
When you are running a COBOL program from the command prompt (outside the IDE), this will be the current directory when the program was launched.
When you are running or debugging a COBOL program within the Visual COBOL for Eclipse IDE, the Present Working Directory will depend on whether you are using Native or JVM COBOL projects:
- For Native COBOL, the default Present Working Directory will be the New_Configuration.bin directory within the project. This is the same default location where the executable files for your COBOL programs are built.
- For JVM COBOL, the default Present Working Directory will be the main Project directory
As mentioned elsewhere, you can use COBDATA environment variable to specify an alternate location (or list of locations) to be searched for data files. You can find more background about the use of COBDATA on this page in the documentation.
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
Hello CobolWhiz,
In one of your posts, you mentioned attempting to set an environment variable in the Visual COBOL for Eclipse IDE (within your Project's Properties) at:
"Micro Focus -> Build Configurations -> Build Environment"
Please note that the "Build Environment" setting is literally that - it allows you to control the environment settings that are in effect when your programs are *built* - basically, this is a compile-time-only setting. These won't be in effect at runtime, so the running program won't see them.
Here are a couple of options for setting environment variables so that they will be in effect at runtime within the Eclipse IDE:
- You may already have an Eclipse Debug/Run configuration for your program (please note that one of these is automatically created when you first try to run or debug a program in the IDE.) If this is the case, you can modify the existing Debug/Run configuration to include your environment variable by (on the Eclipse menu) going to Run->Debug Configurations. select your Run/Debug configuration, then go to the Environment tab, and add the desired environment variable(s).
- If you have not yet created a Debug/Run configuration, you can set this generally for the Project, at:
"Micro Focus -> Run-time Configuration -> Environment Variables". Environment variables set at this location will be automatically copied into any new Debug/Run Configurations when they are created.
Hello CobolWhiz,
In one of your posts, you mentioned attempting to set an environment variable in the Visual COBOL for Eclipse IDE (within your Project's Properties) at:
"Micro Focus -> Build Configurations -> Build Environment"
Please note that the "Build Environment" setting is literally that - it allows you to control the environment settings that are in effect when your programs are *built* - basically, this is a compile-time-only setting. These won't be in effect at runtime, so the running program won't see them.
Here are a couple of options for setting environment variables so that they will be in effect at runtime within the Eclipse IDE:
- You may already have an Eclipse Debug/Run configuration for your program (please note that one of these is automatically created when you first try to run or debug a program in the IDE.) If this is the case, you can modify the existing Debug/Run configuration to include your environment variable by (on the Eclipse menu) going to Run->Debug Configurations. select your Run/Debug configuration, then go to the Environment tab, and add the desired environment variable(s).
- If you have not yet created a Debug/Run configuration, you can set this generally for the Project, at:
"Micro Focus -> Run-time Configuration -> Environment Variables". Environment variables set at this location will be automatically copied into any new Debug/Run Configurations when they are created.
all i wanted to do was simply to access a file, the simplest possible way. without making it super complicated, i only looked at cobdata, since i thought microfocus absolutely required that to access any files. But all i needed to do was in eclipse use ../ for file in project or include complete path if it was outside project. in about 99% of the other cobol editors all you need to do, is keep the file in the project folder and just give combol name of file, and it works like a charm. Unfortunately it took me 3 weeks to figure out how to access files in VC, and i have been to many other chat sites before i finally got here, and still noone bothered to tell me. That the jist of what happened. I was just told that PE is an inferior version, and that i should watch the beginner videos, instead of someone saying just enter the full path.