ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem to change RPG to SQLRPG

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

  • Problem to change RPG to SQLRPG

    Good day,
    I have an RPG program where i would like to add SQLRPG code.
    But i have problems.
    I had SQLRPG lines code in the source and i try this :

    First attempt :
    I change the type by PDM and Compile the source by SI.
    Problem : SI always consider that the program type is RPG , so :
    - When i'm trying to add SQLRPG in SEU, i have the error "The Control-Level-Indicator entry is invalid."
    - Compilation generate errors on the SQL lines codes, and type return to RPG.

    Second Attempt :
    I try to compilate in command line with :
    CRTSQLRPG PGM(MXXXX/PXXX) SRCFILE(SRCXXX) GENLVL(21).
    But the compile fail because of the error 20 (normaly disabled by GENLVL(21))

    NB : My program compile and is working in standart RPG (without SQLRPG Line code) in SI with Gravity Level set to 21. So there are errors 20 , not blocking for executions.

    Anyone can help me ?

    Thank you all

  • #2
    Re: Problem to change RPG to SQLRPG

    Please give more details on what "SI" is? Sounds like this might be a change management thing. If it is then you have to make sure you "check out" the source as your desired sql source type.


    PHP Code:
    Member      Type        Text                                         
    EDI000008   RPGLE       EDI
    Returns Control parms for use in CL     
    EDI000009   SQLRPGLE    EDI
    Search for an internal Trading partner 
    You can only issue the compile command against the SQLRPGLE type;

    PHP Code:
     ===> CRTSQLRPGI OBJ(EDIDATA/EDI000009SRCFILE(EDIDATA/EDISRCSRCMBR(EDI000009
    OBJTYPE(*PGMREPLACE(*NO
    Show me what your source type is in PDM.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Problem to change RPG to SQLRPG

      You need to change the source member type to SQLRPGLE or if you are using a real old version of RPG then SQLRPG

      Comment


      • #4
        Re: Problem to change RPG to SQLRPG

        Hello,
        Sorry , I thought SI was a commun name. Si is that screen
        http://img1.uplood.fr/free/2fc9_err.jpg

        I try SQLRPGLE but it's the same thing...

        Here is the type of program in PDM
        http://img1.uplood.fr/free/32ha_err2.jpg

        Here is an example of the error in the spool file
        153040 C+ SELECT CDD01J
        * 5010 5010-**********.
        .......
        153080 C+ WHERE CCCO = '00512'
        * 5175 5175-**.. .. .. . .
        * 5008 5008-**********.

        * QRG5008 Severity: 30 Number: 2
        Message . . . . : The factor 1 field-name entry is not valid.
        * QRG5010 Severity: 30 Number: 1
        Message . . . . : Factor 1 entry not blank for specified

        Comment


        • #5
          Re: Problem to change RPG to SQLRPG

          Hi,

          first 2 questions:
          1. Did you start your SQL Statements with C/EXEC SQL and end them with C/END-EXEC?
          If Not enter these rows.

          2. Are you using a cursor (is your SELECT statement embedded in an DECLARE CURSOR statement or is it a SELECT ... Into - Statement?
          If neither it will not compile.

          BTW set the GENLVL only to 21 if REALLY necessary. Normally your programs should compile with GENLVL 10. GENLVL is already an error that must be removed.

          Birgitta
          Last edited by B.Hauser; July 30, 2008, 02:45 AM.

          Comment


          • #6
            Re: Problem to change RPG to SQLRPG

            Originally posted by B.Hauser View Post
            Hi,
            1. Did you start your SQL Statements with C/EXEC SQL and end them with C/END-EXEC?
            If Not enter these rows.
            Yes, Here is the code
            1530.30 C/EXEC SQL
            1530.40 C+ SELECT CDD01J
            1530.50 C+ INTO :V01
            1530.60 C+ FROM FX1 LEFT JOIN FX2 ON (FX1.CCDFF = FX2.CDFY) AND
            1530.70 C+ (FX1.CCDTPN = FX2.CDDTPN)
            1530.80 C+ WHERE CCCO = '00512'
            1530.90 C/END-EXEC
            Originally posted by B.Hauser View Post
            BTW set the GENLVL to 21 if really necessary. Normally your programs should compile with GENLVL 10. GENLVL is already an error that must be removed.
            Sorry but i don't understand clearly what you want to say.
            What I'm sure , that the errors 20 are not a problem for the execution. We already use a version of the program with the errors 20 and compiled with a gravity level to 21.

            Thank you

            Comment


            • #7
              Re: Problem to change RPG to SQLRPG

              Are you compiling with the CRTSQLRPG command ? It looks like the pre-compiler is not processing the source.

              Comment


              • #8
                Re: Problem to change RPG to SQLRPG

                Yes, it's my second attempt :
                Second Attempt :
                I try to compilate in command line with :
                CRTSQLRPG PGM(MXXXX/PXXX) SRCFILE(SRCXXX) GENLVL(21).
                But the compile fail because of the error 20 (normaly disabled by GENLVL(21))

                NB : My program compile and is working in standart RPG (without SQLRPG Line code) in SI with Gravity Level set to 21. So there are errors 20 , not blocking for executions.

                Comment


                • #9
                  Re: Problem to change RPG to SQLRPG

                  Please post the part with the LVL20 Error from your compile list.

                  The error you posted above is LVL30 and not LVL20.
                  Also I'm not quite sure if the SQL precompiler fails or the RPG compiler.

                  Birgitta

                  Comment


                  • #10
                    Re: Problem to change RPG to SQLRPG

                    Yes because the errors 30 match to the first situation and errors 20 match to second situation.

                    For second situation, I just want to know why the compiler don't take into account GENLVL(21)
                    Like I explain, the errors 20 need not to be corrected.

                    Comment


                    • #11
                      Re: Problem to change RPG to SQLRPG

                      So .... What is the level 20 error ?????

                      Comment


                      • #12
                        Re: Problem to change RPG to SQLRPG

                        * 7007 157190 CALCULATED LENGTH OF DEFN FIELD $K4102 IS NOT VALID.
                        * 7007 157210 CALCULATED LENGTH OF DEFN FIELD $K4211 IS NOT VALID.
                        * 7007 158110 CALCULATED LENGTH OF DEFN FIELD $4101 IS NOT VALID.

                        * QRG7007 Severity: 20 Number: 3
                        Message . . . . : The DEFN field length is invalid. Defaults to
                        length of base field.

                        Comment


                        • #13
                          Re: Problem to change RPG to SQLRPG

                          This has nothing to do with SQL. Do you still need help ? If so, we need to see the DEFN lines.

                          Comment

                          Working...
                          X