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

report based upon input file


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Wed Oct 29, 2008 11:15 pm
Reply with quote

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 12:00 am
Reply with quote

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 12:03 am
Reply with quote

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

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Oct 30, 2008 12:49 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Oct 30, 2008 12:54 am
Reply with quote

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

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Oct 30, 2008 1:17 am
Reply with quote

Hi,

Can you please provide me the utility info?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 1:57 am
Reply with quote

Hello,

You can use BMCADM utility or IKJEFT01 to do that, here is a similar thread:

ibmmainframes.com/viewtopic.php?t=21198&highlight=ikjeft01
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 2:00 am
Reply with quote

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
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top