From: ah739@cleveland.Freenet.Edu (Leslie J. Somos)
Newsgroups: bit.listserv.ibm-main,bit.listserv.asm370
Subject: Re: Using EXTRACT macro to detect execution under TSO
Date: 18 Nov 1992 16:15:59 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Reply-To: ah739@cleveland.Freenet.Edu (Leslie J. Somos)
NNTP-Posting-Host: slc10.ins.cwru.edu


In a previous article, mrl@uai.com (Mark R. Ludwig) says:

>Several months ago, I asked how to determine, from Assembler, whether
>the program is executing under TSO.  You collectively pointed me to
>the EXTRACT macro, which I've been using happily for months to do just
>that.  Suddenly, it's not working, and I'm at a loss to explain why.
>I would appreciate any insight into what's wrong with the following
>code.  That is, I want to know why I get a high-order byte of X'00' in
>TSOFLAG from EXTRACT when I execute the program from the terminal!
>
>(On the off chance that a guru's reading and it actually means
>something, the rest of TSOFLAG is X'B0E6B1'.)
>
>                                      O o
>                                       X
>--------------------------------------/-\--------------------------------------
>         SPACE
>R0       EQU   0
>R1       EQU   1
>R2       EQU   2
>R3       EQU   3
>R4       EQU   4
>R5       EQU   5
>R6       EQU   6
>R7       EQU   7
>R8       EQU   8
>R9       EQU   9
>R10      EQU   10
>R11      EQU   11
>R12      EQU   12
>R13      EQU   13
>R14      EQU   14
>R15      EQU   15
>         SPACE
>TESTTERM CSECT
>         SAVE  (14,12),T,*
>*
>         BALR  R12,0
>         USING *,R12
>*
>         OPEN  (SNAPDCB,(OUTPUT))
>         SNAP  DCB=SNAPDCB,ID=0
>*
>         EXTRACT TSOFLAG,'S',FIELDS=(TSO) Get flag indicating TSO
>         TM    TSOFLAG,TSOYES
>         BO    TSO
>*
>         L     R5,TSOFLAG
>         LA    R6,TSOYES
>         SNAP  DCB=SNAPDCB,PDATA=REGS,ID=1
>*
>TSO      DS    0H
>         RETURN (14,12),T
>*
>         DROP
>*
>         LTORG
>*
>TSOFLAG  DC    F'-1'              Flag indicating presence of TSO
>TSOYES   EQU   B'10000000'        Flag value meaning TSO is present
>*
>SNAPDCB  DCB   DSORG=PS,RECFM=VBA,MACRF=(W),BLKSIZE=882,LRECL=125,     +
>               DDNAME=SNAPOUT
>         END
>--------------------------------------\-/--------------------------------------
>                                       X
>                                      O o
>
>On the assumption that I have done something wrong (which has waited
>until this most inopportune time to fail), please reply directly, and
>I'll summarize if there's interest.$$
>-- 
>INET: mrl@uai.com           NIC: ML255           ICBM: USA; Lower Left Coast
>"A computer is one of life's joys; it follows simple rules.  Just like
> children, adults need toys, only we like to call them 'tools.'" -- Dave Ross
>

I don't understand how it could ever have worked correctly.
I looked at the manual describing the EXTRACT macro,
it tells me that you get back "the _address_ of a byte in which
a high bit of 1 indicates a TSO address space, and a high byte
of 0 indicates a non-TSO address space".

I changed the field name 'TSOFLAG' to 'FLAGADDR', and coded:

...
         EXTRACT FLAGADDR,'S',FIELDS=(TSO)  Get _address_ of flag
         L     R7,FLAGADDR
         TM    0(R7),TSOYES
         BO    TSO
...
FLAGADDR DC    A(-1)   Pointer to flag indicating presence of TSO
...

With everything else the same as you coded, it works correctly
for me (does the right thing in TSO and non-TSO environments).

I don't understand how it could ever have worked correctly
as originally coded.

--
Leslie J. Somos    ah739@cleveland.Freenet.edu