X"91" call outs do not seem to work in managed code under visual studio

[Migrated content. Thread originally posted on 08 May 2012]

Have a problem with x"91" call outs in managed code.

Code reads as...

01 command-lin-string pic x(80) value "dir/w".

01 RESULT PIC X COMP-X.
01 FUNC PIC X COMP-X VALUE 35.
01 COMMAND-LIN.
03 COMMAND-LIN-LENGTH PIC X COMP-X VALUE 0.
:
:
DISPLAY COMMAND-LIN-STRING UPON COMMAND-LINE.
CALL x"91" USING RESULT, FUNC, COMMAND-LIN.
IF RESULT = 0
MOVE "01" to lnk-error-status
END-IF.

No DOS box appears showing a directory listing (as it does in UNMANAGED code) but RESULT comes back as 0!


Managed code as defined by Application (program) output as Class library under .Net Framework 4.0
Parents
  • Chris Glazier originally wrote:
    The X"91" function 35 should work correctly in a managed code console application.

    I believe that you are trying to call it from a Windows Forms application and no console window exists for it to display to.

    The only reason it works with CBL_EXEC_RUN_UNIT is that you are setting the flag bit to force it to create a new console for the new process.

    This flag is not available with X"91" function 35.



    We were attempting to take legacy code into a .NET environment with Windows forms replacing GUI Dialog screens. The form allowed for a backup of data files to be carried out which, for the 'old' code meant a call out to a batch file that would then call winzip and perform a 'dos box' operation.

    As you quite rightly say the x'91' call in managed code does not allow for this process to operate but thanks to the boys at Microfocus a solution was found.

    In converting our 'legacy' code into the new world of .NET there are sure to be a number of things that we, ourselves, come across that won't quite work the way we thought they might so I'll continue to post up issues we get and hopefully they'll become of use to others going down the same path over time as they get solved.
Reply
  • Chris Glazier originally wrote:
    The X"91" function 35 should work correctly in a managed code console application.

    I believe that you are trying to call it from a Windows Forms application and no console window exists for it to display to.

    The only reason it works with CBL_EXEC_RUN_UNIT is that you are setting the flag bit to force it to create a new console for the new process.

    This flag is not available with X"91" function 35.



    We were attempting to take legacy code into a .NET environment with Windows forms replacing GUI Dialog screens. The form allowed for a backup of data files to be carried out which, for the 'old' code meant a call out to a batch file that would then call winzip and perform a 'dos box' operation.

    As you quite rightly say the x'91' call in managed code does not allow for this process to operate but thanks to the boys at Microfocus a solution was found.

    In converting our 'legacy' code into the new world of .NET there are sure to be a number of things that we, ourselves, come across that won't quite work the way we thought they might so I'll continue to post up issues we get and hopefully they'll become of use to others going down the same path over time as they get solved.
Children
No Data