Unconfigured Ad Widget

Collapse

SQL Functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • K.Forsythe

    SQL Functions

    Bill, Is your routine a sub procedure or a module? I usualy do this sort of thing with a subprocedure. The sample syntax I use is in the code example.
    Code
  • bibarnes@yahoo.com
    Junior Member
    • Oct 2024
    • 312

    #2
    SQL Functions

    It is a sub_procedure. I got to the part in your book about functions and realized that we already had a suib-proc that will take any form of character date and translate it to a real date. So I followed the examples on page 189. The odd thing is the message. I can see that the *SRVPGM exists in BBARNES. I am moderately confused. Bill

    Comment

    • K.Forsythe

      #3
      SQL Functions

      Send me the create statement and the RPG code at kevin.forsythe@dmcconulting.com and I will take a look at it.

      Comment

      • dwhitehouse@madico.com
        Junior Member
        • Oct 2024
        • 8

        #4
        SQL Functions

        I'm doing the same thing and getting the same results. Has a solution to the problem be determined?

        Comment

        • bibarnes@yahoo.com
          Junior Member
          • Oct 2024
          • 312

          #5
          SQL Functions

          This is my first attempt at a FUNCTION and have failed. I have a program that will take a character date of any type and return a true date field back. I created a *SVRPGM with the name SQLFUNCS in library BBARNES I then used the following to create the function create function BBARNES/CVTDATE (in varchar(10)) returns date external name 'BBARNES/SQLFUNCS(CVTDATE)' language rpgle parameter style general I got back the following. CREATE FUNCTION statement complete. I then tried the following statement in STRSQL SELECT * FROM GASP0030 WHERE TXDATE = CVTDATE('121504') and got the following message. SQLFUNCS in BBARNES type *SRVPGM not found. then I tried this SELECT CVTDATE('120404') FROM GASP0030 FETCH FIRST ROW ONLY And got this in return. SQLFUNCS in BBARNES type *SRVPGM not found. The following is a partial listing from library BBARNES SQLFUNCS *SRVPGM RPGLE SQLFUNCS *MODULE RPGLE Verify date entered and pass back dat What's wrong? TIA Bill Barnes

          Comment

          • K.Forsythe

            #6
            SQL Functions

            It was a matter of getting the names all straightened out. If you want to email me directly at kevin.forsythe@dmcconsulting.com, I will try to help you out. Or you can post here and I will check back. Take care, Kevin

            Comment

            Working...
            X