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

Arithmetic Operation


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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Apr 16, 2012 9:50 pm
Reply with quote

Rohit Umarjikar wrote:
Yes, you are right the 25 value should be the %.
And file1 value will be at max equals to file 2 value so it will be max of 100%.


Rohit Umarjikar,

You only show 2 digit values and when you calculate the percentage it might result in 3 digits (100%) and you want to compare this to a 2 digit number. Is the data just 2 bytes? or 3 bytes? There are no checks to see if the numbers you pass are valid numbers. what happens if the input has negative numbers or spaces or zeroes?

Assuming that each of the input file has just 1 record and the first 2 bytes have the data,
here is a job which would set the return code to 4 if the calculated percentage is NOT equal to the percentage value in file 3.


Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=* 
//INA      DD DSN=Your input Lrecl 20 File1,DISP=SHR                 
//         DD DSN=Your input Lrecl 20 File2,DISP=SHR
//*           
//INB      DD Your input Lrecl 20 File3,DISP=SHR
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  OPTION COPY                                               
  JOINKEYS F1=INA,FIELDS=(21,1,A),SORTED,NOSEQCK             
  JOINKEYS F2=INB,FIELDS=(21,1,A),SORTED,NOSEQCK             
  REFORMAT FIELDS=(F1:1,8,F2:1,3)               
             
  INREC OVERLAY=(15:(5,3,ZD,MUL,+100),DIV,1,3,ZD,EDIT=(TTT))
  OUTFIL NULLOFL=RC4,INCLUDE=(9,3,ZD,EQ,15,3,ZD)             
//*                                                         
//JNF1CNTL DD *                                             
  OPTION STOPAFT=2                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(C'0',1,2,21:SEQNUM,1,ZD)), 
  IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(5:1,3))                 
//*                                                         
//JNF2CNTL DD *                                             
  OPTION STOPAFT=1                                           
  INREC BUILD=(C'0',1,2,21:C'2')                             
//* 
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Apr 17, 2012 7:05 pm
Reply with quote

Thanks Skolusu...
Great help
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 Arithmetic division using Syncsort SYNCSORT 6
No new posts Help this REXX Rookie-Bad arithmetic ... CLIST & REXX 7
No new posts An write operation error - ABENDED S0... COBOL Programming 3
No new posts Bad arithmetic conversion when assign... CLIST & REXX 4
No new posts HEADER1 with Date arithmetic DFSORT/ICETOOL 4
Search our Forums:

Back to Top