MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SORT query

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
mfsrini
Beginner


Joined: 10 Aug 2006
Posts: 11
Topics: 6

PostPosted: Tue Jan 01, 2008 11:19 pm    Post subject: SORT query Reply with quote

Hi,
I need to sort one input file which contains both header and detail records. My requirement is to count the total number of Detail records

Note: All header records are having first 3 characters as "ABC" data

how to get the count only the Detail records
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Jan 02, 2008 12:43 am    Post subject: Re: SORT query Reply with quote

mfsrini,

The below code will give you the desired results.

DFSORT solution:

Code:
//STEP01 EXEC  PGM=ICEMAN                                       
//SORTIN   DD  *                                             
ABC12345                                                     
23456                                                         
34567                                                         
45678                                                         
56789                                                         
67890                                                         
//SYSOUT   DD  SYSOUT=*                                       
//SORTOUT  DD  SYSOUT=*                                       
//SYSIN    DD  *                                             
  SORT FIELDS=COPY                                           
  OMIT COND=(1,3,CH,EQ,C'ABC')                               
  OUTFIL TRAILER1=('TOTAL NUMBER OF RECORDS =',COUNT)
/*                                                           


SORTOUT:
Code:
23456                           
34567                           
45678                           
56789                           
67890                           
TOTAL NUMBER OF RECORDS =       5


If you dont need the detail records then use the following


Code:

//CTRCDS EXEC PGM=ICEMAN                                 
//SYSOUT DD SYSOUT=*                                     
//SORTIN DD *                                           
ABC12345                                                 
23456                                                   
34567                                                   
45678                                                   
56789                                                   
67890                                                   
//SORTOUT DD SYSOUT=*                                   
//SYSIN DD *                                             
  OPTION COPY                                           
  OMIT COND=(1,3,CH,EQ,C'ABC')                           
  OUTFIL NODETAIL,REMOVECC,                             
  TRAILER1=('COUNT WITHOUT HEADER:',COUNT=(M11,LENGTH=8))
/*                                                       

SORTOUT:
Code:
COUNT WITHOUT HEADER:00000005
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group