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 

Different detailed records count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Oct 05, 2011 8:00 am    Post subject: Different detailed records count Reply with quote

Hi,

I have one file with Header, and two type of detailed records.
Header is identified by 'HD' in first two bytes.
Two types of detailed records are identified by 'AC' and 'AD' respectively.
I need to print detailed along with header and trailer; showing total detailed records count in first 5 bytes, 'AC' records count in next 5 bytes, 'AD' records count in next 5 bytes.

For example
For input file:
Code:
HD
AC
AC
AD
AD
AD


Output file should be:
Code:
HD
AC
AC
AD
AD
AD
000050000200003

Please help to get above result
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Oct 05, 2011 10:27 am    Post subject: Reply with quote

psmadhusudhan,

Assuming the LRECL=80 and RECFM=FB , the following DFSORT JCL will give you the desired results. Do not use this solution for VB files.

Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                     
HD                                                 
AC                                                 
AC                                                 
AD                                                 
AD                                                 
AD                                                 
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),     
  IFTHEN=(WHEN=(1,2,CH,EQ,C'AC'),OVERLAY=(81:C'1')),
  IFTHEN=(WHEN=(1,2,CH,EQ,C'AD'),OVERLAY=(82:C'1'))
                                                   
  OUTFIL REMOVECC,BUILD=(1,80),                     
  TRAILER1=(COUNT-1=(M11,LENGTH=5),                 
            TOTAL=(81,1,ZD,M11,LENGTH=5),           
            TOTAL=(82,1,ZD,M11,LENGTH=5))           
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Fri Oct 07, 2011 7:59 am    Post subject: Reply with quote

Thanks Kolusu. It worked perfectly. Smile
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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