|
View previous topic :: View next topic
|
| Author |
Message |
deepak.tcs
New User

Joined: 02 Dec 2008 Posts: 11 Location: Chennai
|
|
|
|
Hi there,
I have a dataset of format:
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
My requirement is to:
1. Copy the dataset to another dataset by omitting a particular record type(20) which is the first 2 digits of the records.
2. Count the sorted records
3. In the trailer record (type 30) insert the record count in the place of 'XX'
Have completed 1st requirement using SORT and OMIT. But i am not aware of, how to proceed with 2nd and 3rd.
Can anyone please help me on this?
Many thanks,
Deepak |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
deepak.tcs,
If you are ok with creating a dynamic trailer record with count then use the followin JCL. The count will be a 8 byte field. If you want you can change the length
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,2,SS,EQ,C'20,30')
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=(C'30TRAILER',COUNT+1=(M11,LENGTH=8))
/* |
If you want to retain the original trailer and just update the count then use this JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,2,ZD,EQ,20)
SORT FIELDS=COPY
OUTREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,2,ZD,EQ,30),OVERLAY=(10:81,8))
//* |
|
|
| Back to top |
|
 |
deepak.tcs
New User

Joined: 02 Dec 2008 Posts: 11 Location: Chennai
|
|
|
|
Hi Skolusu,
Thanks Alot for your reply! It is working great. But in the first JCL, i need the record count of the output file. (i.e after omitting certain record type). Now it is showing the original file record type.
Regards,
Deepak |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| deepak.tcs wrote: |
Hi Skolusu,
Thanks Alot for your reply! It is working great. But in the first JCL, i need the record count of the output file. (i.e after omitting certain record type). Now it is showing the original file record type.
Regards,
Deepak |
*Sigh* Look carefully at the control cards I posted. Especially the omit card. I am omitting the existing trailer record and creating a new trailer record. |
|
| Back to top |
|
 |
deepak.tcs
New User

Joined: 02 Dec 2008 Posts: 11 Location: Chennai
|
|
|
|
| The second JCL works great for me. I think i need to mention a thing here. i need only the count of the record type 25 in the output file. Record type 10 and 30 are header and trailer, so i don't require those count to be included in the count. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| deepak.tcs wrote: |
| The second JCL works great for me. |
Deepak,
BOTH THE JCL's GIVE THE EXACT SAME RESULTS . Did you run the above shown JCL's as is? Do NOT make any changes and run the jobs by just copying and pasting as is. Look at the output now and tell me if you notice any difference in the 2 outputs.
| Quote: |
I think i need to mention a thing here.i need only the count of the record type 25 in the output file. Record type 10 and 30 are header and trailer, so i don't require those count to be included in the count. |
Are there any other hidden requirements like this? what happens if you have record type 35 which is not omitted? Do you count and copy them to output or do you drop them? Explain all your requirements clearly. |
|
| Back to top |
|
 |
deepak.tcs
New User

Joined: 02 Dec 2008 Posts: 11 Location: Chennai
|
|
|
|
Skolusu,
I am using the second JCL and I didn't do any changes to it. Here are my input and output:
Input:
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
Output:
10HEADERAAAAAA
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILER04
The only thing i changed in the JCL is the length of the count to '2'.In the output, the record count is shown as '04' but i need the count to be '02'. Since the record types 10 and 30 are header and trailer, i don't need the count to include these records. |
|
| Back to top |
|
 |
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
Assuming that You will have only one '30' record, you have to count all the 25 records and the count will not increase more than 2 digits, please see the code below:
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,2,ZD,EQ,20)
SORT FIELDS=COPY
OUTREC IFOUTLEN=80,
IFTHEN=(WHEN=(1,2,ZD,EQ,25,OR,1,2,ZD,EQ,30),
OVERLAY=(81:SEQNUM,2,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,2,ZD,EQ,30),OVERLAY=(10:81,2,ZD,SUB,+01,EDIT=(TT)))
//* |
|
|
| Back to top |
|
 |
deepak.tcs
New User

Joined: 02 Dec 2008 Posts: 11 Location: Chennai
|
|
|
|
Skolusu,
Thanks a bunch for your suggestion!!
Hi Vinod,
Thanks for your response! I have got the solution actually. it matches with what you have suggested. however, your solution holds the restriction of count cannot be more than 2 digits. So Rather than subtracting 1 from the count, we can define the start parameter for the seq number to start. Like this:
| Code: |
IFTHEN=(WHEN=(1,2,ZD,EQ,25,OR,1,2,ZD,EQ,30),
OVERLAY= (81:SEQNUM,4,ZD,START=0),HIT=NEXT),
IFTHEN=(WHEN=(1,2,ZD,EQ,30),OVERLAY=(10:81,4)) |
Please note that i have also defined the seq number length as 4(can be 8 even)
Thanks,
Deepak |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
deepak.tcs,
*Sigh*. If you are ok with creating a header and trailer then use the following
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,2,CH,EQ,C'25')
SORT FIELDS=COPY
OUTFIL REMOVECC,HEADER1=(C'10HEADERAAAAAA'),
TRAILER1=(C'30TRAILER',COUNT=(M11,LENGTH=8))
/*
|
If you want to retain the original header and original trailer then use the following jcl
| Code: |
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,2,SS,EQ,C'10,25,30')
SORT FIELDS=COPY
INREC IFOUTLEN=80,IFTHEN=(WHEN=(1,2,SS,EQ,C'25,30'),
OVERLAY=(81:SEQNUM,8,ZD,START=0,INCR=1),HIT=NEXT),
IFTHEN=(WHEN=(1,2,CH,EQ,C'30'),OVERLAY=(10:81,8))
/* |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to do this more easily like this:
| Code: |
//NEW EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
10HEADERAAAAAA
20AAAABBBBCCCC
20AAAABBBBCCCC
25AAAABBBBCCCC
25AAAABBBBCCCC
30TRAILERXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(1,2,CH,EQ,C'20')
OUTFIL IFTRAIL=(HD=YES,TRLID=(1,2,CH,EQ,C'30'),
TRLUPD=(10:COUNT=(TO=ZD,LENGTH=8)))
/*
|
For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|