Problem solve Get help with specific problems with your technologies, process and projects.

Processing database records

If I have a database, how can I select the records I want to process based on the value in a given field in the table? I have an RPG program that processes all records in the table correctly, but I want to limit the records processed by the company field.

You have several options.

1. Use OPNQRYF. You can replace the primary data file you process for input with an OPNQRYF select in a CL program that calls your RPG program. OPNQRYF can use a dynamic select statement to select just the records you want. Using an OVRDBF with a shared access path on the primary input file, your existing RPG program will pick up only the selected records.. very nice.. least amount of change.

2. Use embedded SQL in RPG. Works, but requires changing the RPG program to embedded SQL statements. OK, but embedded SQL in RPG is a lot more work than Java and JDBC.

3. Use Java and JDBC stored procedure. Building on option 1, you can define the CL program with the OPNQRYF as a Stored procedure and access it as a component using JDBC driver from the Java toolkit (5722-JC1 and jt400.jar file). Then you can web-enable this as a service anyway you want: Web browser, Web service, XML etc.


Check out these Best Web Links on Web development.

Ask the Experts yourself: Our Web development gurus are waiting to answer your questions.

Ask your Web development & WebSphere questions -- or help out your peers by answering them--in our .fMFNafNPDOX.2@.ee84637!viewtype=&skip=&expand=>WebSphere & Web Development Forum.

Dig Deeper on Web Development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.