ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RPG What are my options?

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

  • RPG What are my options?

    We have several programs that were reading a file to get the data needed. We are switching this over to calling a webservice to get the data. I built a service program to get my data from the webservice(Thanks Scott Klement for HTTPAPI). I even put a procedure in the service program to dump the data to a temp table(same name as the file I was reading originally). There are not CL's calling all of the programs so I can't pre load the temp table with the data before opening the program. I just want to figure out where I can call the service program to load the file, and I would really like to not rewrite all of these programs. Thoughts?

    * Is there a way to hook into the cycle before files are opened? Only entry point I know of is *INZSR and I am not sure it is before files are opened or not.
    * I could usropn the files... a little more than I really wanted to do. Just lazy.

    I am hoping for something amazing!

  • #2


    Ok. *INZSR is not before files are opened.

    Comment


    • #3
      The fact that the file is open does not mean any records have been read - so why not simply call the subproc before doing the first read?

      Comment


      • #4
        So. The subproc actually creates the temp table and then loads it. So the first open of the file in the program will have opened the wrong file(existing production not my temp table).

        Comment


        • #5
          And UsrOpn is too much trouble? How many programs are involved?

          Comment


          • #6
            Oh, it is less than 10... I am just lazy... also I thought it would be cool to know if there was a way. I am not seeing anything in the documentation though.

            Comment


            • #7
              Originally posted by danlong005 View Post
              So. The subproc actually creates the temp table and then loads it. So the first open of the file in the program will have opened the wrong file(existing production not my temp table).
              Ah - OK - it was not clear to me that you had to create the file on-the-fly. Not sure why you can't do the create first and then the rest but ...

              USROPN is the only real answer then.

              Comment


              • #8
                Mostly this is laziness. I could do all of those things. I just don't want to have to rework all of the programs. USROPN it is then.

                Comment


                • #9
                  Personally, I would not use a temporary table. I'd change the routines to not try to read the data from a file, but rather to call the routines in the service program when they want it. This way, you can change the service program to get/store the data any way it wants. Maybe it's a web service now, but maybe it'll be something completedly different in the future? It won't matter to the programs using the data if they're getting in from the service program. It'll only be the service program that needs to be updated.

                  Comment


                  • #10
                    Yeah, that is 100% true. To be fair, my service program is built to be able to do this. I just added another routine that can be called that will create the temp tables and then dump the data to the table.

                    Comment

                    Working...
                    X