adesutherland / CMS-370-BREXX

VM/370 Port of BREXX
Other
7 stars 5 forks source link

A 'SET EXECTRAC ON' command inside an EXEC does not turn on interactive trace #53

Open BobBolch opened 3 years ago

BobBolch commented 3 years ago

Tracing is turned on, but not interactive trace. The VM EXEC processor turns on interactive trace when this command is issued within an EXEC. Also a 'SET EXECTRAC OFF' command runs the following command instead of turning tracing off.

I don't know when checks are made, but if tracing is off at the begining of a statement (after being turned off in the previous statenment, then the statement should not be traced.

This is low priority. I recommend we get a release out to VM users before starting work on this.

Test case:

/ /
address ''
'SET EXECTRAC ON'
/ Test data /
rec.1 = '01234567890 $678901234567890123456789012345 '
rec.2 = '901234567890 45678901234567890123456789012345 '
rec.3 = '8901234567890 345678901234567890123456789012345 '
rec.4 = '78901234567890 $345678901234567890123456789012345 '
rec.5 = '67890123456789012345678901234567890123456789012345'
rec.6 = '78901234567890 2345678901234567890123456789012345 '
'SET EXECTRAC OFF'
rec.7 = '8901234567890 $45678901234567890123456789012345 '
rec.8 = '$01234567890 45678901234567890123456789012345 '
rec.9 = '01234567890 5678901234567890123456789012345 '
rec.0 = 9
say 'TEST EXEC ended'

*** on VM/370: test
6 - rec.2 = '901234567890 45678901234567890123456789012345 '
7 - rec.3 = '8901234567890 345678901234567890123456789012345 '
8 - rec.4 = '78901234567890 $345678901234567890123456789012345 '
9 - rec.5 = '67890123456789012345678901234567890123456789012345'
10 - rec.6 = '78901234567890 2345678901234567890123456789012345 '
11 - 'SET EXECTRAC OFF'
12 - rec.7 = '8901234567890 $45678901234567890123456789012345 '
TEST EXEC ended
Ready; T=0.01/0.01 08:00:03

*** on z/VM: test
4 - / Test data /
5 - rec.1 = '01234567890 $678901234567890123456789012345 '

"01234567890 $678901234567890123456789012345 "
+++ Interactive trace. TRACE OFF to end debug, ENTER to continue. +++
(Press ENTER)
6 - rec.2 = '901234567890 45678901234567890123456789012345 '
"901234567890 45678901234567890123456789012345 "

 7 *-* rec.3 = '8901234567890  345678901234567890123456789012345  '         
   >>>   "8901234567890  345678901234567890123456789012345  "               

 8 *-* rec.4 = '78901234567890 $345678901234567890123456789012345 '         
   >>>   "78901234567890 $345678901234567890123456789012345 "               

 9 *-* rec.5 = '67890123456789012345678901234567890123456789012345'         
   >>>   "67890123456789012345678901234567890123456789012345"               

10 *-* rec.6 = '78901234567890 2345678901234567890123456789012345 '         
   >>>   "78901234567890 2345678901234567890123456789012345 "               

11 *-* 'SET EXECTRAC OFF'                                                   
   >>>   "SET EXECTRAC OFF"  
     TEST EXEC ended              

Ready; T=0.01/0.01 07:59:35

adesutherland commented 3 years ago

Two Issues

Also - at the moment BREXX checks the flag on each command but actually it only needs checking on start-up and after an external command (slight performance opportunity - as it is in the inner loop).

BobBolch commented 3 years ago

By 'command', do you mean host command? CMS REXX behaves differently, with more frequent checks. Checking one bit is cheap, and not a performance concern.

First, REXX defines a clause this way: REXX clauses can be instructions, null clauses, and labels. Instructions can be keyword instructions, assignments, or commands.

Here is the description of trace behavior from the book.


The System External Trace Bit:

Before each clause is run, an external trace bit, owned by CMS, is inspected. You can turn the bit on with the TS immediate command, and turn it off with the TE immediate command. You can also alter the bit by using the SET EXECTRAC command (described later). CMS itself never alters this bit, except that it is cleared on return to CMS command level.

The language processor maintains an internal shadow of the external bit, which therefore allows it to detect when the external bit changes from a 0 to a 1, or vice-versa. If the language processor sees the bit change from 0 to 1, ? (interactive debug) is forced on and the tracing action is forced to R if it is A, C, E, F, L, N, or O. The tracing action is left unchanged if it is I, R, or S.

