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

Count of records by grouping using 2 or more fields


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


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

PostPosted: Wed Jun 03, 2009 9:30 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top