View previous topic :: View next topic
|
Author |
Message |
sriramvempaty
New User
Joined: 02 Aug 2007 Posts: 18 Location: india
|
|
|
|
Hi,
I have a file which has numeric data in three parts of file present in character format.
1 to 10 bytes,
20 to 32 bytes,
52 to 54 bytes.
My record length is 60 bytes.
How can i convert those characters to numeric?
Thanks. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
What do you mean by numeric??
you mean PD (packed decimal) |
|
Back to top |
|
|
sriramvempaty
New User
Joined: 02 Aug 2007 Posts: 18 Location: india
|
|
|
|
Simply from CH to ZD format. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
How can i convert those characters to numeric? |
It depends on what your data looks like. For example, a 10-byte character field of:
1234567890
is already in ZD format, whereas a 10-byte value of:
-123456789
is not.
So you need to show an example of the records in your input file and what you expect for output. If your input data is not displayable, show it in hex. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
Quote: |
For example, a 10-byte character field of:
1234567890
is already in ZD format
|
Frank, I thought 1234567890 in ZD looks like line 2 or 3 in the code below (depending on positive or negetive). Where as in CH format it looks like line 1. Is it not the case?
Code: |
000001 1234567890
FFFFFFFFFF4444
12345678900000
---------------------
000002 123456789{
FFFFFFFFFC4444
12345678900000
---------------------
000003 123456789}
FFFFFFFFFD4444
12345678900000
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Line1 is a valid positive ZD value using an F sign (and also a CH value). Line2 is a valid positive ZD value using a C sign. Line3 is a valid negative ZD value using a D sign.
F and C are both valid ZD signs.
The real question here is what the OP's CH input values look like. If, in addition, he wants his positive ZD output values to have a particular sign (F or C) for some reason (some applications require one or the other), he can tell us that. |
|
Back to top |
|
|
|