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

Summing data and filtering to another file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu Jan 13, 2011 2:28 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
Search our Forums:

Back to Top