Using returned results from a stored procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jp140768
    New Member
    • Feb 2010
    • 2

    Using returned results from a stored procedure

    Hi,

    I am developing a Cobol/400 system, which will use information contained within a DB2/400 system, its possible that some of this information will also be used within a PC front end system. Because of this I thought I'd do all my I/O via stored procedures which can then be called from either system / platform and leave me only having to develop the I/O functionality once.

    Its all going well until I tried to set up a stored procedure to retrieve a list.

    My stored procedure is roughly as follows:
    Code:
    Create Procedure Chg/ObjectLst()                  
      Result Sets 1                                   
      Language SQL                                    
      Set Option DbgView = *SOURCE                    
    --Set Option UsrPrf = *OWNER                      
      Begin                                           
                                                      
      Declare c1 Cursor For                           
         Select a.objname
            From Chg/Objects a 
    
       Open C1;                   
       Set Result Sets Cursor C1; 
                                  
    End;
    The cursor is a bit more complex than listed but I have run interactivly and confirmed it returns what I need.

    The IBM redbooks give examples of how to use this in a VB program to retrieve results and it works, but as previously mentioned my main platform will be Cobol 400, does anyone know how to run the stored procedure within Cobol and use the returned cursor?

    Thanks,

    John.
Working...