View previous topic :: View next topic |
Author |
Message |
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Tue Sep 27, 2016 11:13 am Post subject: Remove Multiple Headers and Trailers , Counts No of records |
|
|
Hi,
I have below requirement.
I have one VB dataset say XXX.XXX3.XXX03.INFILE with following property. Code: |
Organization . . . : PS
Record format . . . : VB
Record length . . . : 2004
Block size . . . . : 27998
|
It contains multiple header and trailers. For the information first 4 digit with '0000' signifies the header record. and first 4 digit with '9999' signifies trailer record. Column 5-11 in the Trailer record shows no of '0100' record marked as bold. Column 12-19 in the trailer record shows of record counts . Code: |
------------------------------------------------------------------
BROWSE XXX.XXX3.XXX03.INFILE Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
********************************* Top of Data **********************************
0000 20070228SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070228
9999000000000000002
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
9999000000000000004
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
0110 CFLFZC TDQV ZHASPNUE 10450AREQSGMFGSH
0120Afrnlfak S Zumaton
0170Wqvfbh ls Ifzhasun S Ntpujta
9999000000100000006
0000 20070228SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070228
9999000000000000002
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
9999000000100000003
|
-------------------------------------------------------
I just want to keep only one header record and trailer record ( gives the exact count of '0100' record and total no of record counts including just one header and trailer after eliminating the duplicate header and trailers). So My output should look like:
XXX.XXX3.XXX03.INFILE Code: |
--------------------------------------------------------
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
0110 CFLFZC TDQV ZHASPNUE 10450AREQSGMFGSH
0120Afrnlfak S Zumaton
0170Wqvfbh ls Ifzhasun S Ntpujta
STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
99990000002000000008
-----------------------------------------------------------------
|
Please note that the row number of '0100' record is not fixed , so as for header and trailers.
Is that possible by SYNC SORT? Can you please help.
Many thanks ! |
|
Back to top |
|
|
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Tue Sep 27, 2016 11:15 am Post subject: |
|
|
A typo error. Sorry,The Output Dataset name is : XXX.XXX3.XXX03.OUTFILE |
|
Back to top |
|
|
Magesh_J Intermediate
Joined: 21 Jun 2014 Posts: 259 Topics: 54
|
Posted: Tue Sep 27, 2016 11:53 am Post subject: |
|
|
pramitdas,
try to make use of code tags
Code: |
0000 20070228SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070228
9999000000000000002
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
9999000000000000004
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
0110 CFLFZC TDQV ZHASPNUE 10450AREQSGMFGSH
0120Afrnlfak S Zumaton
0170Wqvfbh ls Ifzhasun S Ntpujta
9999000000100000006
0000 20070228SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070228
9999000000000000002
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
9999000000100000003
|
I see your input and output are not matching.
How do you get this in your ouput
I see there is a count of 8 in your output, how do you derive it?
Code: |
99990000002000000008
|
What happen to the following record from your input
Code: |
0000 20070108SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070108
01009902668RRIF 200404222006010120061231Afrnlkdr R Rdvd
9999000000100000003
|
Thanks
Magesh |
|
Back to top |
|
|
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Tue Sep 27, 2016 2:03 pm Post subject: |
|
|
Total no of record in my output file is 8 including header and trailer.. That is how I want to derive. Only need to take all 0100 records in the output file including any header and the trailer as I have mentioned... Thanks. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Tue Sep 27, 2016 10:20 pm Post subject: |
|
|
pramitdas wrote: | Total no of record in my output file is 8 including header and trailer.. That is how I want to derive. Only need to take all 0100 records in the output file including any header and the trailer as I have mentioned... Thanks. |
Pramitdas,
Your input and output counts does not match. If you have eliminated the '0000' or '9999' records except the first and last record, you will ONLY have 7 records and not 8 records as you claim.
Apart from the hearer ('0000') and trailer record ('9999') you only have
Code: |
0000 20070228SWEALTH MANAGEMENTGICCLIENT STATEMENT STMT20070228
01009902668RRIF 200404222006010120061231AFRNLKDR R RDVD
0110 CFLFZC TDQV ZHASPNUE 10450AREQSGMFGSH
0120AFRNLFAK S ZUMATON
0170WQVFBH LS IFZHASUN S NTPUJTA
01009902668RRIF 200404222006010120061231AFRNLKDR R RDVD |
i.e a total of 5 recors. and when you add the header and trailer record the count is 7. And there are 2 groups ending with 0100
Either way since you are using syncsort here is the possible solution(untested)
1. Expand the record by 16 bytes after the RDW to accommodate the temp fields
2. Use When=group with end for 0100 to tag the group number and id the records
3. Use OUTFIL OMIT to remove the 0000 records with count > 1 and all 9999 records
4. Use trailer1 to build the group count and record count and remove the temp fields while building the records on OUTFIL _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Tue Sep 27, 2016 10:50 pm Post subject: |
|
|
Hi kolusu,
Thanks for your advise.
Can you please help to provide the code. Actually I am not too familiar with DFSORT and hence I need your help. BTW how to expand the record by 16 bytes? Many thanks for your help.
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Tue Sep 27, 2016 11:27 pm Post subject: |
|
|
pramitdas wrote: | Hi kolusu,
Thanks for your advise.
Can you please help to provide the code. Actually I am not too familiar with DFSORT and hence I need your help. BTW how to expand the record by 16 bytes? Many thanks for your help.
Thanks |
Pramitdas,
You are using syncsort which is a competitive product of DFSORT. I'm a DFSORT developer and I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Tue Sep 27, 2016 11:53 pm Post subject: |
|
|
Hi kolusu,
Thanks for the reply.. The main motive is to achieve it thru sort utility. If this can be done by DFSORT or ICETOOL, can you please help me to provide the code.
Many thanks for your help. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Wed Sep 28, 2016 12:00 am Post subject: |
|
|
pramitdas wrote: | Hi kolusu,
Thanks for the reply.. The main motive is to achieve it thru sort utility. If this can be done by DFSORT or ICETOOL, can you please help me to provide the code.
Many thanks for your help. |
Praitdas,
You do realize that DFSORT and syncsort are two different sort products?? ICETOOL is a part of DFSORT. It wouldn't be ethical to seek a solution from competitive developer. Look up the manual and try to implement the logic mentioned above. _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
pramitdas Beginner
Joined: 26 Aug 2016 Posts: 12 Topics: 3
|
Posted: Wed Sep 28, 2016 12:48 am Post subject: |
|
|
Hi kolusu,
I am not aware of how to expand the record as you have mentioned above. And frankly speaking I am not too aware of this complex sort card. That is why I have seeked help from this forum.
In tough delivery deadline it seems impossible to go thru every doc and then write the sort card.
So as agreed with client, if I cannot be able to do it by Sort, I have to think some other way to achieve that. As I cannot use COBOL as agreed, I will have a try in SAS if this can be implemented.
Anyway thanks a lot for your advise and time. |
|
Back to top |
|
|
Magesh_J Intermediate
Joined: 21 Jun 2014 Posts: 259 Topics: 54
|
Posted: Fri Sep 30, 2016 4:29 pm Post subject: |
|
|
pramitdas,
I can help you with the sort code. Provided i need to understand the requirement right.
your input has two headers having detail records,
but your output has only one header.
Which header you want to see in output ? I could see both the headers are same, still i need confirmation before i provide you solution.
Thanks
Magesh |
|
Back to top |
|
|
|
|