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

Need SQL for my requirements


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

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Mon Aug 18, 2008 7:15 pm
Reply with quote

Hi,

Table: E.EPRTMST
Field: I_Part

Select all part numbers in this table

Using the above part number,match with the

Table: S.SMXELEM
the first 10 digit in the FCST_MAST_KEY field is the part number

The volume data is separated by month. You will have to sum the volume for 12 months and divide the number by 12 to get average monthly demand. Monthly volumes are in fields LTF_RSLT_FCST_001, LTF_RSLT_FCST_002, LTF_RSLT_FCST_003, LTF_RSLT_FCST_004, LTF_RSLT_FCST_005, LTF_RSLT_FCST_006, LTF_RSLT_FCST_007, LTF_RSLT_FCST_008, LTF_RSLT_FCST_009, LTF_RSLT_FCST_010, LTF_RSLT_FCST_011, LTF_RSLT_FCST_012.


Using the same part number
Table: P.PPOITEM
Field: A_PART_UNIT_PRC
Part Number Field: I_PART
Model Year: I_MOD_YR

There are multiple part number in this table. Grab the price with model year M. If M does not exist, select current model year. If current model year does not exist, select future model year and if that does not exist, select past model year.


The output should be

Part number
Volume
Price


Need a SQl for the above requirements..
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 18, 2008 7:17 pm
Reply with quote

please, please do not double post, it will lower people willingness to help You

the same post in JCL will be deleted
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: Mon Aug 18, 2008 8:49 pm
Reply with quote

Hello,

What code do you have so far? Hopefully, you are not waiting for some solution to be published here. . .

Post what you have and what is not working as you want and someone may have a suggestion.
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Tue Aug 19, 2008 9:52 am
Reply with quote

Till now i don't have any code...waiting for some suggestion..
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 19, 2008 12:38 pm
Reply with quote

SUGGESTION: don't hold your breath.
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Tue Aug 19, 2008 2:47 pm
Reply with quote

For the requirements,
we have a UNLOAD JCL to retreive the data from DB2 table to flat file

1)Table: E.EPRTMST
Field: I_Part
Select all part numbers in this table

I got the part number by UNLOAD JCL using the query

SELECT I_PART FROM E.EPRTMST

2)Volume:
Table: S.SMXELEM

Since everything is part number driven, the first 10 digit in the FCST_MAST_KEY field is the part number.

The volume data is separated by month. You will have to sum the volume for 12 months and divide the number by 12 to get average monthly demand. Monthly volumes are in fields LTF_RSLT_FCST_001, LTF_RSLT_FCST_002, LTF_RSLT_FCST_003, LTF_RSLT_FCST_004, LTF_RSLT_FCST_005, LTF_RSLT_FCST_006, LTF_RSLT_FCST_007, LTF_RSLT_FCST_008, LTF_RSLT_FCST_009, LTF_RSLT_FCST_010, LTF_RSLT_FCST_011, LTF_RSLT_FCST_012.

I got the Volume by UNLOAD JCL using the query

SELECT SUBSTR(FCST_MAST_KEY ,1,10),
(LTF_RSLT_FCST_001 + LTF_RSLT_FCST_002 + LTF_RSLT_FCST_003 + LTF_RSLT_FCST_004 + LTF_RSLT_FCST_005 + LTF_RSLT_FCST_006 + LTF_RSLT_FCST_007 + LTF_RSLT_FCST_008 + LTF_RSLT_FCST_009 + LTF_RSLT_FCST_010 + LTF_RSLT_FCST_011 + LTF_RSLT_FCST_012 ) / 12
from S.SMXELEM

3) I don't know how to write a SQL for the below requiremets
Table: P.PPOITEM
Field: A_PART_UNIT_PRC -- D(11,4)
Part Number Field: I_PART -- C(10)
Model Year: I_MOD_YR -- C(4)

There are multiple part number in this table. Grab the price with model year M. If M does not exist, select current model year. If current model year does not exist, select future model year and if that does not exist, select past model year.

I need a SQL for this requirements to get the data from P.PPOITEM
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 OMVSKERN Access Requirements TSO/ISPF 0
This topic is locked: you cannot edit posts or make replies. Requirements in Accenture Mainframe Jobs 0
This topic is locked: you cannot edit posts or make replies. Requirements in Infy Mainframe Jobs 0
No new posts New job to run in production with som... JCL & VSAM 1
No new posts REXX requirements. CLIST & REXX 4
Search our Forums:

Back to Top