In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
How are you diagnosing this? Are you calling C$GetEnv to fetch the RUNPATH value both before and after you invoke the CommonDialog?
And, if it is changing, perhaps this gives you a hint about how to reestablish the value of RUNPATH with C$SetEnv.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Are you using relative directory paths in the RUNPATH? The Windows common file browser can change the working directory to the directory that contains the found file, so maybe that's why the RUNPATH isn't resolving properly after the dialog is used.
You might be able to test this by ensuring RUNPATH only contains absolute paths, but other things might go wrong as well if the directory is changed, unless the COBOL programs are expecting that. You might check the ActiveX control to see if it has an option to not change the working directory, or you can have the COBOL program set it back when the ActiveX control finishes.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Uwe, how is changing the current directory accomplished from a COBOL program?
I know you can read the value of the "CD" environment variable (one of the standard built-in environment variables) but CD is a read-only environment variable (among other limitations) because it is only a pseudo-variable.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
I diagnosed this by running my program, and after I browsed for the file, the program continued processing, and did a "CALL" to another program, and my program halted with a 204 error. The program that the program is looking for exists and is in the same folder that the program that uses the ActiveX control is in.
I need to reset the Working directory back to what it was when the program is first run. How is this accomplished?
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
As I asked Uwe above. I am not aware of any built-in way of doing this.
Do you have access to the source for the ActiveX that is invoking the CommonDialog? If so, then you can set the OFN_NOCHANGEDIR flag in the OPENFILENAME structure (see here). This will change the behavior from the ancient (reaching back to Windows 3.1) default behavior and stop changing the working directory.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
The easiest way is to prevent your ActiveX control from changing the working directory. There is a flag that can be specified to prevent the dialog from changing the working directory. Hopefully your ActiveX gives you access to that.
Off the top of my head, I can't think of any C$-type function that lets you change the current working directory (and Tom Morrison would certainly know if there was such a thing). You could definitely do it yourself with a non-COBOL subprogram. I would guess that we don't provide such a function because it would cause exactly the kind of problem that you're experiencing.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Oops, looks like Tom and I overlapped. :-)
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
There are two ways to accomplish this.
1. Use CALL "C$SetEnv" USING "runpath" "Path Directory" to get back to your rmcobol files; or
2. Use CALL "_GETCWD" USING RMCOBOL-DIRECTORY-FILES, WS-LONG-DIR in order to save the address of your rmcobol files and before use the activex. After you get the requested information form your activex, use CALL "_CHDIR" USING RMCOBOL-DIRECTORY-FILES to get back to your working directory.
_GETCWD and _CHDIR are C routines you can find in this RM-COBOL forum.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
"_GETCWD and _CHDIR are C routines you can find in this RM-COBOL forum."
A search was unsuccessful at finding these (except for this thread). Can you provide a link, please?
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Sorry, I couldn't find too.. Some years ago I've downloaded from a rmcobol forum website. You can find these routines in this Spanish forum:
wb.itboards.com/.../default.asp
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
hbetancur - for the "_GETCWD" and the "_CHDIR", - is the RMCOBOL-DIRECTORY-FILES a field defined somewhere in my program, or do i just put it there and hope the program knows what to do with it?
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Hi. You have to define the fields in WS section of your current program.
01 GETDIR-ARGS.
02 WS-LONG-DIR PIC 9(5) VALUE 80.
02 WS-DIRECTORY PIC X(80).
CALL "_GETCWD" USING WS-DIRECTORY, WS-LONG-DIR.
CALL "_CHDIR" USING WS-DIRECTORY.
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Hi to all,
This is a dll we built in 2007 using codebridge to do some important things not present in RM/COBOL, like
- Generating a random number
- See current directory
- Create a Directory
- Change current Directory
- Delete Directory
- Validate a date
- Add one day to a date
- Subtract one day to a date
- Days between two dates
- Day of week for a date
Attached please find a zip file containing the dll and a sample cobol program to call all those functions.
If you need the C code just let me know.
Regards,
Juan Urraburu
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
hbetancur - I'm getting a 204 error when I call _GETCWD What dll does this reside in?
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
runcobol.exe yourprogram.cob l=yourdll.dll
In the program I am working on, there is an ActiveX control that calls the CommonDialog in Windows to allow the user to find a file out in their computer directories. That is all working great.
The issue I am encountering is after the file is found, the COBOL program looses the RUNPATH, and can no longer find any of the other files that are used in the program.
Is there a way to find the RUNPATH again?
Thanks for the zip file Juan! Since I don't currently have a DLL that does any of this, this will help greatly!