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
 

 

JCL to return the count based on a key in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Rahul Reddy R

New User


Joined: 01 Apr 2008
Posts: 4
Location: Mysore

PostPosted: Fri May 15, 2009 3:20 pm    Post subject: JCL to return the count based on a key in a file
Reply with quote

I need a JCL/Utility which returns the count for each key in a flat file.

Eg:
If the file has dept, vend and clr as fields and the data goes like this...

dept vend clr
220 336 100
220 336 120
220 336 250
220 450 500
220 450 850
360 254 120
360 254 560
360 254 720
360 265 560

The output should be the count based on dept and vend. i.e., as given below

dept vend count
220 336 3
220 450 2
360 254 3
360 265 1


Is there any way to get this result through a JCL/Utility instead of a program.

Thanks in Advance....
Rahul
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 15, 2009 3:36 pm    Post subject:
Reply with quote

How about using sort utility for it.. (Assuming input LRECL=11)
Code:

//S1    EXEC  PGM=SORT             
//SORTIN DD *                     
220 336 100                       
220 336 120                       
220 336 250                       
220 450 500                       
220 450 850                       
360 254 120                       
360 254 560                       
360 254 720                       
360 265 560                       
//SORTOUT   DD SYSOUT=*           
//SYSOUT    DD  SYSOUT=*           
//SYSPRINT DD SYSOUT=*             
//SYSIN    DD  *                   
  SORT FIELDS=(1,3,CH,A,5,3,CH,A) 
  SUM FIELDS=(12,8,ZD)             
  INREC BUILD=(1,11,C'00000001')   
  OUTREC BUILD=(1,8,12,8)     
/*                           

Output will be
Code:

220 336 00000003
220 450 00000002
360 254 00000003
360 265 00000001
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri May 15, 2009 3:36 pm    Post subject:
Reply with quote

Quote:
Is there any way to get this result through a JCL/Utility instead of a program.

[rant on]
What do really think that a JCL executes. It executes a program be it a utility or what.

All JCL does is to instruct the CPU which program to process, and which files are allocated to the process.
This process is called a job

[rant off]
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm


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