Similarly, if the shadow bit changes from 1 to 0, all tracing is forced off. This means that tracing may be controlled externally to the REXX program: you can switch on interactive debug at any time without modifying the program. The TE command can be useful if a program is tracing clauses without being in interactive debug (that is, after SET EXECTRAC ON, TRACE ? was issued). You can use TE to switch off the tracing without affecting any other output from the program.

If the external bit is on upon entry to a REXX program, the SOURCE string is traced (see PARSE) and interactive debug is switched on as usual—hence with use of the system trace bit, tracing of a program and all programs called from it, can be easily controlled.

The internal shadow bit is saved and restored across internal routine calls. This means that (as with internally controlled tracing) it is possible to turn tracing on or off locally within a subroutine. It also means that if a TS interrupt occurs during execution of a subroutine, tracing is also switched on upon RETURN to the caller.

You can use the CMSFLAG(EXECTRAC) function and the command QUERY EXECTRAC to test the setting of the system trace bit.

The command SET EXECTRAC ON turns on the trace bit. Using it before invoking a REXX program causes the program to be entered with debug tracing immediately active. If issued from inside a program, SET EXECTRAC ON has the same effect as TRACE ?R (unless TRACE I or S is in effect), but is more global in that all programs called are traced, too. The command SET EXECTRAC OFF turns the trace bit off. Issuing this when the bit is on is equivalent to the instruction TRACE O, except that it has a system (global) effect.

adesutherland commented 3 years ago

Note to self - need to check if external flag is brought into BREXX after a command

BobBolch commented 3 years ago

The specification says the CMS bit is inspected before each clause.

On Sat, Jan 30, 2021, 12:54 PM Adrian Sutherland notifications@github.com wrote:

Note to self - need to check if external flag is brought into BREXX after a command

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770251465, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUFCBKUYLVJWWLVXVL5J5LS4RBVTANCNFSM4UYEDVLA .

BobBolch commented 3 years ago

When you say 'command', do you mean REXX clause or host CMS command?

adesutherland commented 3 years ago

It really was a note for me. I meant a CMS Command. So after a CMS Command we need to look at the CMS Trace flag to see if we need to change the internal REXX trace status. Well perhaps I need to look at the code again!

A

On Sun, 31 Jan 2021 at 17:00, Bob Bolch notifications@github.com wrote:

When you say 'command', do you mean REXX clause or host CMS command?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770413522, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKI6RJI7PGI4POH6UU6ZTS4WEEDANCNFSM4UYEDVLA .

BobBolch commented 3 years ago

I tried moving the test for tracing on to before processing the statement and I still can't match z/VM behavior. I can experiment some more tomorrow.

/B

On Sun, Jan 31, 2021, 4:54 PM Adrian Sutherland notifications@github.com wrote:

It really was a note for me. I meant a CMS Command. So after a CMS Command we need to look at the CMS Trace flag to see if we need to change the internal REXX trace status. Well perhaps I need to look at the code again!

A

On Sun, 31 Jan 2021 at 17:00, Bob Bolch notifications@github.com wrote:

When you say 'command', do you mean REXX clause or host CMS command?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770413522 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABBKI6RJI7PGI4POH6UU6ZTS4WEEDANCNFSM4UYEDVLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770457518, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUFCBOEIBO7WDLQL5I2DU3S4XGQFANCNFSM4UYEDVLA .

BobBolch commented 3 years ago

I am trying to move the trace calls around to see if I can get the tracing to match z/VM output, but moving the calls around fix one error and make a new one. Still experimenting and trying to understand INTERPRE C logic flow. This routine needs some commenting <----understatement!

/B

On Sun, Jan 31, 2021 at 4:54 PM Adrian Sutherland notifications@github.com wrote:

It really was a note for me. I meant a CMS Command. So after a CMS Command we need to look at the CMS Trace flag to see if we need to change the internal REXX trace status. Well perhaps I need to look at the code again!

A

On Sun, 31 Jan 2021 at 17:00, Bob Bolch notifications@github.com wrote:

When you say 'command', do you mean REXX clause or host CMS command?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770413522 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABBKI6RJI7PGI4POH6UU6ZTS4WEEDANCNFSM4UYEDVLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adesutherland/CMS-370-BREXX/issues/53#issuecomment-770457518, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUFCBOEIBO7WDLQL5I2DU3S4XGQFANCNFSM4UYEDVLA .