IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sampling records from a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Tue Oct 14, 2008 2:40 pm
Reply with quote

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
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Tue Oct 14, 2008 2:46 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 14, 2008 9:28 pm
Reply with quote

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
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Wed Oct 15, 2008 7:54 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 16, 2008 5:27 am
Reply with quote

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
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Thu Oct 16, 2008 8:19 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 16, 2008 9:51 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top