TITLE  'ICATS TRACE COMMAND ROUTINE'                           TRA00010
*********************************************************************** TRA00020
*                                                                     * TRA00030
*  MODULE NAME =  TRACE                                               * TRA00040
*                                                                     * TRA00050
*  FUNCTION =  SET OR QUERY THE ICATS TRACE FLAG IN FLAGA IN THE      * TRA00060
*              ICATS COMMON DATA AREA.  TRACE MODE = ON MEANS         * TRA00070
*              WE ARE RECORDING ENTRIES IN OUR INTERNAL TRACE         * TRA00080
*              TABLE WHEN WE DO ETTE CALLS.  COMMAND FORMAT IS        * TRA00090
*                   TRACE  <?|ON|OFF>      DEFAULTS TO ?              * TRA00100
*                                                                     * TRA00110
*  ENTRY POINTS =  TRACE                                              * TRA00120
*                                                                     * TRA00130
*  LINKAGE =  BALR R14,R15 FROM ICATS MAINLINE.                       * TRA00140
*                                                                     * TRA00150
*  REGISTER CONTENTS UPON ENTRY =                                     * TRA00160
*      R2  = POINTS TO THE ICATS COMMON DATA AREA, AS ALWAYS.         * TRA00170
*      R14 = RETURN ADDRESS BACK TO ICATS MAINLINE                    * TRA00180
*      R15 = ENTRY POINT TO THIS MODULE                               * TRA00190
*                                                                     * TRA00200
*  REGISTER USAGE =                                                   * TRA00210
*      R0-R1 = USED TO PASS PARAMETERS TO SUBROUTINES.                * TRA00220
*      R2 =  USED TO ADDRESS THE ICATS COMMON DATA AREA.              * TRA00230
*      R3 =  USED TO HOLD THE ADDRESS OF THE EDITED LINE TO OUTPUT.   * TRA00240
*      R4-R10 = FREE                                                  * TRA00250
*      R11 = MY BASE REGISTER                                         * TRA00260
*      R14 = MY RETURN ADDRESS WHEN I CALL SOMEBODY                   * TRA00270
*      R15 = SUBROUTINE ADDRESS                                       * TRA00280
*                                                                     * TRA00290
*                                                                     * TRA00300
*  MODULE LOGIC:                                                      * TRA00310
*      1)  SEE WHERE THIS COMMAND CAME FROM.  REJECT THIS             * TRA00320
*          COMMAND IF IT CAME FROM A UTS MACHINE.                     * TRA00330
*      2)  ELSE GO AHEAD AND PROCESS THE COMMAND.                     * TRA00340
*          A)  SEE IF WE'RE SUPPOSE TO CHANGE THE TRACE BIT.          * TRA00350
*              1)  TRACE ON = SET THE TRACE BIT IN FLAGA ON.          * TRA00360
*              2)  TRACE OFF = SET THE TRACE BIT IN FLAGA OFF.        * TRA00370
*              3)  TRACE ?   = DON'T CHANGE THE TRACE BIT.            * TRA00380
*              4)  TRACE BLANK = DON'T CHANGE THE TRACE BIT.          * TRA00390
*              5)  ANYTHING ELSE IS INVALID.  GIVE HIM A NASTY MSG.   * TRA00400
*          B)  IF IT WAS A VALID TRACE COMMAND, TELL HIM THE          * TRA00410
*              CURRENT STATUS OF THE TRACE BIT, EITHER ON OR OFF.     * TRA00420
*          B)  IF IT WAS TRACE ?, TELL HIM WHERE THE TRACE TABLE      * TRA00430
*              IS.  FIRST ENTRY, CURRENT ENTRY, AND LAST ENTRY.       * TRA00440
*                                                                     * TRA00450
*  NORMAL EXIT =                                                      * TRA00460
*      R15 = 0                                                        * TRA00470
*                                                                     * TRA00480
*  EXTERNAL REFERENCES = NONE                                         * TRA00490
*                                                                     * TRA00500
*  MACROS =  ICDATA = ICATS COMMON DATA AREA                          * TRA00510
*            ETTE   = ENTER TRACE TABLE ENTRY SUBROUTINE              * TRA00520
*                                                                     * TRA00530
*  CHANGE ACTIVITY                                                    * TRA00540
*    DATE        NAME       REASON FOR CHANGE                         * TRA00550
*  04/19/83  RICK JASPER    BROKEN AWAY FROM ICATS MAINLINE INTO      * TRA00560
*                           SEPARATE SUBROUTINE                       * TRA00570
*                                                                     * TRA00580
*********************************************************************** TRA00590
*                                                                       TRA00600
         PRINT GEN,NODATA                                               TRA00610
