Include Pyton in cobol

who as experience and have included pyhton?

thanks for more Information!

Parents
  • CALL "SYSTEM" is in general not a good idea. It's difficult to creating security vulnerabilities, for one thing. And as an integration mechanism it's limited to pipes and filesystem objects for exchanging data, and to in-band signaling (commands embedded in data) and process termination for control flow.

    What problem are you trying to solve? Don't start by asking about technology - ask about problems and solutions.

    Python is an interpreted language with its own runtime. Since Micro Focus doesn't provide a backend that compiles COBOL to Python bytecode, you can't run COBOL under the Python interpreter. So in order to run Python and COBOL in the same process you have essentially four choices:

    • Embed the Python interpreter and runtime in a COBOL process.
    • Embed one of the COBOL runtimes in a Python process.
    • Use a Python variant that compiles to one of the execution environments for COBOL. For example, you could use Managed COBOL for .NET and IronPython, which compiles Python to .NET. Then you would have separate COBOL and Python assemblies which could interact in the same process.
    • Implement your own Python interpreter and runtime which you can embed in COBOL. This would not be trivial.

    These approaches have different trade-offs. Since we don't know what exactly you want to achieve or why, I can't say which might be best.

    If you want to mix Python and COBOL in the same source file ... well, that's not going to happen, unless you want to write a precompiler of some sort.

Reply
  • CALL "SYSTEM" is in general not a good idea. It's difficult to creating security vulnerabilities, for one thing. And as an integration mechanism it's limited to pipes and filesystem objects for exchanging data, and to in-band signaling (commands embedded in data) and process termination for control flow.

    What problem are you trying to solve? Don't start by asking about technology - ask about problems and solutions.

    Python is an interpreted language with its own runtime. Since Micro Focus doesn't provide a backend that compiles COBOL to Python bytecode, you can't run COBOL under the Python interpreter. So in order to run Python and COBOL in the same process you have essentially four choices:

    • Embed the Python interpreter and runtime in a COBOL process.
    • Embed one of the COBOL runtimes in a Python process.
    • Use a Python variant that compiles to one of the execution environments for COBOL. For example, you could use Managed COBOL for .NET and IronPython, which compiles Python to .NET. Then you would have separate COBOL and Python assemblies which could interact in the same process.
    • Implement your own Python interpreter and runtime which you can embed in COBOL. This would not be trivial.

    These approaches have different trade-offs. Since we don't know what exactly you want to achieve or why, I can't say which might be best.

    If you want to mix Python and COBOL in the same source file ... well, that's not going to happen, unless you want to write a precompiler of some sort.

Children
No Data