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

comparison of numeric values and doing arithmetic on them


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Mon Nov 19, 2007 9:37 am
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
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: 1436
Location: Bangalore,India

PostPosted: Mon Nov 19, 2007 11:06 am
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 Developer


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

PostPosted: Tue Nov 20, 2007 12:29 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Convert HEX to Numeric DB2 3
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top