Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2004
    Posts
    48

    Talking Unanswered: Can I execute a DB2 ( OS390) Querry from REXX on OS390

    Can I execute a DB2 ( OS390) Querry from REXX on OS390 ?
    Any examples ?

    Thanks
    Mahendra

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

    Yes, you can ...

    For this, you will have to first enable Db2 for use with REXX ... The panel used is DSNTIJRX ...

    Once this is done , you can use REXX with DB2

    For sample programs, see scripts section in www.db2click.com

    HTH

    Sathyaram

    Originally posted by MahendraSetty
    Can I execute a DB2 ( OS390) Querry from REXX on OS390 ?
    Any examples ?

    Thanks
    Mahendra
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Apr 2004
    Posts
    48

    Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

    I am sorry, How do I enable the panel DSNTIJRX ?

    Thanks



    Originally posted by sathyaram_s
    Yes, you can ...

    For this, you will have to first enable Db2 for use with REXX ... The panel used is DSNTIJRX ...

    Once this is done , you can use REXX with DB2

    For sample programs, see scripts section in www.db2click.com

    HTH

    Sathyaram

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

    Sorry, it is the DB2 product installation panel ...

    Get in touch with your Database admin or system admin people

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Apr 2004
    Location
    Jeddah-Saudi Arabia
    Posts
    7

    Thumbs up

    Hi,
    1- when you wirte rexx program you know the first line in program must be :
    /* REXX */

    2- and when you need to connect to db2 fo os/390 use :
    RXSQL_DB2SUBSYS = db2ss where db2ss is db2 id

    3- and know you can write the query :
    QUERY = "SELECT * FROM SYSIBM.SYSTABLES "

    4- to run the query
    CALL RXSQL QUERY

    i hope these useful for you

  6. #6
    Join Date
    Apr 2004
    Posts
    48
    Thanks very much.

    I have
    RXSQL_DB2SUBSYS = "DB2T"
    CALL RXSQL QUERY

    This works except for I get

    SQLCODE = 12
    SQLSTATE = 00000

    for Query = "select * from sysibm.systables"

    I Tried changing the query but get the same results.

    Also how to see the results of the query ?

    Thanks

  7. #7
    Join Date
    Apr 2004
    Location
    Jeddah-Saudi Arabia
    Posts
    7
    Hi,

    first,
    i think 12 not listed in sqlcode

    2nd,
    to see the result :

    say RXSQL_0 ===> print number of rows from query

    if you select * from SYSIBM.SYSTABLES :
    say name.i creator.i where name, creator are columns name
    and i is indicator to record no.
    e.g. name.1 creator.1

  8. #8
    Join Date
    Apr 2004
    Posts
    48
    That SQLCODE of 12 is what I am getting after I run the query.

    Also tried say RXSQL_0 it results in displaying the string RXSQL_0 and doesnt displays any value.

    Do we need to bind/rebind any plan to run rex/db2 clist ?

    SQLCODE of +12 with SQLstate 01545 states that 'The unqualified column name ...... was interpreted as a correlated reference '

    But I am getting SQLCODE 12 with SQLSTATE 00000.

    Appreciate all the help.

    Thanks

  9. #9
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    I suspect the 12 to be a REXX return value ...

    Are you sure it is SQLCODE ?


    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  10. #10
    Join Date
    Apr 2004
    Posts
    48
    This is how my pgm looks on Mainframe :
    ***************************** Top of Data *********************
    /* REXX */
    RXSQL_DB2SUBSYS = 'DB2T'
    RXSQL_DB2PLAN = 'RXDB2'
    QUERY = 'SELECT * FROM SYSIBM.SYSTABLES'
    CALL RXSQL QUERY
    CALL SQLCA
    EXIT
    SQLCA:
    SAY "SQLCODE = " SQLCODE
    SAY "SQLSTATE = " SQLSTATE
    SAY "SQLMSG = " SQLERRM
    SAY "SQLSCA = " SQLSTMT
    SAY "RXSQL0 = " RXSQL_0
    SAY "RXSQL1 = " RXSQL_1
    RETURN
    **************************** Bottom of Data *******************

    AND THIS IS THE OUTPUT I GET ( CUT AND PASTE FROM THE SCREEN)


    SQLCODE = 12
    SQLSTAT E = 00000
    SQLMSG = SQLERRM
    SQLSCA = SQLSTMT
    RXSQL0 = RXSQL_0
    RXSQL1 = RXSQL_1


    Thanks

  11. #11
    Join Date
    Apr 2004
    Location
    Jeddah-Saudi Arabia
    Posts
    7
    use RXSQL_SQLCODE


    /* REXX */
    RXSQL_DB2SUBSYS = 'DB2T'
    RXSQL_DB2PLAN = 'RXDB2'
    QUERY = 'SELECT * FROM SYSIBM.SYSTABLES'
    CALL RXSQL QUERY
    CALL SQLCA
    EXIT
    SQLCA :
    SAY 'RXSQL_0: ' RXSQL_0
    SAY 'SQLCODE: ' RXSQL_SQLCODE
    SAY 'SQLERRM: ' RXSQL_SQLERRM

  12. #12
    Join Date
    Apr 2004
    Posts
    48

    Thumbs down

    Then I get this display on screen :


    RXSQL_0: RXSQL_0
    SQLCODE: RXSQL_SQLCODE
    SQLERRM: RXSQL_SQLERRM
    ***

    Thanks,

    Mahendra

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •