View previous topic :: View next topic
|
Author |
Message |
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi,
I want to convert signed numeric field to readable format (with signs)
The file is FB with 117bytes and the signed numeric spans from 98th byte to 108th byte S9(9)V99
Input (pasting from 98th byte to 108th byte)
0000002797N
00000138700
00000150000
0000004029J
00000127500
Output should be
-279.75
1387.00
1500.00
-402.91
1275.00
Please help in converting this signed byte to normal charcter format ?
Thanks
Vinu |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If I understand what you want, you can use these DFSORT control statements:
Code: |
OPTION COPY
INREC BUILD=(98,11,ZD,EDIT=(SIIIT.TT),SIGNS=(,-))
|
For your input example, the output would be:
Code: |
-279.75
1387.00
1500.00
-402.91
1275.00
|
|
|
Back to top |
|
|
ragbose
New User
Joined: 11 Jan 2010 Posts: 13 Location: chennai/hyderabad
|
|
|
|
Hi Frank Yaeger,
Could you please explain me what does it mean EDIT=(SIIIT.TT)?
Many Thanks in advance
Regards,
Raghu |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
Could you please explain me what does it mean EDIT=(SIIIT.TT)?
|
The fine manual is quite clear on this. The 'S' represents the leading sign, the 'I's suppress zeroes and the 'T's are significant digits. The decimal point is a decimal point.
Garry. |
|
Back to top |
|
|
ragbose
New User
Joined: 11 Jan 2010 Posts: 13 Location: chennai/hyderabad
|
|
|
|
Thanks Garry,
If possible can u explain me how the syntax convert the value
OPTION COPY
INREC BUILD=(98,11,ZD,EDIT=(SIIIT.TT),SIGNS=(,-))
I am clear with this syntax EDIT= (SIIIT.TT).
my question is how the value of the input file which has N and J is converted in to Sign and if i change the value of 00000127500
to 0000012750C i am getting this value "1275.03 "
Input
0000002797N
00000138700
00000150000
0000004029J
00000127500
is converted in to
Output
-279.75
1387.00
1500.00
-402.91
1275.00
Many thanks in advance
Regards,
Raghu |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Raghu,
You need to understand how various numeric formats are encoded in order to understand how they are converted.
ZD values are encoded with a sign for the zone of the last byte. For example, a 3-byte ZD value is encoded as:
X'FdFdsd'
where d is 0-9 and s is the sign. Typically s is C or F for a positive value and D for a negative value. So, for example, 12C = X'F1F2C3' or 123 = X'F1F2F3' would be a value of +123, and 52J = X'F5F2D1' would be a ZD value of -521.
For more information on DFSORT data formats, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA50/C.0?DT=20100630155256 |
|
Back to top |
|
|
ragbose
New User
Joined: 11 Jan 2010 Posts: 13 Location: chennai/hyderabad
|
|
|
|
Thank you so much Frank,
I got what i wanted,
Hope this might be useful for some 1
Code: |
EBCDIC Equivalencies
------------------------
As it appears What it prints as
in storage
"HEX"
40 space
F0 0
F1 1
F2 2
F3 3
F4 4
F5 5
F6 6
F7 7
F8 8
F9 9
C1 A
C2 B
C3 C
C4 D
C5 E
C6 F
C7 G
C8 H
C9 I
D1 J
D2 K
D3 L
D4 M
D5 N
D6 O
D7 P
D8 Q
D9 R
E2 S
E3 T
E4 U
E5 V
E6 W
E7 X
E8 Y
E9 Z
|
Thanks
Raghu |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|