Page 2 of 2

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Sat Nov 19, 2011 12:41 am
by BillyBoyo
xboss wrote:Hi Bill and Dick,
Thanks for you time and sorry for my ignorance on terminology, I am just learning... In plain english, this is what I should be writing my code for,
Code a two-CSECT load module. Create a fixed-point binary EBCDIC conversion routine. Create a separate mapping macro for its parameter list. The parameter list should consist of a full word function code, an 11-character string, and a full word fixed-point binary number. For the function code, have 0 denote an EBCDIC to fixed-point conversion and have 1 denote a fixed-point to EBCDIC conversion. For the character string, have a ‘+’ or ‘-‘as the first character to denote the sign and have EBCDIC F0x (‘0’) prefix non-zero digits.

In the main CSECT, loop through a static table of 11-character strings with the following values:
CL11 ‘+0000000002’
CL11 ‘+0000000003’
CL11 ‘-0000000001’
CL11 ‘-0000000006’

Take the results from the conversion routine to add the 1st entry to the 2nd, the 2nd to the 3rd, and the 3rd to the 4th. Use the conversion routine with the alternate function code value to convert each sum into an 11-character string. For each sum, issue a WTO with the following format:

CMS0001I insert#1 + insert#2 = insert#3

Code both CSECTs to always return RC 0 and code both of them to be reentrant.

So I am currently trying to work first on conversion logic.
I hope this will explain the program I am working on.


I'm sorry for doubting you about the textbook, xboss. I see what you mean now :-)

"Create a binary to numeric-edited conversion routine. Create a separate mapping macro for its parameter list. The parameter list should consist of a full word function code, an 11-byte field, and a fullword binary number. For the function code, have 0 denote a numeric-edited to binary conversion and have 1 denote a binary to numeric-edited conversion. For the 11-byte field, have a ‘+’ or ‘-‘ as the first byte to denote the sign and include leading-zeros."

So, binary to numeric-edited you pretty-much had yesterday.

Numeric-edited to binary, including your S0C7, you are working on. Note, no numeric field contains an actual "+" or "-" sign except for a numeric-edited one. For your requirement, you have to treat the sign entirely seperately (except for how to derive it) from the number. That is the reason for your S0C7, and why I see you are putting a sign into the first byte of the field.

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Sat Nov 19, 2011 10:27 am
by xboss
The textbook I am currently using is "Programming Assembler Language IBM 370 Series Architecture AND Assembly Language" by Peter Albel.

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Wed Dec 07, 2011 10:13 am
by ZOSN00b
Bump. I too, am stuck on this same thing. I keep getting ABEND error code SOC07 when I use the CVB statement to convert the packed decimal number to binary. That's where I'm stuck right now.

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Wed Dec 07, 2011 10:44 am
by steve-myers
You most likely are getting the S0C7 because CVB only uses an 8 byte packed decimal data area, but the problem definition appears to specify a 10 byte character number preceded by an EBCDIC + or - character.

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Wed Dec 07, 2011 12:58 pm
by BillyBoyo
ZOSN00b wrote:Bump. I too, am stuck on this same thing. I keep getting ABEND error code SOC07 when I use the CVB statement to convert the packed decimal number to binary. That's where I'm stuck right now.


Are you working on the same exercise in the same book?

Can you show your code, please, if you still have problems after Steve Myert's points.

Re: CONVERT EBCDIC TO FIXED POINT BINARY

PostPosted: Wed Dec 07, 2011 10:20 pm
by steve-myers
Hold on. No one should be showing code. What will happen is the provider of the code may learn something; every one else will just steal the code and learn little, if anything.

After reading through the definition of the problem, it seems to me only the CVB instruction (not statement) is the only place that can get an S0C7. This means the packed decimal number CVB uses was prepared incorrectly. Check this carefully. Your code should look something like this -
         PACK  DBLEWD,INPUT+1(10)
* Translate the + or - in the input to a valid
* packed decimal sign in the last 4 bits of
* DBLEWD
         CVB   reg,DBLEWD
With no code, I'd bet
  • You're not doing the PACK; you're just doing the CVB from the character data, OR
  • You're including the sign in the input data with the PACK, OR
  • You're doing the PACK from a bad data area, OR
  • You're preparing the packed decimal sign incorrectly. If you've done the PACK from valid data you'll have a valid packed decimal +, but you have to make a proper packed decimal - if the source contains a -
You, not us, have to figure out what you're doing wrong.