View previous topic :: View next topic |
Author |
Message |
rnanavaty Beginner
Joined: 12 Apr 2006 Posts: 29 Topics: 20
|
Posted: Thu May 17, 2007 4:38 am Post subject: XPLAIN THESE CODE OF LINES (ASSEMBLY) |
|
|
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 |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Thu May 17, 2007 4:58 am Post subject: |
|
|
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 |
|
 |
rnanavaty Beginner
Joined: 12 Apr 2006 Posts: 29 Topics: 20
|
Posted: Thu May 17, 2007 5:13 am Post subject: |
|
|
i need the equivalent CODE in COBOL. What these lines of codes are actually meant for ?? |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu May 17, 2007 5:42 am Post subject: |
|
|
well - look at 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 |
|
 |
rnanavaty Beginner
Joined: 12 Apr 2006 Posts: 29 Topics: 20
|
Posted: Thu May 17, 2007 6:10 am Post subject: |
|
|
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 |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Thu May 17, 2007 6:22 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu May 17, 2007 6:24 am Post subject: |
|
|
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 |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Fri May 18, 2007 5:15 am Post subject: |
|
|
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 |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Fri May 18, 2007 7:23 am Post subject: Re: XPLAIN THESE CODE OF LINES (ASSEMBLY) |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri May 18, 2007 8:32 am Post subject: |
|
|
dumb question on my part. why is OUT (in COBOL) not signed? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Fri May 18, 2007 8:53 am Post subject: |
|
|
"OI OUT+2,X'F0' " is what COBOL does when the numeric display field has no sign...... 8) |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri May 18, 2007 10:06 am Post subject: |
|
|
thanks,
and enjoy your holiday. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
|
|