× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 30-Aug-2011 09:21 , Timothy Adair wrote:
Is there a way in CL to set up a monitor that would increment a
counter after each line of code (or each command) is executed?

Just change the non-OS CL statement processor to perform the counting and any optional action(s) after each line of CL is read [and processed]. As a CL stream with no programmed logic to skip statements, that is about the best way to know the total number of statements that will be processed from start-to-end.

Although presumably CLP was meant instead of using scripted and interpreted CL.? So more likely... Change from using a compiled CLP to using a CL statement processor which does that extra work, or change to use an interpreter like REXX. REXX even has a SOURCELINE() function which, depending on implementation, could be useful in that regard.

There is also STRDBG with ADDBKP BKPPGM() [Add breakpoing; Breakpoint program to call] that a CLP could use with static labels or dynamically generated breakpoints by review of the source. There is little benefit however, for using static labels over CALLSUBR, coded in the same places of the source.

Better for a CLP is STRDBG with ADDTRC TRCPGM() [Add trace; Trace handling program] which for STMT(*ALL) can enable an exit after every executable CL statement. However the total number of statements would have to be coded statically or dynamically retrieved or estimated [optionally cached for each invocation after the first if that were costly processing], for use in the trace exit-program. The mention of "batch processing" in the help text of ADDTRC belies the actual effect from my recollection of my own experience for use interactively.

In either case above using STRDBG, the CLP could be coded to debug itself, but that is not something most people would like to do. The debug and trace in the latter case allows the process to be most generic and independent, esp. if the total number of statements is determined dynamically.

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.