Problem:
Is it possible to get a COBOL program, in the MFE IDE, to call an executable that is not compiled in MFE, such as an .exe? Would this be done via a CALL? If .exe's are not executable from within IDE, what programs may be?
I keep getting stuck where I attempt to call an EXE (via a call statement). IDE keeps giving me the 173 error message, even with the EXE being in the same loadlib as the cobol program calling the EXE
Example
77 EXEC-NAME PIC X(08) VALUE 'PROGRAMA'. <--name of the exe (PROGRAMA.EXE)
CALL 'PROGRAMA'.
and
CALL EXEC-NAME
give me 173 errors.
Is what I am trying to do possible??
Resolution:
One can not CALL an EXE from a Micro Focus INT or GNT, but you can CALL a Non-mainframe program (Micro Focus dialect in MFE) and issue a shell to DOS and from there either execute a command line that executes the EXE or execute the EXE file directly passed on the Micro Focus CALL (x'91' function code =35).
Also, you will not get back any passed parameters since once the DOS shell is closed, no parms can be returned. So the best way to get parms back is to write them to a file.
I am including a sample program that shows this x'91' FC=35 call. As you can see, you can execute a batch file or a command or an EXE directly.
Working-Storage Section.
1 Cmd-Line-Str.
2 Pic X(45)
* value 'RUN $IMSDIR\\PCIMS RUNIMS BMP,DBUTIL,DEMO001T'.
* value 'run lorince'.
value 'dir c:\\ /o > d.d'.
2 N-1 Pic X Value Low-Value.
1 Call-Func Pic X Comp-X Value 35.
1 Result Pic X Comp-X.
1 Cmd-Line-Len Pic X Comp-X Value 0.
Procedure Division.
P1.
Display Cmd-Line-Str upon Command-Line
Call x'91' using Result, Call-Func, Cmd-Line-Len
If Result = Zeroes
Display 'Call worked'
End-If
Goback.
#MFDS
#EnterpriseDeveloper