Skip to main content

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Thanks. That helps a little, but won't work if my program is running on Unix.

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Thanks. That helps a little, but won't work if my program is running on Unix.

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Thanks. That helps a little, but won't work if my program is running on Unix.

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
A method that is portable is to enable the D symbol in the indicator area (e.g. pos 7).

If you for instance want to have a message box display if you execute under the debugger:

Change this:

DISPLAY MESSAGE BOX "With debugger!".

to:
D DISPLAY MESSAGE BOX "With debugger!".

(Note that the D is supposed to be in column 7 and DISPLAY starts in column 12... I intended to format this better, but this editor isn't my pal today... )

and compile with -Sd in addition to -Zd.

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
That would let me know if a program was compiled with the debugger, but I would like to know when the program is being *run* with the debugger (runcbl -d or wrun32 -d), regardless of how it was compiled.

It's an odd request, but I have a need to start another runtime to run something, and I would like the second runtime to have the debugger on if the original runtime had the debugger on, and vice versa.

I can't use CALL RUN because I need the two runtimes to execute simultaneously, and I don't want to use threads because I would have to do some major restructuring of some things because of some global external variables that are used, so starting a second runtime keeps things simple.

(Now, if I could do CALL RUN IN THREAD.....)

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Well, assuming this is something not going public (e.g. to end users), you could always set an environment variable indicating the status in a batch file and then read that from within the cobol app...

Like...

SET DEBUG-MODE = 1
wrun32 -d myapp

inside the app:

ACCEPT DBG FROM ENVIRONMENT ...


and so on...

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Well, assuming this is something not going public (e.g. to end users), you could always set an environment variable indicating the status in a batch file and then read that from within the cobol app...

Like...

SET DEBUG-MODE = 1
wrun32 -d myapp

inside the app:

ACCEPT DBG FROM ENVIRONMENT ...


and so on...

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Well, assuming this is something not going public (e.g. to end users), you could always set an environment variable indicating the status in a batch file and then read that from within the cobol app...

Like...

SET DEBUG-MODE = 1
wrun32 -d myapp

inside the app:

ACCEPT DBG FROM ENVIRONMENT ...


and so on...

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
Another way that you can do this, is to use the statement :

ACCEPT ws-item FROM COMMAND-LINE

This will return the value of the command line that was used to start the run unit. From here you can inspect the item returned and see if the debugger option (-d) was used within the original command line.

[Migrated content. Thread originally posted on 05 April 2004]

Is it possible to know at runtime whether or not the debugger is enabled (-d used on the command line)?
ACCEPT FROM COMMAND-LINE won't include the -d. It only returns the part of the command line after the program name.

If I execute: wrun32 -d myprog.acu a b c

then ACCEPT FROM COMMAND-LINE only returns "a b c".