Hi All,
how is sign is stored in S9(17) comp-3 variable.
Answer with an Example will be of great help.
Answers were Sorted based on User's Feedback
Answer / sudhakar
In comp-3 format sign is stoted in the last nibble along
with data for e.g +1234 last digit is +4 it comes as D
| Is This Answer Correct ? | 12 Yes | 4 No |
Answer / blessy
it is stored as hex value in the last nibble(4 bits) of the
storage. for eg: if the number is +100, it stores hex 0C in
the last byte. as 2D if the number is -102 .
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / srinivas adilapuram
The sign is stored seperately as rightmost half-a-byte
regardless of whether 'S' is specified in the PIC clause or not.
Thanks
Srinivas
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / viswanathan
Hi,
suppose s9(3)v9(4) comp 3 is the data type then
3+4 = 7 half bytes will be used for data.
the last half byte will be used for sign
in this example number of digits is odd(7).
so total size occupied will be 7/2 + 1/2 =4 bytes
first seven half bytes from left will have data part. so the
right most half byte will have sign value.
if this right most half byte value is D (1101) then it is -ve
if it is C (1100) or F (1111) then it is considered as +ve.
example 2
S9(4)v(2) comp 3
here number of digits is even (4+2=6),so number of bytes
used will be 6/2 +1 =4 bytes.
in this example first half byte will be having 0000 value
this will be ignored while reading from data. the next six
half bytes will be having the six digits of data. and then
the last half byte will be having the sign value as said in
the example 1.
example 3
s9(4) comp3
4-even
first half byte no data(0000). next 4 half bytes data. the
last half byte will have sign value
Thanks
Viswanathan
| Is This Answer Correct ? | 3 Yes | 1 No |
in real time what is the suitable exp where in-stream procedure is better then catalog procedure.
how to pass 100 to s9(4) how r they inserted ?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables with Pic 9(18). Can anyone please let me know the answer... I know one answer to this question which is to use Compiler option Arith (Extend) during Compilation. It extends the maximum limit to 9(32)..Just wanted to know if there is any other way to extend this?
2)Where the Plan is located in CICS-DB2?
can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech
what are the paramater we cannot use in procedure?how many instream we can write in single jcl?can we call instream to catalog and ctalog to instream?
How can you add a particular field in copybook?
Can we access the a[0] in the array ?
I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.
Why IBM?
Why we need to use redefine clause when we can define the variable seperately... what is actual need....