Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us