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.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets(r)
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets(r) is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The
MEGA Life and Health Insurance Company.SM
> -----Original Message-----
> From: IBM Mainframe Discussion List
> [mailto:[email protected]] On Behalf Of Farley, Peter x23353
> Sent: Monday, June 04, 2012 12:38 PM
> To: [email protected]
> Subject: Re: Is there an Enterprise COBOL API to detect
> SOURCE-COMPUTER "WITH DEBUGGING" on or off at runtime?
>
> John,
>
> Thanks for clearing my mind on this. You're right, it really
> is not something I should do, since as you say the code with
> "D"ebugging marks in column 7 is either there or not there
> after the compile is done. I think I was trying to provide
> for dynamically (perhaps via PARM) controlled "D"ebugging
> code, but after I thought about it again I realized that
> solution is just as easily done with regular non-"D"ebugging
> lines controlled by a switch in WOORKING-STORAGE, and forget
> about using WITH DEBUGGING entirely.
>
> Peter
>
> -----Original Message-----
> From: IBM Mainframe Discussion List
> [mailto:[email protected]] On Behalf Of McKown, John
> Sent: Monday, June 04, 2012 1:22 PM
> To: [email protected]
> Subject: Re: Is there an Enterprise COBOL API to detect
> SOURCE-COMPUTER "WITH DEBUGGING" on or off at runtime?
>
> I don't know of a way to detect that via an API call. I am
> curious as to why you want to. Seems inefficient to me. The
> compiler knows at compile time if WITH DEBUGGING is ON or
> OFF. So why use up CPU cycles determining something that is
> already determined at compile time. Whatever you are going to
> do in the source if it is ON, just use the D indicator to
> determine it at compile time and "hard code" it then. I don't
> do much COBOL, but in HLASM I do something similar with the
> SYSPARM("DEBUG"). And I always just test that at assembly
> time with an AIF.
>
> --
> John McKown
> Systems Engineer IV
> IT
> <Snipepd)
> > -----Original Message-----
> > From: IBM Mainframe Discussion List
> > [mailto:[email protected]] On Behalf Of Farley, Peter x23353
> > Sent: Monday, June 04, 2012 12:12 PM
> > To: [email protected]
> > Subject: Is there an Enterprise COBOL API to detect
> > SOURCE-COMPUTER "WITH DEBUGGING" on or off at runtime?
> >
> > The subject is the question. Obviously I can insert a
> > WORKING-STORAGE switch that is off by default and a
> > "D"ebugging line in the PROCEDURE division to turn "on" that
> > switch when "WITH DEBUGGING" is in effect, but this seems
> > clumsy to me.
> >
> > If there is another way, I'd appreciate any info you can provide.
> >
> > Peter
> --
>
> This message and any attachments are intended only for the
> use of the addressee and may contain information that is
> privileged and confidential. If the reader of the message is
> not the intended recipient or an authorized representative of
> the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited.
> If you have received this communication in error, please
> notify us immediately by e-mail and delete the message and
> any attachments from your system.
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN