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

Author Message
surendra_giddaluru

New User

Joined: 17 May 2007
Posts: 8
Location: chennai

Posted: Wed Sep 05, 2007 3:15 am    Post subject: Arithmetic Division with zeroes using Syncsort

Hi,
I am facing some difficulty while doing division operation using DFSORT. I have to calculate the percentage rate. My input looks like as below, and it is an FB file (80 LRECL)
 Code: ----+----1----+----2----+----3----+-- AAAAAAAA  000000029     000000456    BBBBBBBB  000000010     000000050    CCCCCCCC  000123452     000123452    DDDDDDDD  000006782     000007986    EEEEEEEE  000000000     000000010    FFFFFFFF  000069032     000071236    GGGGGGGG  000000032     000005405

My output should be of the form:
 Code: | Match Rate     6.35964 |    AAAAAAAA  | Match Rate    20.00000 |    BBBBBBBB  | Match Rate   100.00000 |    CCCCCCCC  | Match Rate    84.92361 |    DDDDDDDD  | Match Rate     0.00000 |    EEEEEEEE  | Match Rate    96.90605 |    FFFFFFFF  | Match Rate     0.59204 |    GGGGGGGG

I have used the following SORT to generate the output. It is working fine with all records except for ‘EEEEEEEE’ record, because of all zeroes in the 11 position to 19 position. And I am getting an OUTREC ARITHMETIC OVERFLOW error message. So Please provide me a solution to overcome this problem.
 Code: //STEP001     EXEC PGM=SYNCTOOL,REGION=2048K                            //SORTWK01 DD  UNIT=SYSDA,SPACE=(TRK,2)                                //SORTWK02 DD  UNIT=SYSDA,SPACE=(TRK,2)                                //SYSOUT   DD  SYSOUT=*                                                //DFSMSG   DD  SYSOUT=*                                                //TOOLMSG  DD  SYSOUT=*                                                //SYSUDUMP DD  SYSOUT=*      //IN1      DD  DISP=SHR,DSN=INPUT FILE        //*                                                              //OUTDD    DD DSN=OUTPUT FILE,                //            DISP=(,CATLG,DELETE),                              //             UNIT=SYSDA,SPACE=(TRK,(20,20),RLSE),              //             DCB=(DSORG=PS,RECFM=FB,LRECL=80)                                                             //TOOLIN   DD  *                                                          COPY FROM(IN1) TO(OUTDD) USING(CTL1)                                  //CTL1CNTL DD *                                                          OUTREC FIELDS=(C' | Match Rate                ',                               ((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),EDIT=(IIIIT.TTTTT),               C' |',30X,1,8)                                                /*

Thanks,
Surendra.

Frank Yaeger

DFSORT Moderator

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

Posted: Wed Sep 05, 2007 5:39 am    Post subject:

Actually, when I ran this job with DFSORT's ICETOOL, it did not get any error message and produced this output:

 Code: | MATCH RATE                    6.35964 |                              AAAAAAAA | MATCH RATE                   20.00000 |                              BBBBBBBB | MATCH RATE                  100.00000 |                              CCCCCCCC | MATCH RATE                   84.92361 |                              DDDDDDDD | MATCH RATE                    0.00000 |                              EEEEEEEE | MATCH RATE                   96.90605 |                              FFFFFFFF | MATCH RATE                    0.59204 |                              GGGGGGGG

Since you have PGM=SYNCTOOL, it appears you're actually using Syncsort's SYNCTOOL rather than DFSORT's ICETOOL. Syncsort is getting the error message, not DFSORT.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

I'm moving this thread to the JCL Forum.
shankar.v

Active User

Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

Posted: Wed Sep 05, 2007 11:03 am    Post subject:

surendra_giddaluru,

I tried with your code and input posted by you with SYNCSORT. It shows the output as FRANK's posted.

 Quote: And I am getting an OUTREC ARITHMETIC OVERFLOW error message.

I got the "OUTREC ARITHMETIC OVERFLOW error message" when i tried to divide a number by zero.

