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
 

 

Count of records by grouping using 2 or more fields

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

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Wed Jun 03, 2009 2:56 pm    Post subject: Count of records by grouping using 2 or more fields
Reply with quote

I'm having a few products and detail of the user who modified it will be available in a file. I have to group the group the products
by the first 3 digits and the user and get the count of added, changed, deleted records for that group.

Eg:

Product User-id Change
aa156789 User1 Add
aa290898 User1 Add
aa198647 User1 Chg
aa109844 User1 Del

o/p should look like

Prefix User-id Add Chg Del
aa1 User1 1 1 1
aa2 User1 1 0 0

Is it possible to generate this output using DFsort.
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 Jun 03, 2009 9:30 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
aa156789 User1   Add
aa290898 User1   Add
aa198647 User1   Chg
aa109844 User1   Del
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:C'000')),
        IFTHEN=(WHEN=(18,3,CH,EQ,C'Add'),OVERLAY=(21:C'1')),
        IFTHEN=(WHEN=(18,3,CH,EQ,C'Chg'),OVERLAY=(22:C'1')),
        IFTHEN=(WHEN=(18,3,CH,EQ,C'Del'),OVERLAY=(23:C'1'))
  SORT FIELDS=(1,3,CH,A,10,8,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    HEADER2=('Prefix User-id  Add    Chg   Del'),
    SECTIONS=(1,3,SKIP=0L,10,8,
      TRAILER3=(1,3,8:10,8,
        17:TOT=(21,1,ZD,EDIT=(IIT)),
        24:TOT=(22,1,ZD,EDIT=(IIT)),
        30:TOT=(23,1,ZD,EDIT=(IIT))))
/*
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Jun 04, 2009 12:13 pm    Post subject:
Reply with quote

Great!!! That worked...
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Jun 04, 2009 12:13 pm    Post subject:
Reply with quote

Thanks Frank.
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm


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