MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XPLAIN THESE CODE OF LINES (ASSEMBLY)

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Thu May 17, 2007 4:38 am    Post subject: XPLAIN THESE CODE OF LINES (ASSEMBLY) Reply with quote

please xplain these lines in terms of COBOL. Here, CODE is of hex length 2, PACKWORK is a DOUBLEWORD, NUMBER IS character of length 8
and OUT is character of length 3.
Code:

****************************
SR    R2,R2
ICM   R2,B'0011',CODE
CVD   R2,PACKWORK
UNPK  NUMBER,PACKWORK+4(4)
MVC   OUT,NUMBER+5
OI    OUT+2,X'F0'
*****************************
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Thu May 17, 2007 4:58 am    Post subject: Reply with quote

What's to explain? Assembler op codes....Look at the Poop,
Subtract register, insert character under mask,convert to decimal,unpack, move and or immediate....
Back to top
View user's profile Send private message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Thu May 17, 2007 5:13 am    Post subject: Reply with quote

i need the equivalent CODE in COBOL. What these lines of codes are actually meant for ??
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu May 17, 2007 5:42 am    Post subject: Reply with quote

well - look at
Code:
SR R2,R2
You have been told that SR is subtract register. The operands are the registers to subtract in this case you are subtracting the value in R2 from itself. What does this give you? In this case you could consider the register to be a variable. But look at Poop (Principles of operation manual) and assembler manual I guess and work it out.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Thu May 17, 2007 6:10 am    Post subject: Reply with quote

Subtracting registers from itself means that we are clearing the previously stored contents of registers so that further operations can be done thru that particular register.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Thu May 17, 2007 6:22 am    Post subject: Reply with quote

Almost every COBOL verb generates multiple Assembler opcodes, you can't convert on a one for one basis. You have to look at what a group of Assembler instructions are doing and convert that to the equivalent COBOL verbs.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu May 17, 2007 6:24 am    Post subject: Reply with quote

rnanavaty,

CODE contains some binary value which is converted to display after the ICM (insert character under mask) does some bit manipulation. Need to know what CODE contains before the COBOL code is ok. an assembler guru might recognize it immediately and understand its use.

e.g. the OI is used to force the last character to be a number instead of a letter after the unpack and is easily recognizable as being part of an unpack routine.

Because of the instructions used, the data type and length of all fields are known. key to solving this is what is in CODE?

77 CODE pic s9(2) binary. <<<<<as shown by CICS_Guy
77 OUT pic 9(3) display.<<<<< use 77 levels and unsigned for OUT.

move code to out.
_________________
Dick Brenholtz
American living in Varel, Germany


Last edited by dbzTHEdinosauer on Sat May 19, 2007 2:12 am; edited 3 times in total
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Fri May 18, 2007 5:15 am    Post subject: Reply with quote

It takes the low order byte in code, translates it to decimal digits and puts it into
the output buffer OUT (right justified).

Coding it in COBOL should be a snack.
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri May 18, 2007 7:23 am    Post subject: Re: XPLAIN THESE CODE OF LINES (ASSEMBLY) Reply with quote

rnanavaty wrote:
please xplain these lines in terms of COBOL. Here, CODE is of hex length 2, PACKWORK is a DOUBLEWORD, NUMBER IS character of length 8
and OUT is character of length 3.
Code:

****************************
SR    R2,R2
ICM   R2,B'0011',CODE
CVD   R2,PACKWORK
UNPK  NUMBER,PACKWORK+4(4)
MVC   OUT,NUMBER+5
OI    OUT+2,X'F0'
*****************************

77 CODE PIC S9(4) COMP.
77 OUT PIC 9(3).
MOVE CODE TO OUT.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 18, 2007 8:32 am    Post subject: Reply with quote

dumb question on my part. why is OUT (in COBOL) not signed?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri May 18, 2007 8:53 am    Post subject: Reply with quote

"OI OUT+2,X'F0' " is what COBOL does when the numeric display field has no sign...... 8)
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 18, 2007 10:06 am    Post subject: Reply with quote

thanks,

and enjoy your holiday.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group