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.