MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
sameermn Beginner Joined: 08 Aug 2005 Posts: 6 Topics: 3
Posted: Mon Aug 08, 2005 1:37 pm Post subject: Remove Trailer and Update the total count in Syncsort
Hi,
I need to sort a file & create an output.
The input file is in this format
Code:
9901xxxx
1111
2222
3333
9902yyyy
9902zzzz
As you can see i have 2 trailers with each having a count value which sums up to total number of detail records.
In my final output i want only one trailer record with a sum of counts value.
Apart from this i have some sort conditions for detail records as well.
Is it possible to achieve all these functionality in a single sort step? _________________ Sameer
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Aug 08, 2005 2:09 pm Post subject:
sameermn,
Couple of questions before I post the solution.
1. What is the LRECL and RECFM ?
2. How do you identify the header and Trailer records?
3. In between the 2 headers which one do you want in the output
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
sameermn Beginner Joined: 08 Aug 2005 Posts: 6 Topics: 3
Posted: Mon Aug 08, 2005 2:21 pm Post subject: File details
Hi Kolusu,
Thx for your response.
1. LRECL = 491 and RECFM = VB
2. Header = 1st 4 bytes 9901, Detail = 1st 4 bytes spaces,
Trailer = 1st 4 bytes 9902
3. Of the 2 Trailers, we can have any one among them as the only value here is the count (from 5th byte 10 positions) which needs to be summed up in to one single record.
Also as i mentioned earlier i need to sort detals records based on criteria
SORT FIELDS=(260,03,CH,A, 272,05,CH,A, 277,08,CH,A, 285,13,CH,A,
263,02,CH,A, 302,09,CH,A)
Regards, _________________ Sameer
Back to top
sameermn Beginner Joined: 08 Aug 2005 Posts: 6 Topics: 3
Posted: Mon Aug 08, 2005 2:33 pm Post subject: Small clarification
Hi Kolusu,
Made a small mistake.
Header 1st 4 bytes = 9900
Detail 1st 4 bytes = 9901
Trailer 1st 4 Bytes = 9902
Regards _________________ Sameer
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Aug 08, 2005 4:26 pm Post subject:
sameermn,
The following JCL will give you the desired results. I assumed that you want the header record also to be counted as a part of the total records.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OMIT COND=(5,4,CH,EQ,C'9902')
SORT FIELDS=(005,04,CH,A,
260,03,CH,A,
272,05,CH,A,
277,08,CH,A,
285,13,CH,A,
263,02,CH,A,
302,09,CH,A)
OUTFIL TRAILER1=(C'9902',COUNT)
/*
If you don't want the header record to be a part of the total count then, then use the following control cards.
Code:
//SYSIN DD *
OMIT COND=(5,4,CH,EQ,C'9902')
SORT FIELDS=(005,04,CH,A,
260,03,CH,A,
272,05,CH,A,
277,08,CH,A,
285,13,CH,A,
263,02,CH,A,
302,09,CH,A)
OUTREC FIELDS=(1,4,
5:5,4,CHANGE=(1,C'9900',C'0'),
NOMATCH=(C'1'),
5)
OUTFIL OUTREC=(1,4,6),
TRAILER1=(C'9902',TOT=(5,1,ZD,EDIT=(TTTTT)))
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
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