how to read the comp-3 data
Moderators: chulett, rschirm, roy
how to read the comp-3 data
using "complex flat file" STAGE to read an EBCD file
I'm forced to change the usage to 'comp-3' when I set default value for a 'decimal' column.After that I find the data still not right .
the data should be as follow:
DECIMAL CHAR(8) CHAR(10)
0000 20100812 OK
0000 20100707 OK
0000 20100703 0K
but what OUTPUT IS AS FOLLOW
0000 201008 12OK
0000 2010 0707OK
0000 20 100703OK
SO I wander if I need to make additional set for comp-3 decimal data
I'm forced to change the usage to 'comp-3' when I set default value for a 'decimal' column.After that I find the data still not right .
the data should be as follow:
DECIMAL CHAR(8) CHAR(10)
0000 20100812 OK
0000 20100707 OK
0000 20100703 0K
but what OUTPUT IS AS FOLLOW
0000 201008 12OK
0000 2010 0707OK
0000 20 100703OK
SO I wander if I need to make additional set for comp-3 decimal data
the first column is decimal. I must set the 'usage' property to 'comp-3',or I can't set nullable or default value to the column.why?
set in 3 places for this column:
usage :comp-3
nullable: yes
default value:0
then I found the first column occupied wrong length ,so ....result data as i described before
set in 3 places for this column:
usage :comp-3
nullable: yes
default value:0
then I found the first column occupied wrong length ,so ....result data as i described before
Could you please post the COBOL PICture clause for this file, it would make it a lot easier to understand the problem.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I was just reinforcing your request, Craig
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Yep, and with all this deja-vu all over again we still don't have a copybook.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
the copy book is as follow:
01 :RAAKYCUP:-REC.
05 :RAAKYCUP:-KEY.
10 :RAAKYCUP:-ID.
15 :RAAKYCUP:-ID-FORMAT PIC X(02).
15 :RAAKYCUP:-ID-NO PIC X(04).
05 :RAAKYCUP:-CUSTOMER-ACCT PIC S9(16) COMP-3.
05 :RAAKYCUP:-CUSTOMER-NAME PIC X(1).
....................................................
part of data file (EBCDIC hexadecimal )is like as follow:
F0 F1 F0 F0 F0 F9 F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0
F0 F4 F0 F6 F2 D4...
So the data in these 4 columns are supposed to be:
01 | 0009 | (a number,according to F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0 F0 F4 F0 F6 F2 ) | M
but the result is that the comp-3 only read the 9 of 16 bytes( red color) and the 10th byte( here is F0,green color) is put in the 4th column.
but i cannot change the column usage to be display (the information is "usage of decimal must be comp-3")
01 :RAAKYCUP:-REC.
05 :RAAKYCUP:-KEY.
10 :RAAKYCUP:-ID.
15 :RAAKYCUP:-ID-FORMAT PIC X(02).
15 :RAAKYCUP:-ID-NO PIC X(04).
05 :RAAKYCUP:-CUSTOMER-ACCT PIC S9(16) COMP-3.
05 :RAAKYCUP:-CUSTOMER-NAME PIC X(1).
....................................................
part of data file (EBCDIC hexadecimal )is like as follow:
F0 F1 F0 F0 F0 F9 F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0
F0 F4 F0 F6 F2 D4...
So the data in these 4 columns are supposed to be:
01 | 0009 | (a number,according to F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0 F0 F4 F0 F6 F2 ) | M
but the result is that the comp-3 only read the 9 of 16 bytes( red color) and the 10th byte( here is F0,green color) is put in the 4th column.
but i cannot change the column usage to be display (the information is "usage of decimal must be comp-3")
PIC S9(16) COMP-3 is stored in 9 bytes, not 16. COMP-3 stores one digit in 4 bits, plus it needs 4 bits for the sign, thus 16 digits / 2 = 8 plus sign and rounded up to the next 8-byte boundary.
Last edited by ArndW on Wed Aug 11, 2010 6:23 am, edited 1 time in total.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Exactly, was wondering if something like this was going on. Hence the need to see the PICture clause.
As noted, count the digits, add one for the sign if present, round up to even if odd and then divide by two to get the packed field size.
As noted, count the digits, add one for the sign if present, round up to even if odd and then divide by two to get the packed field size.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers