Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Coverting Signed numeric to Text format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 151
Location: India

PostPosted: Thu Apr 14, 2011 1:15 am    Post subject: Coverting Signed numeric to Text format
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 Moderator


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

PostPosted: Thu Apr 14, 2011 3:01 am    Post subject:
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    Post subject: Reply to: Coverting Signed numeric to Text format
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

Active Member


Joined: 08 May 2006
Posts: 992
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Apr 14, 2011 12:29 pm    Post subject:
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    Post subject:
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: 1002
Location: Oostende, Belgium

PostPosted: Thu Apr 14, 2011 3:37 pm    Post subject:
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 Moderator


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

PostPosted: Thu Apr 14, 2011 8:34 pm    Post subject:
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:

http://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    Post subject: Reply to: Coverting Signed numeric to Text format
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 Moderator


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

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

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

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us