Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Embedded RPG ILE SQL With a DDM File

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

  • Embedded RPG ILE SQL With a DDM File

    Don't worry about DRDA unless you are connecting to a non-iSeries system. The iSeries will automatically use that. Sign in to the system that runs the program, and register the remote system with WRKRDBDIRE. Enter the remote system name, change the type to *IP, and enter its IP address. Change the RPGLE program to uses the actual library and file name on the remote system. When you compile the RPGLE program, change the RDB from *LOCAL to the name of your remote system. That should fix it! Kevin

  • #2
    Embedded RPG ILE SQL With a DDM File

    Kevin, If a program contains embedded SQL statements as well as traditional file input specs, am I correct in assuming that only the SQL statements will be affected and that the F specs will still point to the local system? Thanks, Joe

    Comment


    • #3
      Embedded RPG ILE SQL With a DDM File

      A little more detail about my environment - we recently setup an lpar test environment. Our data warehouse files are never updated by production programs (other than those which build the data warehouse), so it seemed to make sense to create these as DDM files in our test environment. Unfortunately, there are a handful of programs that have embedded sql and that use data warehouse files and non data warehouse files. Using the remote RDB is the ideal solution for the warehouse files, however, we would want to use the local RDB for the non warehouse files. Is this possible? Thanks, Joe p.s. Hope this makes sense!

      Comment


      • #4
        Embedded RPG ILE SQL With a DDM File

        This is a complicated area that I am sure has more than one solution. In my experience, you can fairly easily compile the embedded SQL program to point at a remote Database, but I still issued a connect statement, and a disconnect statement. The SQL connection to a remote database did not affect the local database connection for native RPG code. It is my understanding that as long as you use the *DUW connection method it is possible to connect to multiple databases at the same time with SQL. I did not test that yet, but I am pretty confident it is do able. So, if blending SQL and RPG file I/O is OK - then that solution will definetly work. If you need an SQL only solution, then a little more testing is in order. Let me know if you have any other questions on this, and you can see the connect and disconnect statements I used below. Also note that I used the CRTSQLPKG command in addition to CRTSQLRPGI, and CRTPGM, when compiling the program. Not sure that I ALWAYS need to do that - but it did resolve some problems I was having.

        Comment


        • #5
          Embedded RPG ILE SQL With a DDM File

          Thanks for the reply! I will try your suggestions. "you can see the connect and disconnect statements I used below" - I did not see any samples - will you please post them again? Thanks, Joe

          Comment


          • #6
            Embedded RPG ILE SQL With a DDM File

            I know I pasted them into the code box - I wonder how I messed that up? C/EXEC SQL C+ CONNECT TO DMCWEB USER :UserID USING :PassWord C/END-EXEC C/EXEC SQL C+ DISCONNECT DMCWEB C/END-EXEC
            Code

            Comment


            • #7
              Embedded RPG ILE SQL With a DDM File

              O.K., so this applies to the entire SQL statement. In my siutation, there are both local and remote files in the same select statement. The good news is that there are only a handful of programs that have embedded sql, only a few of those have this scenario, and those that do use files small enough that I may just create the file in the test environment and call it a day! Thanks, JOe

              Comment


              • #8
                Embedded RPG ILE SQL With a DDM File

                What is the best way to access a DDM file in an embedded RPG ILE SQL module within a service program as if it were looking in a local database location? This RPG ILE SQL module was created using all the defaults of a local Iseries system/database (V5R2). However, now the application in which this module runs is on a reomte Iseries (V5R2). SQL error SQL7001 is received stating that the file being accessed is not a database file. (ie. a DDM file). Is there an easy way to change the DDM file or SQL ILE module or the Service program to point to the correct target file on the remote system without upsetting the application program logic? I have looked into the Distributed Database Programming guide. It seems to me that I need to recomile the module in the production environment and update the service program to take advantage of the "Implicit connection management for nondefault activation groups" feature of DRDA (I'm using a named activation group IBTSYS). Is it simply a matter of specifying the remote database(system) in the RDB parm of the CRTSQLRPGI command? And, will this perform all the SQL CONNECT logic without changing the source code to include these SQL statements?

                Comment


                • #9
                  Embedded RPG ILE SQL With a DDM File

                  A tip here... You can prompt the "CRTSQLPKG" and enter the sqlpkg information, eliminating the need to use CRTSQLPKG. :-) Of course, if you're working on another lpar, and you are creating your program in a test environment, you should put the pkg in a different lib on the lpar, since it may impact production on the lpar. Walker Powell

                  Comment

                  Working...
                  X