Page 1 of 1

Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 3:16 pm
by Deepika 1992
Hi all,
am new to this site. i have a requirement similar to this but i need to be done that sort based on count.
input file:
123456789BKVOLxxxx
1212312487289yyyyyy
jfasjkjkshk;sadfjjjsff
99999999sWOOTHshg
123456789BKVOLxxxx
1212312487289yyyyyy
13wrgbfghg;sadfjjjsff
99999999sWOOTHshg123456789BKVOLxxxx
1212312487289yyyyyy
jfasjkjkshk;sadfjjjsff
99999999sWOOTHshg
.
.
.


now output should be : If BKVOL is found more than 24 times we need to del records as below
The way to check is to do a find on ‘bkvol’, it should occur 24 times. If it is more than 24, then you will have to copy the files and delete everything after the 24th occurrence of ‘wooth’.

please help me i saves me a lot of time.

Thanks in Advance

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 3:42 pm
by enrico-sorichetti
it is considered bad manners to tailgate an existing topic with a new question
( especially if the topic is 8 year old )
topic split

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 4:04 pm
by NicC
It is not clear what you want. Do you want only a maximum of 24 references to BKVOL or do you want to stop all output after the 24th BKVOL? Can BKVOL occur more than once per inut record? What are the data set properties (LRECL RECFM)?

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 5:18 pm
by Deepika 1992
Hi,
Lrecl is 80..
I need to check if bkvol(header) is occurring more than 24 times, if it occurs more than 24 times we need to del all the recorda after the 24th occurence of Wooth (trailer )
Bkvol and wooth occurs only once per record..

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 6:34 pm
by NicC
And the RECFM is? The solution can be different for VB and FB RECFMs

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 6:36 pm
by Deepika 1992
Its fb file

Re: Stop copying the records from sort once i find a string

PostPosted: Mon Feb 19, 2018 8:31 pm
by NicC
Your GROUP BEGINs with a record containing BKVOL and ends with the record containing WOOOTH. When OUTFIL processing you check for the sequence number being less than 25. The explanation is in the replies that Frank wrote. What he did not mention is that you have to drop the sequence number in OUTFIL processing by building your output record from bytes 1-80 (unless, of course, you want the sequence numbers).

Re: Stop copying the records from sort once i find a string

PostPosted: Tue Feb 20, 2018 12:06 pm
by Deepika 1992
Thanks Nic..
:( but could you please elaborate your explanation with code.

Re: Stop copying the records from sort once i find a string

PostPosted: Tue Feb 20, 2018 2:05 pm
by NicC
No, you will not learn if you are given code. The topic that you had tail-gated originally has most of the code that you want - you just have to adjust it for your circumstances. The final bit, dropping the sequence number during OUTFIL process, is done by using BUILD, examples of which abound in the forum.