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
 
Filtering data and summing the filed values into trailer.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Filtering data and summing the filed values into trailer.
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    Post subject:
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 Moderator


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

PostPosted: Wed Feb 21, 2007 10:04 pm    Post subject:
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 Moderator


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

PostPosted: Mon Nov 15, 2010 11:44 pm    Post subject:
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:

http://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    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 3270 Data stream error Benchwarmer CICS 6 Tue Apr 17, 2018 12:06 am
No new posts How to list data set names with diffe... murali.andaluri CLIST & REXX 8 Thu Apr 12, 2018 11:33 pm
No new posts LOW VALUES as a KEY juares castro DB2 10 Sat Apr 07, 2018 1:06 am
No new posts Invalid XML character while producing... nikhil.bhole IBM Tools 4 Tue Mar 20, 2018 1:24 am
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am

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