Use SYNCSORT instead of SYNCTOOL and reformat the fields in INREC for your requirement. It will be more efficient when doing a run with large number of records.

 Code: // EXEC PGM=SYNCSORT                                            //SYSOUT DD SYSOUT=*                                            //SORTIN DD  *                                                  AAAAAAAA  000000029     000000456                                BBBBBBBB  000000010     000000050                                CCCCCCCC  000123452     000123452                                DDDDDDDD  000006782     000007986                                EEEEEEEE  000000000     000000010                                FFFFFFFF  000069032     000071236                                GGGGGGGG  000000032     000005405                                /*                                                              //SORTOUT DD SYSOUT=*                                            //SYSIN DD  *                                                     OPTION COPY                                                     INREC FIELDS=(C' | MATCH RATE                ',                       ((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),EDIT=(IIIIT.TTTTT),        C' |',30X,1,8)                                            /*                                                              //

Output:
 Code: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 ******************************** Top of Data ***********************************  | MATCH RATE                    6.35964 |                              AAAAAAAA  | MATCH RATE                   20.00000 |                              BBBBBBBB  | MATCH RATE                  100.00000 |                              CCCCCCCC  | MATCH RATE                   84.92361 |                              DDDDDDDD  | MATCH RATE                    0.00000 |                              EEEEEEEE  | MATCH RATE                   96.90605 |                              FFFFFFFF  | MATCH RATE                    0.59204 |                              GGGGGGGG  ******************************* Bottom of Data ********************************
dick scherrer

Site Director

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

 Posted: Wed Sep 05, 2007 6:28 pm    Post subject: Hello, It is also possible that your version of Syncsort is either not up to date or missing some fix(es). I'd suggest opening an issue with Syncsort support to determine why your process did not work correctly. As suggested, make sure that the input is what it should be.
surendra_giddaluru

New User

Joined: 17 May 2007
Posts: 8
Location: chennai

 Posted: Wed Sep 05, 2007 7:50 pm    Post subject: Hi Frank and Sankar thanks a lot for your suggestions. I tried with SYNCTOOL and SYSNSORT both are working fine, thanks. I have one more issue. My input file will sometimes have all zeroes in both (11,9) and (25,9) positions. I tried using SYNCTOOL and SYNCSORT both the times it got abended with 'ARITHMETIC OVERFLOW' error message. The input I used is as below. Please provide me with some solution. ----+----1----+----2----+----3----+-- AAAAAAAA 000000029 000000456 BBBBBBBB 000000010 000000050 CCCCCCCC 000123452 000123452 DDDDDDDD 000006782 000007986 EEEEEEEE 000000000 000000000 FFFFFFFF 000069032 000071236 GGGGGGGG 000000032 000005405
dick scherrer

Site Director

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

 Posted: Wed Sep 05, 2007 10:37 pm    Post subject: Hello, You need to ensure that there will not be a divide by zero. What should happen when both numbers are zero?
surendra_giddaluru

New User

Joined: 17 May 2007
Posts: 8
Location: chennai

 Posted: Wed Sep 05, 2007 11:56 pm    Post subject: Hi, I am rewriting a COBOL program which is currently running for a long time. So now I am doing file processing in the COBOL program and for generating the report, which needs to sum the individual accounts and also needs to calculate the percentage match rate for each account, I am using the SORT. So in my old COBOL program when ever the values in (11,9) and (25,9) positions are zeroes we are moving 0.0000 to the Match Rate without doing any division operation for that perticular account. Now I think we need to verify these values before calculating the match Rate. Atleast the values in (25,9) position, so that the SORT will not fail. If the values in (25,9) position is zeroes I need to move 0.0000 explicitly without doing the division operation for calculating the Match Rate. Hope I am clear this time.
dick scherrer

Site Director

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

Posted: Thu Sep 06, 2007 12:23 am    Post subject:

Helllo,

 Quote: I am rewriting a COBOL program which is currently running for a long time.
How many records are being processed? How long is a "long time"?

What does this COBOL code do that the sort does not do or does differently?

If the code is to read the file and create summary statistics, i believe they should run a similar length of time. The COBOL code may use a bit more cpu, but wall-time should be quite similar as most of the time should be spent doing i/o.

I don't know how to tell Syncsort to conditionally bypass the calculation.
Alissa Margulies

