Could you have a switch that was set to 'X' by default but to 'Y' by a debugging statement, and then your "if not debugging" test is switch NE 'Y'.
Do we really need to care about CPU cycles for a debugging "IF"? Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of McKown, John Sent: Monday, June 04, 2012 11:14 AM To: IBM-MAIN@bama.ua.edu Subject: Re: Is there an Enterprise COBOL API to detect SOURCE-COMPUTER "WITH DEBUGGING" on or off at runtime? Hum, I just thought of one reason why you might want to do this. That is if you want to __NOT__ do something if debugging is OFF. In HLASM, I use AIF, but I can do a "NE" test. In COBOL, there is not a character in column 7 to indicate "do not compile if debugging is OFF". I did think of a __terrible__ way to abuse the compiler, however. The line(s) you do NOT want to compile with DEBUGGING OFF need to have a GO TO statement immediately BEFORE them with a D in column 7. And the target be a CONTINUE with the label immediately AFTER them with a D in column 7. So that the GO TO will be compiled if DEBUGGING ON is specified. What this does is "branch around" the code to be ignored when DEBUGGING is OFF. The compiler will detect this condition, warn you that LINES ... THROUGH ... cannot be executed and then not even bother to insert any object code for that code. Ugly, but more CPU efficient than an actual IF. One problem is that this terminates the paragraph by introducing a new! LABEL. This would mean you'd likely need to do an out-of-oine PERFORM para1 THRU para1-EXIT for this sort of thing, just to be very safe. An example of this might be if you want to DISPLAY 'COMPILED WITH DEBUGGING OFF' UPON SYSOUT if DEBUGGING is OFF. Perhaps like: D DISPLAY 'COMPILED WITH DEBUGGING ON' UPON SYSOUT. D GOTO DBUG-1. DISPLAY 'COMPILED WITH DEBUGGING OFF' UPON SYSOUT. DDBUG-1. CONTINUE. I got the expected message: ==000078==> IGYOP3091-W Code from "DISPLAY (line 78.01)" to "CONTINUE (line 81.01)" can never be executed and was therefore discarded. But only if I used the OPTIMIZE compile parm. If I left it out, the code would compile. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN