AGE
AGE

Reputation: 3792

trying to run COBOL .exe using C++ program

I'm still learning how to program but I have a simple question. I have the following code for running an executable COBOL program through C++, but I am getting COBOL errors: 251 and 410

#include <iostream>
#include <windows.h>

using namespace std;

int main(){
    system("C:\\rmcobol\\runcobol.exe SOLOCAJA.COB c=windows.cfg L=WOWRT.DLL"); 
    cout << "\n";
    system("pause");  
    return 0;
}

I assume there must be a very simple reason for this, but I am clueless so far. Any help would be highly appreciated.

Upvotes: 1

Views: 1826

Answers (1)

paxdiablo
paxdiablo

Reputation: 881093

Error 410 is a "configuration file not found" error based on Apendix A of the user guide. Are you sure your windows.cfg file is in the directory you're running your code in?

Failing that, error 251 states "Incorrect runtime command" and all the samples I can find have an uppercase C. So maybe change your C program to use to:

system("C:\\rmcobol\\runcobol.exe SOLOCAJA.COB C=WINDOWS.CFG L=WOWRT.DLL");

and see if that fixes it (a long shot, I know, but I've seen stranger things than that).


Based on update:

I tried changing the c to a C on the C=WINDOWS.CFG, ran it in C++ and directly on the Command Line, no change. I am still looking into the reasons behind this, and I read through tek-tips.com/viewthread.cfm?qid=1119251&page=5 but I couldn't use any of that info. Any extra tips would be gold at this point. THANKS!

A couple of questions:

  • Has it ever worked in this environment?
  • Is it failing on both cmdline and within C (just want to clarify)?
  • Does windows.cfg actually exist in the current directory when you run it?
  • Are you running it in a directory with spaces (like My Documents)?

Other than that, maybe post the windows.cfg file, though the error seems pretty explicit that it's config file not found rather than error in config file.

Upvotes: 2

Related Questions