SYNCSORT Support

Joined: 25 Jul 2007
Posts: 500
Location: USA

Posted: Fri Sep 07, 2007 1:31 am    Post subject: Reply to: Division with zeroes using Syncsort

 Quote: I don't know how to tell Syncsort to conditionally bypass the calculation.

Try this code:
 Code: //SYSIN DD  *     SORT FIELDS=COPY     INREC IFTHEN=(WHEN=((11,9,ZD,NE,0),AND,(25,9,ZD,NE,0)),                   BUILD=(C' | MATCH RATE                ',                   ((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),                   EDIT=(IIIIT.TTTTT),C' |',30X,1,8)),           IFTHEN=(WHEN=((11,9,ZD,EQ,0),AND,(25,9,ZD,EQ,0)),                   BUILD=(C' | MATCH RATE                    0.00000 |',                   30X,1,8)) /*
Alissa Margulies

SYNCSORT Support

Joined: 25 Jul 2007
Posts: 500
Location: USA

 Posted: Fri Sep 07, 2007 1:34 am    Post subject: Reply to: Division with zeroes using Syncsort ... Forgot to mention that the above code requires SyncSort for z/OS 1.2.1 or later.
dick scherrer

Site Director

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

 Posted: Fri Sep 07, 2007 2:35 am    Post subject: Reply to: Division with zeroes using Syncsort Hi Alissa, Which Syncsort publication has the writeup for IFTHEN? My downloaded doc does not have IFTHEN. Thanx, d
surendra_giddaluru

New User

Joined: 17 May 2007
Posts: 8
Location: chennai

 Posted: Fri Sep 07, 2007 3:00 am    Post subject: Thank you so much Alissa Margulies, its working fine. Thanks, Surendra.
Alissa Margulies

SYNCSORT Support

Joined: 25 Jul 2007
Posts: 500
Location: USA

Posted: Fri Sep 07, 2007 3:03 am    Post subject: Re: Reply to: Division with zeroes using Syncsort

 dick scherrer wrote: Which Syncsort publication has the writeup for IFTHEN? My downloaded doc does not have IFTHEN.

Hi Dick,

The SyncSort for z/OS 1.2 Addendum contains the BUILD, IFTHEN, IFOUTLEN, and OVERLAY Parameters.

If you have a SyncSort Online Customer Support Account, you can download the file named "SyncSort 1.2 Programmers Guide Add.pdf"

Regards,
mmt_bit

New User

Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

 Posted: Wed May 04, 2011 1:49 am    Post subject: Reply to: Division with zeroes using Syncsort There is a field 9(13) comp-3 (7 bytes long). I need to convert this to a S9(11)v9(2) or DB2 DECIMAL(13,2). (also 7 bytes long) INPUT: 12868 (X'0000000012868F') Control statement logic: 1,7,PD,DIV,+100,LENGTH=7 Output: 1.28 Desired output: 128.68 Why its getting divided by 10000, when I am dividing by 100? What is the correct control statement?
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7312

 Posted: Wed May 04, 2011 2:30 am    Post subject: Reply to: Division with zeroes using Syncsort Don't tag a new question onto the end of an old topic. A packed-decimal field on a file has no decimal places, implicit or explicit. You don't have to convert your data. When you define your field in your code, define with the decimal places and everything will be fine (from your example). With your parameters you are making it 100 times too small, because you are dividing by 100. Leave it alone. Why is your field unsigned (F in the sign nibble, not C for positive (or D for negative))? If this is correct, make sure you define your data as unsigned as well as having the two decimal places.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Populating Date and Sequence numer in... PORYES SYNCSORT 11 Thu Jul 16, 2020 5:01 pm Insert System Runtime in HEADER In SY... Rick Ryan SYNCSORT 9 Tue May 26, 2020 9:01 pm SYNCSORT in Z/VSE nithinkarthika SYNCSORT 24 Mon May 11, 2020 3:44 pm Removing Hyphens and Dots using Syncsort PORYES SYNCSORT 8 Tue Apr 28, 2020 9:52 pm Accumulating fields using syncsort Hemant L SYNCSORT 6 Fri Feb 07, 2020 2:55 am

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