Hi All,
how is sign is stored in S9(17) comp-3 variable.
Answer with an Example will be of great help.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?

6836


How you can characterize tables in cobol?

720


What is difference between static and dynamic call in cobol?

778


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1846


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

1785






How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?

710


What is the compute verb? How is it used?

662


Write the code to count the sum of n natural numbers.

701


What are the different types of condition in cobol and write their forms.

660


what is search and searchall?what is the diffrence between them?give an best example?

5563


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

744


how do you reference the esds vsam file formats from cobol programs

634


How are the next sentence and continue different from each other?

766


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

720


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

5065