Skip to main content

Problem:

This can be done in two ways:

1)  Implementing the Windows CreateProcess API  for which a demo is attached.

2)  Implementing the library call routine:  X"91" function 35 library routine

Resolution:

1)  CreateProcess API call.  Attached is a demo showing how to use this call. For further information on the CreateProcess API go to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp

2)  X"91" function 35 library routine

This routine carries out an EXEC call to the specified program file which executes it.

The syntax used is:

call x"91" using  result

                          function-code

                          parameter

The parameters used are (using call prototype pic on 32 bit systems):

result                      cblt-x1-compx                pic x comp-x.

function-code         cblt-x1-compx                pic x comp-x.

parameter              Group containing:          Group containing:

  name-len                 cblt-x1-compx                pic x comp-x

  progname                pic x(n)                          pic x(n)

On Entry:

function                 Value 35

name-len               The number of characters in the name of the program. If this is set to zero,   

                              whatever has been previously written to the command line is executed.

progname              The filename of the program to be executed.

On Exit:

result                    Zero if the EXEC call was successful, nonzero otherwise. If the reason for

                             failure is an operating system error and has a number less than 255, that

                             number is returned. If the number is more than 255, 255 is returned.

Addition information:

In order to execute a command line instead of just a named program, set name-len to zero and then set the command line using the  DISPLAY...UPON COMMAND-LINE syntax.

Please also note that a small black DOS prompt window will briefly appear when using this routine.

Attachments:

comport.zip

Old KB# 4256

Problem:

This can be done in two ways:

1)  Implementing the Windows CreateProcess API  for which a demo is attached.

2)  Implementing the library call routine:  X"91" function 35 library routine

Resolution:

1)  CreateProcess API call.  Attached is a demo showing how to use this call. For further information on the CreateProcess API go to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp

2)  X"91" function 35 library routine

This routine carries out an EXEC call to the specified program file which executes it.

The syntax used is:

call x"91" using  result

                          function-code

                          parameter

The parameters used are (using call prototype pic on 32 bit systems):

result                      cblt-x1-compx                pic x comp-x.

function-code         cblt-x1-compx                pic x comp-x.

parameter              Group containing:          Group containing:

  name-len                 cblt-x1-compx                pic x comp-x

  progname                pic x(n)                          pic x(n)

On Entry:

function                 Value 35

name-len               The number of characters in the name of the program. If this is set to zero,   

                              whatever has been previously written to the command line is executed.

progname              The filename of the program to be executed.

On Exit:

result                    Zero if the EXEC call was successful, nonzero otherwise. If the reason for

                             failure is an operating system error and has a number less than 255, that

                             number is returned. If the number is more than 255, 255 is returned.

Addition information:

In order to execute a command line instead of just a named program, set name-len to zero and then set the command line using the  DISPLAY...UPON COMMAND-LINE syntax.

Please also note that a small black DOS prompt window will briefly appear when using this routine.

Attachments:

comport.zip

Old KB# 4256

the answer is helpful