ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Rpgsql

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

  • Rpgsql

    Can some help with this error:
    Exec Sql Fetch PLocsAvl Into :PLocRec;
    SQL0312: Position 53 Variable PLOCREC not defined or not usable for reason code 44
    If this really means the 53'rd variable IN PLOCREC is XMRLQA10: ZONED(7:0)

  • #2
    Hello,

    It has a problem with the definition of :PlocRec. It is refering to position 53 of the source line (where you have typed :PLocRec). This message (which happens a lot) is really frustrating because it doesn't tell you what the problem is, just that it can't use it. So, you almost have to use trial and error to solve the problem.

    I usually comment-out the SQL statements and try to compile without them -- often times that lets it get past the SQL preprocessor and into the RPG compiler where I'll get more useful messages.

    Comment


    • #3
      I will try this thanks and report results..

      Comment


      • #4
        All solved !!! Thanks Scott you were correct by commenting out SQL it was complaining about the Data Structure 1st 2 fields corrected those and the program complied. This was my first post here awesome. Again thanks Scott I know of your expertise I've been around this environment (IBM i) like you for awhile (years) (: glad to reconnect. Spot On...

        Comment


        • #5
          The reason code given in the full SQL0312 message is sometimes helpful (if you are on a version that gives the "reason code"). To see what the reason codes mean, compile with OPTION(*SECLVL). The full text of the SQL0312 message will be in the compile listing.

          Here's what it says for reason code 44: "44 -- A member of the host structure does not have an equivalent SQL data type."

          Maybe that information would have helped in this case, maybe not :-)

          Comment


          • MikeR07
            MikeR07 commented
            Editing a comment
            Thank you I've found the issue Scott also suggested a work around also thanks I will also try your recommendation next time. Awesome...Thanks...

          • MikeR07
            MikeR07 commented
            Editing a comment
            Dual comment I've deleted my first one
        Working...
        X