TRACE    CSECT                                                          TRA00620
         USING ICDATA,R2            ADDRESS ICATS COMMON DATA AREA      TRA00630
         USING *,R15              USE R15 FOR NEXT INSTRUCTION ONLY     TRA00640
         STM   R0,R14,TRACEREG    SAVE ALL THE REGISTERS                TRA00650
         DROP  R15                                                      TRA00660
         USING TRACE,R11          SWITCH BASE REGISTER TO R11           TRA00670
         LR    R11,R15                                                  TRA00680
         TM    FLAGB,UTSCMD       DID THIS COMMAND COME FROM A UTS ??   TRA00690
         BNO   TRACONTA           DON'T REJECT IT IF NOT.               TRA00700
         L     R15,AREJECT        GO TO REJECT-THIS-COMMAND ROUTINE     TRA00710
         BALR  R14,R15                                                  TRA00720
         B     TRACBYE                                                  TRA00730
TRACONTA CLC   PARM2,=CL8'ON'         DID HE SAY TRACE ON ??            TRA00740
         BE    TRACONTC               YEP, GO TURN IT ON.               TRA00750
         CLC   PARM2,=CL8'OFF'     WELL, IS IT OFF THEN ??              TRA00760
         BE    TRACONTE            THEN GO SHUT IT OFF.                 TRA00770
         CLC   PARM2,=CL8' '          DID HE SAY TRACE ? BY DEFAULT ??  TRA00780
         BE    TRACONTD               YEP, GO TELL HIM WHAT IT IS.      TRA00790
         CLC   PARM2,=CL8'?'       LAST CHANCE.  IS IT A QUERY ??       TRA00800
         BE    TRACONTD            GOOD.  GO TELL HIM WHAT IT IS.       TRA00810
*    INVALID SECOND PARAMETER.  GIVE HIM A NASTY MESSAGE                TRA00820
         LINEDIT TEXT='SAY WHAT ??   WHAT DOES TRACE ........ MEAN ??',-TRA00830
               SUB=(CHARA,PARM2),RENT=NO,DOT=NO,DISP=NONE,BUFFA=MYBUFR  TRA00840
         LA    R1,MYBUFR                                                TRA00850
         B     TRACONTF                                                 TRA00860
TRACONTC DS    0H                                                       TRA00870
         OI    FLAGC,TRACEMOD         TURN ON TRACE MODE                TRA00880
         LA    R1,ONMSG               GET TRACE MODE = ON MESSAGE       TRA00890
         B     TRACONTF                                                 TRA00900
TRACONTD DS    0H                                                       TRA00910
         TM    FLAGC,TRACEMOD         IS TRACE MODE ON ??               TRA00920
         BO    TRACONTC               THEN TELL HIM SO.                 TRA00930
*                          ELSE IT'S OFF.  TELL HIM SO.                 TRA00940
TRACONTE DS    0H                                                       TRA00950
         NI    FLAGC,ALL-TRACEMOD     TURN OFF TRACE MODE               TRA00960
         LA    R1,OFFMSG              GET TRACE MODE = OFF MESSAGE      TRA00970
*    GIVE HIM THE MESSAGE WHOSE ADDRESS IS IN R1.                       TRA00980
TRACONTF DS    0H                                                       TRA00990
         L     R15,AMESSAGE                                             TRA01000
         BALR  R14,R15                                                  TRA01010
*    LAST THING - IF TRACE ?, GIVE TRACE TABLE ADDRESS SO HE CAN        TRA01020
*    FIND IT IN MAIN STORAGE.                                           TRA01030
         CLC   PARM2,=CL8'?'                                            TRA01040
         BE    TRACONTG                                                 TRA01050
         CLC   PARM2,=CL8' '                                            TRA01060
         BNE   TRACONTH                                                 TRA01070
TRACONTG DS    0H                                                       TRA01080
         TM    FLAGB,CONSCMD     ONLY GIVE ADDRESSES IF A CONSOLE CMD   TRA01090
         BNO   TRACONTH                                                 TRA01100
         LINEDIT TEXT='TRACE TABLE ADDRESS - BEGIN/NEXT/END = ....../..-TRA01110
               ..../......',SUB=(HEXA,FIRSTTTE,HEXA,NEXTTTE,HEXA,LASTTT-TRA01120
               E),RENT=NO,DOT=NO,DISP=NONE,BUFFA=MYBUFR                 TRA01130
         LA    R1,MYBUFR                                                TRA01140
         L     R15,AMESSAGE                                             TRA01150
         BALR  R14,R15                                                  TRA01160
TRACONTH DS    0H                                                       TRA01170
TRACBYE  DS    0H                                                       TRA01180
         LM    R0,R14,TRACEREG                                          TRA01190
         SR    R15,R15                RETURN CODE = 0                   TRA01200
         BR    R14                                                      TRA01210
TRACEREG DS    15F                                                      TRA01220
*                                                                       TRA01230
ONMSG    DC    AL1(ONMSGE)                                              TRA01240
         DC    C'ICATS TRACE MODE IS NOW ON'                            TRA01250
ONMSGE   EQU   *-ONMSG-1                                                TRA01260
*                                                                       TRA01270
OFFMSG   DC    AL1(OFFMSGE)                                             TRA01280
         DC    C'ICATS TRACE MODE IS NOW OFF'                           TRA01290
OFFMSGE  EQU   *-OFFMSG-1                                               TRA01300
MYBUFR   DS    CL80                                                     TRA01310
         LTORG                                                          TRA01320
         ICDATA                                                         TRA01330
         END                                                            TRA01340