Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : programming pearls - The fastest algorithm can frequently be replaced by one that is almost as fast and much easier to understand.

Google
 
Web mainframegurukul.com

Welcome to the mainframegurukul forums.

You are currently viewing our mainframe forums as a guest which gives you limited access to view most discussions, articles. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support at admin@mainframegurukul.com


Strange result in SORT Arithmatic Division

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
Captain Nero
Member


Joined: 20 Jun 2008
Posts: 10
Location: Kolkata, India

PostPosted: Fri Jun 27, 2008 7:04 pm    Post subject: Strange result in SORT Arithmatic Division Reply with quote

Hi all,

I have a file in which the 17th and 18th positions have two numeric fields, I want to divide the first one by the second one and populate the 43rd position with a particular edit.

The card I have used in the OUTREC for this is -

OUTREC OVERLAY=(1,33,34:C'|RATIO = ',
43:(17,6,ZD,MUL,+10000000000),DIV,28,6,ZD,
EDIT=(IIIT.TTTTT),53:C'|')
SORT FIELDS=(1,2,CH,A)

However, I am getting some strange values in the 43rd column like sown.
AK - 000001|F - 000000|M - 000001|RATIO = 0.00000|
AL - 000029|F - 000014|M - 000015|RATIO = 3571.42857|
AR - 000013|F - 000005|M - 000008|RATIO = 1700.68027|
AZ - 000032|F - 000012|M - 000020|RATIO = 1581.02766|
CA - 000242|F - 000100|M - 000142|RATIO = 975.60975|
CO - 000028|F - 000012|M - 000016|RATIO = 1403.50877|
CT - 000070|F - 000030|M - 000040|RATIO = 833.33333|

Can somebody please explain me why is this coming and what can be the remedy. I have multiplied the first field by 10000000000 as this was a requirement.
_________________
Regards,
Captain N.
Back to top
View user's profile Send private message

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Sat Jun 28, 2008 1:19 am    Post subject: Reply with quote

I don't know how you got

3571.42857

from 14 and 15 with that statement. When I do it with DFSORT, I get:

3333.33333

which is what I'd expect. Here's why:

DFSORT does integer arithmetic (it throws away the decimal places), so:

(14 * 10000000000)/15 = 9333333333

There are 10 digits in that result but your edit mask of IIIT.TTTTT only has 9 digits, so the digits are mapped right to left and the first digit (the 9 gets dropped). The result is:

3333.33333

If you had 10 digits in your edit mask as IIIIT.TTTTT, the leading digit wouldn't be dropped and you'd get:

93333.3333

But I don't know where you got

3571.42857

You'd have to prove to me that DFSORT produced that result with the input you showed.

By the way, since you're using OVERLAY, you don't need 1,33 - OVERLAY will leave that data as is.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Captain Nero
Member


Joined: 20 Jun 2008
Posts: 10
Location: Kolkata, India

PostPosted: Sat Jun 28, 2008 12:01 pm    Post subject: Reply with quote

Hi Frank,

I have put the result directly from the mainframe. However, i will get you the DFSMSG on Monday. I am really quite perplexed to see the results.

Hope something will turn out.
_________________
Regards,
Captain N.
Back to top
View user's profile Send private message
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Sat Jun 28, 2008 8:13 pm    Post subject: Reply with quote

Well, at the very least you should make the edit mask larger so you can see the full result rather than a truncated result.

It would be helpful to "display" the relevant input fields and the actual output values you received for those input fields with and without truncation, all in the same line, as well as the DFSORT messages.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Captain Nero
Member


Joined: 20 Jun 2008
Posts: 10
Location: Kolkata, India

PostPosted: Sun Jun 29, 2008 8:43 pm    Post subject: Reply with quote

Yes frank I will make the changes on the mask and the Overlay of the first 33 bytes as you have suggested, however, the input file and the output are right in front of you... My input was without the last column and I have added the last column(Ratio) in the output.

Thanks.
_________________
Regards,
Captain N.
Back to top
View user's profile Send private message
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Mon Jun 30, 2008 10:45 pm    Post subject: Reply with quote

Sanity check. Let's simplify things.

When I run this with DFSORT:

Code:

//S1    EXEC  PGM=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD *                                       
AK - 000001|F - 000000|M - 000001|                   
AL - 000029|F - 000014|M - 000015|                   
AR - 000013|F - 000005|M - 000008|                   
AZ - 000032|F - 000012|M - 000020|                   
CA - 000242|F - 000100|M - 000142|                   
CO - 000028|F - 000012|M - 000016|                   
CT - 000070|F - 000030|M - 000040|                   
//SORTOUT DD SYSOUT=*                               
//SYSIN    DD    *                                   
  SORT FIELDS=(1,2,CH,A)                             
  OUTREC BUILD=(17,6,ZD,X,28,6,ZD,X,                 
     (17,6,ZD,MUL,+10000000000),DIV,28,6,ZD)         
/*


I get this output:

Code:

     0       1                0   
    14      15       9333333333   
     5       8       6250000000   
    12      20       6000000000   
   100     142       7042253521   
    12      16       7500000000   
    30      40       7500000000   


Please run this job and show what you get along with the //SYSOUT messages. (The output you say you get with the input and control statements you say you use doesn't seem to make any sense, so let's simplify things).
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Captain Nero
Member


Joined: 20 Jun 2008
Posts: 10
Location: Kolkata, India

PostPosted: Tue Jul 01, 2008 10:38 am    Post subject: Reply with quote

Frank I also got output as expected Smile the problem was with an INREC statement which I have put in different control.

Now it is working fine. Cool
_________________
Regards,
Captain N.
Back to top
View user's profile Send private message
Captain Nero
Member


Joined: 20 Jun 2008
Posts: 10
Location: Kolkata, India

PostPosted: Tue Jul 01, 2008 10:43 am    Post subject: Reply with quote

And Thank you so much for the help.
_________________
Regards,
Captain N.
Back to top
View user's profile Send private message
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Tue Jul 01, 2008 7:53 pm    Post subject: Reply with quote

You're welcome. Glad to hear it was a "user error". Thanks for letting us know. .
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Easytrieve program for getting Recound counts. 1 prakash.subramaniam 1578 Mon Oct 05, 2009 5:09 pm
Natarajan View latest post
No new posts Getting Error while using ICEMAN tool 4 giri211 2138 Mon Aug 31, 2009 3:59 pm
giri211 View latest post
No new posts Replacing characters Using JCL 5 rachitsethcse 2942 Thu Jul 23, 2009 9:46 pm
Frank Yaeger View latest post
No new posts Getting no of records in a file 8 Rajapriyaa 2479 Mon May 18, 2009 11:30 am
Anuj Dhawan View latest post
No new posts Calling COBOL from C - getting SOC1 0 balajiiinx 2673 Tue Sep 23, 2008 10:25 am
balajiiinx View latest post
 



This widget requires Flash Player 9 or better








Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB