ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CONST definition -Urgent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CONST definition -Urgent

    Guys,

    What does this statement mean?

    Code:
    D  SQLROUTE       C                   CONST('QSYS/QSQROUTE')               SQL
    Please help.

    Theres a call to SQLROUTE later in the program. How exactly does this function.

    Code:
    C                   CALL      SQLROUTE               
             C                   PARM                    SQLCA

  • #2
    Re: CONST definition -Urgent

    First you do not have to care about the values and calls the SQL precompiler includes into your files.
    The SQL precompiler replaces your embedded SQL commands with API calls (such as SQLROUTE).

    In either way:
    SQLROUTE is a constant value that includes the schema and program name to be called when executing the CALL OpCode.
    In this way the library where the program is located is hard coded and the library list is not searched.

    Birgitta

    Comment


    • #3
      Re: CONST definition -Urgent

      Thanks Birgitta. Also how does one go about checking values for a sql declaration within sqlrpgle in a debug mode.
      For instance, i have a declaration as below:

      [CODE]
      C*exec SQL
      C* DECLARE SVCSCURSOR2 CURSOR FOR SELECT
      C* a.compny, a.customer#,
      C* a.svcode, a.svqnty, a.dflvl2, a.aulvl2, AND SO ON
      [\CODE]

      This is how i get to see this code in debug, how can i figure out the values being fetched into a.svcode?

      Debugger also gives me something like this,

      C EVAL SQL_00067 = D#PERBEGIN SQL
      C EVAL SQL_00068 = D#PEREND SQL
      C EVAL SQL_00069 = D#VACLOOKBACK SQL
      C EVAL SQL_00070 = D#PERBEGIN SQL

      These statements are not there in my code, then from where is it popping,is this the values being fetched in the cursor? Appreciate the help

      Comment


      • #4
        Re: CONST definition -Urgent

        eval [the into hostvariable]
        Regards

        Kit
        http://www.ecofitonline.com
        DeskfIT - ChangefIT - XrefIT
        ___________________________________
        There are only 3 kinds of people -
        Those that can count and those that can't.

        Comment


        • #5
          Re: CONST definition -Urgent

          The DELCLARE statement only declares a cursor, but does nothing else.
          If you want to process your data, you have to OPEN the cursor (OPEN SQL Statement), loop through the result set using the FETCH SQL statement and return the data into Host Variables or Host Data Structures (voilĂ  your data!) and finally close the cursor.

          Birgitta

          Comment


          • #6
            Re: CONST definition -Urgent

            Hi kitvb1,

            Code:
            fetch next from svcsCursor1 into :ServicesDS
            For the above on performing eval ServicesDS i could see the variable values, but there has been no chain or any such file read performed, then how can i figure out from where is it populating these values?

            Please guide.Thanks

            Comment


            • #7
              Re: CONST definition -Urgent

              Hi Birgitta,

              Just as you have mentioned, i very well could see those populated values in Host DS but i have no clue from where these have got populated

              Any idea?

              Comment


              • #8
                Re: CONST definition -Urgent

                What's your problem?
                You get the data you want!

                Birgitta

                Comment


                • #9
                  Re: CONST definition -Urgent

                  The FETCH in SQL is the same as the chain/read/etc in RPG.
                  Regards

                  Kit
                  http://www.ecofitonline.com
                  DeskfIT - ChangefIT - XrefIT
                  ___________________________________
                  There are only 3 kinds of people -
                  Those that can count and those that can't.

                  Comment

                  Working...
                  X