IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Coverting Signed numeric to Text format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Thu Apr 14, 2011 1:15 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 14, 2011 3:01 am
Reply with quote

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
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Thu Apr 14, 2011 10:58 am
Reply with quote

Hi Frank Yaeger,

Could you please explain me what does it mean EDIT=(SIIIT.TT)?

Many Thanks in advance

Regards,
Raghu
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Apr 14, 2011 12:29 pm
Reply with quote

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
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Thu Apr 14, 2011 3:21 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Apr 14, 2011 3:37 pm
Reply with quote

To lazy to use a site called Google?

An Introduction to COBOL Numeric Encoding Formats & Internal Structures

And the answer to the initial question is obviously: YES!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 14, 2011 8:34 pm
Reply with quote

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
View user's profile Send private message
ragbose

New User


Joined: 11 Jan 2010
Posts: 13
Location: chennai/hyderabad

PostPosted: Fri Apr 15, 2011 10:13 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 15, 2011 9:03 pm
Reply with quote

Complete EBCDIC tables can be found on the web. For example:

nemesis.lonestar.org/reference/telecom/codes/ebcdic.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top