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

Functionality of the below DB2 query


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

New User


Joined: 16 Nov 2005
Posts: 23

PostPosted: Fri Jan 09, 2009 4:46 pm
Reply with quote

Hi Friends,

I have the Db2 query as like below .Please let me know how it works what is the functionality of the 'Value' caluse here


Code:
  EXEC SQL DECLARE CUR_RPG_LNK CURSOR FOR                     
  SELECT   VALUE ( LNK.ACC_ID, RTR.ACC_ID)   AS ACC_ID       
          ,VALUE ( LNK.SEC_ID, RTR.SEC_ID)   AS SEC_ID       
          ,VALUE ( LNK.LNK_ID, RTR.LNK_ID)   AS LNK_ID       
          ,VALUE ( LNK.POS_NA, 0         )   AS POS_NA       
          ,VALUE ( RTR.SUM_POS_NA, 0     )   AS RESTRICTION   
  FROM                                                       
       ( SELECT RPG_LNK_CN                                   
               ,RPG_LNK_OI                                   
               ,ACC_ID                                       
               ,SEC_ID                                       
               ,LNK_ID                                       
               ,POS_NA                                       
         FROM PP_RPG_LNK_01                                   
         WHERE POS_NA         ^= 0                           
       ) LNK                                                 
       FULL OUTER JOIN                                       
       ( SELECT SEC_CRB_RPG_LNK_CN                           
               ,SEC_CRB_RPG_LNK_OI                           
               ,A.ACC_ID                                     
               ,A.SEC_ID                                     
                  ,B.LNK_ID                                 
                  ,SUM(A.POS_NA) AS SUM_POS_NA             
            FROM PP_RPG_SEC_RTR_01 A,                       
                 PP_RPG_LNK B                               
            WHERE A.RPG_SEC_RTR_CN    = 'RRN'               
              AND A.ACC_TYP_ID       IN ( 'PARTICIPANT'     
                                         ,'INTERNAL' )     
              AND A.RSN_ID NOT       IN ( 'CUST'           
                                         ,'MS'             
                                         ,'PRIOW'           
                                         ,'URECA'           
                                         ,'CRECA'           
                                         ,'RECAL'           
                                         ,'LENDA' )         
              AND A.SEC_CRB_RPG_LNK_CN = B.RPG_LNK_CN       
              AND A.SEC_CRB_RPG_LNK_OI = B.RPG_LNK_OI       
            GROUP BY SEC_CRB_RPG_LNK_CN                     
                    ,SEC_CRB_RPG_LNK_OI                     
                    ,A.ACC_ID                               
                    ,A.SEC_ID                               
                    ,A.ACC_ID                           
                    ,A.SEC_ID                           
                    ,B.LNK_ID                           
            HAVING SUM(A.POS_NA) ^= 0                   
          ) RTR                                         
          ON  LNK.RPG_LNK_CN = RTR.SEC_CRB_RPG_LNK_CN   
          AND LNK.RPG_LNK_OI = RTR.SEC_CRB_RPG_LNK_OI   
       ORDER BY ACC_ID ASC                               
               ,SEC_ID ASC                               
               ,LNK_ID ASC                               
       WITH UR                                           
       ;                                                 

Thanks in advance

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks...Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jan 09, 2009 6:37 pm
Reply with quote

Hello,

There's a link to the IBM Manuals on the top of this page. See what the DB2 manual says about the 'VALUE' clause.
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 RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top