CONVERT EBCDIC TO FIXED POINT BINARY



High Level Assembler(HLASM) for MVS & VM & VSE

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby BillyBoyo » Sat Nov 19, 2011 12:41 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby xboss » Sat Nov 19, 2011 10:27 am

The textbook I am currently using is "Programming Assembler Language IBM 370 Series Architecture AND Assembly Language" by Peter Albel.
xboss
 
Posts: 79
Joined: Mon Nov 29, 2010 10:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby ZOSN00b » Wed Dec 07, 2011 10:13 am

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.
ZOSN00b
 
Posts: 1
Joined: Wed Dec 07, 2011 10:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby steve-myers » Wed Dec 07, 2011 10:44 am

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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby BillyBoyo » Wed Dec 07, 2011 12:58 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: CONVERT EBCDIC TO FIXED POINT BINARY

Postby steve-myers » Wed Dec 07, 2011 10:20 pm

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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Previous

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post