View previous topic :: View next topic
|
Author |
Message |
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi,
I have a requirement like this:
I/P file:
Code: |
STORE1 XXXX
STORE1 XXXX
STORE1 XXXX
STORE1 XXXX
STORE2 XXXX
STORE2 XXXX
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE5 XXXX
STORE5 XXXX
STORE6 XXXX
STORE6 XXXX
STORE7 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
|
O/p files:
File1:
Code: |
STORE1 XXXX
STORE1 XXXX
STORE1 XXXX
STORE1 XXXX
STORE2 XXXX
STORE2 XXXX
|
File2:
Code: |
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
STORE3 XXXX
|
File3:
Code: |
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
STORE4 XXXX
|
File4:
Code: |
STORE5 XXXX
STORE5 XXXX
STORE6 XXXX
STORE6 XXXX
STORE7 XXXX
|
File5:
Code: |
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
STORE8 XXXX
|
Rules for getting the O/P are:
We need to check the store(s) for which number of records is less than/equal to 6 then those records should go in one file. if sum of records for stores( say two stores in number) is exceeding than 6 then first store's records will go in one file and the records of 2nd store will be considered for number of records with next store. Maximum number of o/p files can be 10. suppose 9 files are already created then the 10th file will contain all the rest of records.
Can anybody please help me in this? I hope the requirement is clear.
Thanks |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
GaganGarg,
Are you Ok with creating empty files incase you have less number of records?
Is there a limit to max. number of records in a singlefile for given Store Number? For Example, if you have 1000 records for STORE8, would you have them all in your FILE5? If not, how would you like to split them?
Thanks, |
|
Back to top |
|
|
GaganGarg
Active User
Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi sqlcode1,
Thanks for the reply.
Quote: |
Are you Ok with creating empty files incase you have less number of records?
|
Yes, that will be absolutely fine. not a problem at all.
Quote: |
Is there a limit to max. number of records in a singlefile for given Store Number? For Example, if you have 1000 records for STORE8, would you have them all in your FILE5? If not, how would you like to split them?
|
There is no limit on the number of records for a given store in a file. in the case you mentioned here, we can have all 1000 records for store8 in FILE5.
thanks |
|
Back to top |
|
|
|