IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Explain the Assembler Logic


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Fri Apr 30, 2010 1:12 pm
Reply with quote

Hi All,

My heartfelt thank to all of you for your kind support and help.

Just I moved to Assembler project where in I do not have 1 day experience in Assembler.

I was analyzing following peace of code:

Code:
         UNPK  BRKRNO(5),ACBRKNO+1(3) -- 1
         MVZ   BRKRNO+4(1),=X'F0'     -- 2
         CLI   BRKRNO,X'F0'           -- 3
         BL    CKBRKER                -- 4
         IC    R6,BRKRNO              -- 5
         SH    R6,=H'57'              -- 6
         STC   R6,BRKRNO              -- 7
CKBRKER  CLI   ENDFLAG,X'FF'
         BE    MVZERO
         CLC   INBRKER(5),BRKRNO   CMP -- 8

Variable Declaration:

ACBRKNO  DS    PL4
BRKRNO   DC    CL5'0'
INBRKER  DS    CL5



1 - 8 number are line number and my understanding to corresponding line is mentioned below.

Quote:
1. Convert ACBRKNO i.e. packed Agent No (from 2nd Position) to BRKRNO(5)zoned Agent No
2. Moves the zone portion (left half of a byte).
3. Compare BRKRNO with X'F0'
4. Branch to CKBRKER when BRKRNO is low.
5. Insert BRKRNO into R6 register at right most side.
6. Subtracts 57 from R6 register i.e. from last two-byte value.
7. Stores one character at right most byte from BRKRNO.
8. Character comparision.



Please correct me if my understanding is wrong.

Kindly, explain me this logic with an example. Please.

Thanks in advance.

Thanks,
Sati
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Apr 30, 2010 2:07 pm
Reply with quote

I'd suggest you refer to the zArchitecture Principles of operations manual at publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/dz9zr002/CCONTENTS

#5 in your example does insert a character into the rightmost byte of R6 - but the other 3 bytes are unchanged.

#6 subtract of 57 may not give you the expected result because of #5.

#7 the single character will be stored in the first (leftmost) byte of BRKRNO. To store in the rightmost byte you need to code

Code:
STC   R6,BRKRNO+4             


Garry.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 30, 2010 2:22 pm
Reply with quote

and to add a bit more ..

the result of the unpack will yield an F zone for every digit,
the move zone will force a F zone for the last digit
all this implies that all all the digits will be grater than F0
the comparison as coded will always give a false and the negative branch will be never taken

but if the code is trying do fiddle around with some kind of hex conversion
to printables

Code:
x'A.....' ==> x'FAF.F.F.F.'

x'FA' ==> 250 ; 250 - 57 = 193 ==> x'C1' ==> c'A'


the code would be wrong because of my previous explanation
the comparison should be made with an x'FA'

not the best way to do it
unless the only byte to be converted is the first one
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts DB2 Statistics - Using EXPLAIN and qu... DB2 1
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
Search our Forums:

Back to Top