View previous topic :: View next topic
|
Author |
Message |
jacobdng
New User
Joined: 27 Aug 2006 Posts: 51 Location: Taiwan
|
|
|
|
I need to select records from a file for the purpose of auditing.
Code: |
001 PB01 00001
001 PB02 00002
001 PB02 00003
001 PB02 00004
001 PB02 00005
001 PB02 00006
002 PB03 00007
002 PB03 00008
002 PB03 00009
003 PB01 00010
003 PB01 00011
003 PB04 00012
003 PB02 00013
003 PB02 00014
003 PB02 00015
|
The fields of the records are defined as
byte 1-3 means branch number
byte 5-8 means product code
byte 10-14 means the quatity
The criteria of the selection has three conditions :
1: only certain <product codes> are required
2: there is a <threshold> defined for each product code.
a) if the count of the matched record is below or equal to the
threshold , all of them should be selected
b) otherwise, the matched record should only be selected every <N>
records, starting from the first one
The criterial of the selection should be like the following :
Code: |
<product code> <threshold> <selected frequency>
PB01 003 002
PB02 004 003
|
The expected output should be :
001 PB01 00001
001 PB02 00002
001 PB02 00005
003 PB01 00010
003 PB01 00011
003 PB02 00013
003 PB02 00014
003 PB02 00015
==============================
Anyone care to shed light on the question ? |
|
Back to top |
|
|
jacobdng
New User
Joined: 27 Aug 2006 Posts: 51 Location: Taiwan
|
|
|
|
By the way, we don't have z/OS DFSORT V1R5 PTF UK90013 (July, 2008).
The DFSORT explains itself as Z/OS DFSORT V1R5 ! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
jacobdng wrote: |
2: there is a <threshold> defined for each product code.
a) if the count of the matched record is below or equal to the
threshold , all of them should be selected
b) otherwise, the matched record should only be selected every <N>
records, starting from the first one
|
Your output does NOT match to the requirements. Pb02 occured 8 times in the input file. So the count is greater than the threshold. And your frequency is only 3 how did you have 5 records for pb02 in the output? |
|
Back to top |
|
|
jacobdng
New User
Joined: 27 Aug 2006 Posts: 51 Location: Taiwan
|
|
|
|
Dear Kolusu,
Your comment is correct.
I forgot to mention that the abovementioned requirements are restricted to the same <branch number>.
Therefore, there will be only 5 records of PB02 to be evaluated for branch 001, and , 3 records of PB02 to be tested for branch 003.
Thanks for your support.
Jacob |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
jacobdng,
There are still some issues unresolved. Your key PB02 for branch number 001 has 5 records and the threshold is 4 and the frequency is 3. So according to rule 2b, you should have 3 records of PB02 for branch 001. you only show 2 records. Is that a typo? |
|
Back to top |
|
|
jacobdng
New User
Joined: 27 Aug 2006 Posts: 51 Location: Taiwan
|
|
|
|
Kolosu,
The evaluation should start from the record "001 PB02 00003 ".
Then, the 2nd & 3rd in the frequency counting should be ignored.
The frequency counting should restart at "001 pb02 00004".
Then, the 2nd of frequency counting should be ignored.
Quote: |
001 PB02 00002 *1
001 PB02 00003 2
001 PB02 00004 3
001 PB02 00005 *1
001 PB02 00006 2
|
The above two records marked with "*" should be sampled out.
Or, do you think I mess up with the definition of frequency counting?
Jacob |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
jacobdng,
I am totally at a loss to the new rules. How do you decide where to begin the evaluation for each product code? And what is the criteria to skip records in between. Either way I think this is way too complicated to be done in sort |
|
Back to top |
|
|
|