View previous topic :: View next topic
|
Author |
Message |
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 57 Location: US
|
|
|
|
Hi,
I am trying to convert an Assembler program to COBOL and need some help.
Can someone plz tell me what exactly below instructions means? I tried everywhere, but couldn't find the exact info on OC command.
Thread is declared as below.
Code: |
THREAD DS A THREAD POINTER |
Below we have 2 more instructions. Is it trying to compare and see if THREAD already has value? if Yes, Branch it? What exactly "OC" means?
Code: |
OC THREAD,THREAD SET ALREADY ?
BNZ BCRIT YES, BR |
What would be the COBOL converted code for above stmts?
Plz help.
Thanks & Regards,
JP |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
Back to top |
|
|
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 57 Location: US
|
|
|
|
Enrico,
Thanks for the reply. However, I did go thru that manual and couldn't help much.
Is it possible for you to provide Cobol converted code? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
I did go thru that manual and couldn't help much. |
then You did not read/meditate on it carefully enough !
the OC is a logical or which sets the condition code if any of the bits are non zero
the BNZ is , the name tells, Branch if Not Zero
using the OC is a way of testing a <switch> without caring for it' s length
otherwise You would have had to use a compare instruction with a proper lenght constant operand
the equivalent pseudo code is
if <somevar> equal <environment dependent ZERO/FALSE>
goto <some label> |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 57 Location: US
|
|
|
|
Thank you so much. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Besides the 'OC' of the label itself, if you come across an ICM (Insert Character Under Mask) -
Code: |
ICM Rx,B'1111',THREAD
BNZ BCRIT
|
In an ICM instruction, Rx is any register you choose and (in this example) the mask of B'1111' represents all bytes in the register (decimal 15) because you need to load all four bytes of THREAD. The BNZ (CC=7) mnemonic represents that Rx contains other than X'00000000' (same CC after 'OC').
The COBOL equivilent of an 'OC' and an 'ICM' is an IF check against a POINTER variable (or an ADDRESS OF) for EQUAL or NOT EQUAL to NULL.
HTH.... |
|
Back to top |
|
|
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 57 Location: US
|
|
|
|
Thank you all. Got it resolved. |
|
Back to top |
|
|
|