View previous topic :: View next topic
|
Author |
Message |
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
Guys,
Need some information for my project. Bit urgent !!!!!!!
Craker Table (DB2) contains the following fields and values:
Code: |
cracker_code Stock shop_code
--------------- --------- ------------
C001 100 SH001
C002 200 SH002
C003 300 SH001
C001 400 SH002
C002 500 SH003 |
Note : cracker_code and shop_code are COMPOSITE key.
I am getting one input file. Input file can have any number of cracker_codes. Just for example, here I have given 2 values in the input file, which contains the following field and values:
Code: |
cracker_input_file
--------------------
C001
C002 |
Requirement:
Need to generate a report for the given set of craker_code (refer cracker_input_file). Report should contain the stock at each shop contains. Output report file should be a PS file.
Output report PS file should have the following values:
Code: |
cracker_code Stock shop_code
--------------- --------- ------------
C001 100 SH001
C001 400 SH002
C002 200 SH002
C002 500 SH003 |
Any better solution for this ?? It would be really great if you provide the code also |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
There can be many approches to this, one among those canbe:
1. "Unload" the DB2 table to QSAM (PS), while unloading you can ORDER BY "cracker_code".
2. Compare the other input, file with cracker_codes, with this unload file. before compairing, SORT your input file also on cracker_code.
If the DB2 Table is smaller one then you can directly "search" the table, but i usually prefer the above method.
Please notice your post is been edited to add the code tags, leran to use BBcode - they make the post rather readable. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Quote: |
It would be really great if you provide the code also |
This is something over expectations.
BTW, when you say
Quote: |
Any better solution for this ?? |
were you already using some other way to accomplish it ? And it didn't work out the way you needed...? |
|
Back to top |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
Hi Anuj,
Thanks for your reply.
Can you please tell me how to download the DB2 table within a program?
Please provide more info.
I was planning to do by using cursor for each and every input by using host variable. But it requires, close and open cursor many times. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Can you please tell me how to download the DB2 table within a program? |
Typically this is done with a db2 utility and not within some application program. |
|
Back to top |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
Hi,
Can you please provide me the utility info? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
RamsIBM wrote: |
I was planning to do by using cursor for each and every input by using host variable. But it requires, close and open cursor many times. |
I believe, for the type of comparison you are looking for this approach would slow down the whole process significantly. |
|
Back to top |
|
|
|