View previous topic :: View next topic
|
Author |
Message |
gagandeep
New User
Joined: 22 Jul 2008 Posts: 3 Location: India
|
|
|
|
when we are converting Comp-3 field (like PIC S9(9)V99 COMP-3. ) to numeric field what field length do the conveted value occupy?
For comp-3 it was 6 bytes, for output file it won't remain 6 bytes. i tried this conversion, the byte length comes out to be 15 bytes. is it some standard ?????
Thanks!!!! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
when we are converting Comp-3 field (like PIC S9(9)V99 COMP-3. ) to numeric field what field length do the conveted value occupy? |
This depends on what you want to convert it to. PIC S9(09)V99 USAGE DISPLAY will take 11 bytes. If you want the explicit decimal point in your output field, add a byte for it. If you want a separate sign add a byte for it. So the output field will be 11 to 13 bytes depending on your needs; if you go with DB/CR or other formatting options you could again need to add bytes.
lohithegde: please, please, please learn the difference between a bit and a byte. Your answer is completely wrong because of this difference Referenced post deleted before seeing this clarification. d |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
i tried this conversion, the byte length comes out to be 15 bytes. is it some standard ????? |
You tried what conversion? What did you code exactly? There are defaults for the output form and length of various conversions, but you can override them.
The real question is what do you want the converted value to look like and what length do you want it to have? Once you decide that, you can use the appropriate statement to do the conversion you want.
If you need help figuring out how to do the conversion you want, show an example of the input values and what you want for output. |
|
Back to top |
|
|
gagandeep
New User
Joined: 22 Jul 2008 Posts: 3 Location: India
|
|
|
|
I had two Comp-3 variable in the input file.
PIC S9(9)V99 COMP-3. and PIC S9(11)V99 COMP-3.
I converted these field using the following OUTREC
72,6,PD,M4 and 119,7,PD,M4(first field starting from position 72 and second from 119)
In output file, the the converted value occupy 15 and 18 bytes respectively.
How this length bytes are calculated by the system internally?
Thanks for your Replies...... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Gags,
Here's how DFSORT determines the output length.
You used an edit mask of M4 which has a pattern of:
SII,III,...,IIT.TT
A 6-byte PD value has a sign and 11 digits (e.g. X'12345678901C'). The 11 digits are substituted for the I and T characters in the M4 pattern from right to left and the sign (+ or -) is substituted for S resulting in:
+123,456,789.01
which is 15 characters.
A 7-byte PD value has a sign and 13 digits (e.g. X'1234567890123C'). The 13 digits are substituted for the I and T characters in the M4 pattern from right to left and the sign (+ or -) is substituted for S resulting in:
+12,345,678,901.23
which is 18 characters. |
|
Back to top |
|
|
|