Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
gylbharat

Active Member

Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

 Posted: Wed Jul 27, 2011 6:24 pm    Post subject: Syncsort - COMP-2 to ZD Hi, I want to know how can we convert COMP-2 to ZD (Readable format) in Syncsort? Suppose the value is 1.19875E3 it should get converted to 1198.75

gylbharat

Active Member

Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

 Posted: Wed Jul 27, 2011 6:28 pm    Post subject: I have referred to the post - http://ibmmainframes.com/about46065.html But I don't want to loose the decimal part.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

Posted: Wed Jul 27, 2011 6:40 pm    Post subject:

 gylbharat wrote: I have referred to the post - http://ibmmainframes.com/about46065.html But I don't want to loose the decimal part.

How many decimal places do you want to keep?

If 2, multiply the FL by 100 first
If 3, multiply the FL by 1000 first
If 4, multiply the FL by 10000 first
etc
gylbharat

Active Member

Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

Posted: Thu Jul 28, 2011 1:31 pm    Post subject:

Its not working for me....

My value is
 Code: +5.345000000000000E+01

 Code: 53.450000

using syncsort.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu Jul 28, 2011 4:35 pm    Post subject: Reply to: COMP-2 to ZD You know the drill. "It's not working" is useless. You originally asked for it to go to ZD. ZD does not contain ".". You'd need an edit mask to get it to appear with the ".". It seems you want six decimal places. Your typical ZD in a sort has no implied decimal places (or, another way, it has any number of implied decimal places, you just have to do the implying seperate to the field). So, say you have 10 bytes. You want six for the decimal places. If you transfer the floating to the ZD, you will loose low-order significance unless you specifically code for it, as there is no implicit decimal in the ZD. So, for six places, multiply by 1000000 first, then transfer to the ZD. If this does not work, show what it does do, please.
gylbharat

Active Member

Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

Posted: Thu Jul 28, 2011 7:18 pm    Post subject:

Hi Bill,

I tried using this -
 Code: //STEP050  EXEC PGM=SORT                                        //SYSOUT   DD SYSOUT=*                                          //SORTIN   DD DSN=ITA.TEST.AJ.WORK.XMITIN.EWHOLD01,DISP=SHR      //SORTOUT  DD SYSOUT=*                                          //SYSIN    DD *                                                    SORT FIELDS=COPY                                                OUTREC FIELDS=(01:58,8,                                                         09:C' ',                                                         10:58,8,FL,MUL,+1000000,EDIT=(TTT.TTTTTT))      /*

But still not getting the output
 Code: =COLS> ----+----1----+----  ****** *******************  000001 â Ë      053.000000  000002          000.000000  000003 â ÌéÔe ½ 017.000000  000004          000.000000  000005          000.000000  000006          000.000000  000007 â 'øtP   052.000000  000008          000.000000  000009 â ¿e ½éÖ 016.000000  000010          000.000000

In Hex
 Code: =COLS> ----+----1----+---- ****** ******************* 000001 â Ë      053.000000        437333334FFF4FFFFFF        253333330053B000000 -------------------------- 000002          000.000000        000000004FFF4FFFFFF        000000000000B000000 -------------------------- 000003 â ÌéÔe ½ 017.000000        4175E81B4FFF4FFFFFF        2181B5E80017B000000 -------------------------- 000004          000.000000        000000004FFF4FFFFFF        000000000000B000000 -------------------------- 000005          000.000000        000000004FFF4FFFFFF        000000000000B000000 -------------------------- 000006          000.000000        000000004FFF4FFFFFF        000000000000B000000
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu Jul 28, 2011 7:46 pm    Post subject: Reply to: COMP-2 to ZD Mmmm.... I was thinking you wanted it in a ZD first, then could apply the edit the to ZD. However, the approach you have taken might be hinting that this won't work either. On the other hand, you are getting more than one digit of integer. Try just converting it to ZD so you know whether that route works. If not, back to the drawing board. Have you got a SYNCSORT manual?
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Fri Jul 29, 2011 1:03 am    Post subject: Reply to: Syncsort - COMP-2 to ZD gylbharat, After I got a big hint, this is not going to work. Any arithmetic is only going to apply to the integer part of the floating-point number, so the fractional part cannot be made into "integer" by multiplication. Sorry about that. Fancy a little Cobol to do it?
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Fri Jul 29, 2011 1:05 am    Post subject: Hello, Why might this need to be people-readable? The computers have no trouble at all with the float format and if any real processing is to be done, i expect it is to be with computers.
gylbharat

Active Member

Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

 Posted: Fri Jul 29, 2011 11:48 am    Post subject: Hi Dick, There is requirement where we have to FTP this file to a Unix box and there while processing this , the columns should be in a readable format.
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Fri Jul 29, 2011 7:38 pm    Post subject: Hello, Last i heard, UNIX works with floating point. . . Probably there is something i misunderstand.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Fri Jul 29, 2011 8:05 pm    Post subject: Reply to: Syncsort - COMP-2 to ZD Hello, Good old EBCDIC-to-ASCII translation. Good way to garble "non-display" fields, as all sorts of values for "control codes" in your binary fields get translated rather than left asis, let alone if you happen to have values which are "display" in your fields, they'll go mess about with themselves as well. I know you're aware of this :-) Also, is the Unix 7-bit? Is the float the same internal format? Best way to go for display, my opinion.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Reformatting and adding additional fi... Badbeef SYNCSORT 6 Thu Apr 05, 2018 4:45 pm COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us