difference between TM and CLI



High Level Assembler(HLASM) for MVS & VM & VSE

difference between TM and CLI

Postby nareshv_99 » Mon Mar 05, 2012 9:51 pm

hi..
can some tell me the difference between TM and CLI instruction or when to use TM and CLI ?

Thanks!
nareshv_99
 
Posts: 17
Joined: Sat Feb 18, 2012 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: difference between TM and CLI

 

Re: difference between TM and CLI

Postby BillyBoyo » Mon Mar 05, 2012 10:11 pm

Have you looked in the Principles of Operation ("the POP") for the first part of your question? Knowing that should help with the second part, at least a little.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: difference between TM and CLI

Postby nareshv_99 » Mon Mar 05, 2012 10:31 pm

i know the syntax and usage of TM and CLI but i didn't get the difference between them.
TM VAR1,VAR2
BO JMPE
WTO 'not equal..'
B SKIP
JMPE WTO 'equal..'
B SKIP
..
..
VAR1 DC C'123'
VAR2 EQU C'123'


the same validation can be done using CLI too.. so I just wanted to know the difference usage between them.
Thanks!
nareshv_99
 
Posts: 17
Joined: Sat Feb 18, 2012 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: difference between TM and CLI

Postby BillyBoyo » Mon Mar 05, 2012 11:09 pm

nareshv_99 wrote:[...]the same validation can be done using CLI too.. [...]


Did you use the POP, or just "know" the syntax? Test under Mask, Compare Logical Immediate. The names are pretty different. Are you saying that all usage of TM can be replaced by CLI (or vice versa)?

Please, consult the POP. Note down differences. Note down similarities. Post them here.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: difference between TM and CLI

Postby steve-myers » Mon Mar 05, 2012 11:22 pm

Well, your program is all wrong. TM and CLI operate on one byte of data using one data byte in the instruction.

CLI DATA,C'X'

compares the first byte of DATA with X.

With TM the data in the instruction is a mask.

TM DATA,C'X'
BO EQUAL

is not the same as

CLI DATA,C'X'
BE EQUAL

The C'X' mask in the TM instruction is B'11100111' (I think, I'm not certain), and the BO would branch if DATA contains, for example, B'11111111' since all the 1 bits in the mask match the corresponding 1 bit in the data. Until you learn the instruction better, stick with using just 1 bit in the mask, and just use BO and BZ after the TM. For example -

TM DCBOFLGS,DCBOFOPN

tests one bit, the DCBOFOPN bit, in DCBOFLGS. This is roughly equivalent to

if (dcboflgs & dcbofopn)

in C.

Now think about this -

TM DATA,255-C' '

What would you use this test for?
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: difference between TM and CLI

Postby nareshv_99 » Mon Mar 05, 2012 11:50 pm

thanks for providing valuable info.
please consider below scenarios.

TM VAR1,VAR2
BO JMPE

or

CLI VAR1,VAR2
BE JMPE

VAR1 DC X'80'
VAR2 EQU X'80'

so in this case result of both CLI and TM are same rt?

TM VAR1,VAR2
BO JMPE

or

CLI VAR1,VAR2
BE JMPE

VAR1 DC X'88'
VAR2 EQU X'80'

so in this case after executing TM, control will be jumped to JMPE but where as after executing CLI, control won't be jumped to JMPE.

could you correct me if i'm wrong ?
nareshv_99
 
Posts: 17
Joined: Sat Feb 18, 2012 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: difference between TM and CLI

Postby steve-myers » Tue Mar 06, 2012 12:59 am

Neither the CLI or TM in your code will assemble. The second operand of both CLI and TM is data that becomes part of the instruction. The CLI you had properly becomes CLC VAR1,VAR2. There is nothing comparable for the TM instruction. I don't think you read or understood my first post.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: difference between TM and CLI

Postby steve-myers » Tue Mar 06, 2012 8:09 am

Sorry, I read your last post wrong. My boo boo.

In the first group, you are correct: the conditional branch after your TM will branch because all of the 1-bits in the VAR2 mask match a 1-bit in VAR1, and the conditional branch after the CLI will branch because all the bits in VAR1 match all the bits in VAR2. Almost all my production program do the TM you have in this group, though I almost always write the code as TM DATA,X'80'.

In the second group, you are correct: the branch after your TM will branch to JMPE because all the 1-bits in the VAR2 mask are present in VAR1. The branch after your CLI will not branch to JMPE: the value of the VAR2 symbol is not equal to the contents of VAR1.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post