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
 

 

Summing data and filtering to another file

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

New User


Joined: 14 Aug 2008
Posts: 3
Location: Belgium

PostPosted: Thu Jan 13, 2011 1:29 am    Post subject: Summing data and filtering to another file
Reply with quote

I want to sum some data from different records with the same key, and depending of the result I want to write records to another file.
example:

Record key(1:7)
Value (8:4)

Code:
A0000010020
A0000010030
B0000010020
C0000010020
C0000010020
C0000010010

If the sum of the values of the records with the same key EQ 50 than write the data to another file
Result
Code:
A0000010020
A0000010030
C0000010020
C0000010020
C0000010010
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: Thu Jan 13, 2011 2:28 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/11)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/11)
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SORT JKFROM TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,7,CH,A)
  SUM FIELDS=(8,4,ZD)
  OUTFIL INCLUDE=(8,4,ZD,EQ,50),BUILD=(1,7)
/*
//CTL2CNTL DD *
  JOINKEYS F1=T1,FIELDS=(1,7,A),SORTED
  JOINKEYS F2=IN,FIELDS=(1,7,A)
  REFORMAT FIELDS=(F2:1,11)
  OPTION COPY
/*
Back to top
View user's profile Send private message
wout

New User


Joined: 14 Aug 2008
Posts: 3
Location: Belgium

PostPosted: Fri Jan 14, 2011 12:49 am    Post subject: Thanks
Reply with quote

Thanks
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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