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
 

 

comparison of numeric values and doing arithmetic on them

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

New User


Joined: 22 Jun 2007
Posts: 7
Location: bangalore

PostPosted: Mon Nov 19, 2007 9:28 am    Post subject: comparison of numeric values and doing arithmetic on them
Reply with quote

Hi ,

I have 2 input files with same format (length = 7 ,FB).
Based on first field 1-5 i've to compare the numeric value of 2nd field
6-7 .

ex:
1st file : abcde2

2nd file : abcde3

if numeric field in 2nd file is greater than 30% of numeric field in 1st file
then i've to write a report which will contain the first field 1-5,first file numeric field,2nd file numeric field .

I have tried using ifthen and parse fields in inrec field but of no use.

Thanks for any help.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Nov 19, 2007 9:37 am    Post subject:
Reply with quote

Maks,

Quote:
Based on first field 1-5 i've to compare the numeric value of 2nd field

Does any of the file contain dups in the first field (1-5)? If yes, how iwll you proceed?
Back to top
View user's profile Send private message
maks

New User


Joined: 22 Jun 2007
Posts: 7
Location: bangalore

PostPosted: Mon Nov 19, 2007 9:59 am    Post subject: Reply to: comparison of numeric values and doing arithmetic
Reply with quote

Hi Murmohk,

There are no duplicates for the first field 1-5 .

Thanks
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Nov 19, 2007 11:06 am    Post subject:
Reply with quote

Maks,

Try this -

Code:
//STEP@@@@  EXEC PGM=ICETOOL             
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG  DD SYSOUT=*                   
//*                                     
//FILE1 DD *                             
TESTT10                                 
ABCDE10                                 
EFGHI20                                 
KLMNO30                                 
ZZZZZ90                                 
/*                                       
//FILE2 DD *                             
TESTT13                                 
ABCDE30                                 
EFGHI20                                 
KLMNO31                                 
ZZZZZ93                                 
/*                                       
//TEMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS)                       
//TEMP2 DD DSN=&&TEMP2,DISP=(MOD,PASS)                       
//TEMP3 DD DSN=&&TEMP3,DISP=(MOD,PASS)                       
//FINAL DD SYSOUT=*                                         
//*                                                         
//TOOLIN DD *                                               
  COPY FROM(FILE1) TO(TEMP1) USING(CTL1)                     
  COPY FROM(FILE2) TO(TEMP1) USING(CTL2)                     
  SPLICE FROM(TEMP1) TO(TEMP2) ON(1,5,CH) WITH(8,2)         
  COPY FROM(TEMP2) TO(FINAL) USING(CTL3)                     
/*                                                           
//CTL1CNTL DD *                                             
  INREC FIELDS=(1,7,2X)                                     
  OUTREC OVERLAY=(20:6,2,ZD,MUL,+30,EDIT=(TTTTTT),           
                  30:20,6,ZD,DIV,+100,EDIT=(TT),             
                  40:30,2,ZD,ADD,6,2,ZD,EDIT=(TTT))         
/*                                                           
//CTL2CNTL DD *                           
  OUTREC FIELDS=(1,5,2X,6,2)             
/*                                       
//CTL3CNTL DD *                           
  INCLUDE COND=(8,2,ZD,GT,40,3,ZD)       
  OUTREC BUILD=(1,9)                     
/*                                       


O/P:

Code:
---+----1----+----2---
**********************
ABCDE1030             
**********************
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: Tue Nov 20, 2007 12:29 am    Post subject:
Reply with quote

maks,

Here's a better DFSORT/ICETOOL job that will do what you want (simpler, and uses fewer passes and fewer temporary data sets):

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/7)
//IN2 DD DSN=...  input file2 (FB/7)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/9)
//*
//TOOLIN DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)
  COPY FROM(IN2) TO(T1) USING(CTL2)
  SPLICE FROM(T1) TO(OUT) ON(1,5,CH) WITH(8,2) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,7,10:(6,2,ZD,MUL,+13),DIV,+10,EDIT=(TTT))
/*
//CTL2CNTL DD *
  INREC BUILD=(1,5,8:6,2,12:X)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
    INCLUDE=(8,2,ZD,GT,10,3,ZD),
    BUILD=(1,9)
/*
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


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