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

Filtering data and summing the filed values into trailer.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Muthukumar.PLindia

New User


Joined: 03 Jul 2006
Posts: 51
Location: Chennai

PostPosted: Wed Feb 21, 2007 11:47 am
Reply with quote

Please help me out in coding this in a single sort step...

Input file:
----------
Header record
data
Trailer ( actually trailer holds the count of data records and sum of an amount filed in the record)

my requirement is to filter the data records based on condition and update the trailer record with the updated count and summed values of the amount in trailer record.

first digit wil indicate the type of record(header, trailer, data)

output file should be like:

header record
data record(filetered)
Trailer(with modified counts and sum)


I have to complete this in a single step...
Back to top
View user's profile Send private message
Muthukumar.PLindia

New User


Joined: 03 Jul 2006
Posts: 51
Location: Chennai

PostPosted: Wed Feb 21, 2007 12:01 pm
Reply with quote

Example:
Input file
------------
H header
D key1 0100
D key2 0200
D key1 0300
T 3 0600 ( 3 is the count of record and 600 is the total sum of amt)



Sort(filters key1 alone)


output file:
-----------
H header
D key1 0100
D key1 0300
T 2 0400
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: Wed Feb 21, 2007 10:04 pm
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
H header
D key1   0100
D key2   0200
D key1   0300
T  3        0600
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,1,CH,EQ,C'T',OR,
    (1,1,CH,EQ,C'D',AND,3,4,CH,NE,C'key1'))
  OUTFIL REMOVECC,
   TRAILER1=(1:'T',3:COUNT-1=(EDIT=(IT)),
     13:TOT=(10,4,ZD,EDIT=(TTTT)))
/*
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: Mon Nov 15, 2010 11:44 pm
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010), you can now use DFSORT's new IFTRAIL function to do this more easily like this:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
H header
D key1   0100
D key2   0200
D key1   0300
T  3        0600
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL INCLUDE=(3,4,CH,EQ,C'key1'),
   IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
    TRLUPD=(3:COUNT=(EDIT=(IT)),
     13:TOT=(10,4,ZD,EDIT=(TTTT))))
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top