As Tom write, PGMA need to access PGMB result set values .
This is usually done by PGMB passing the result to PGMA by parameter or store the result in an object (workfile, data queue…) that PGMA can access.
Using parameters you have 2 choices : passing parameter by value or by reference.
In your example, passing by value, you pass the DS ResultSet (containing the values).
By reference you pass the address of the DS ResultSet, then in PGMA you set the DS address to the address received by parameter (you have lots of examples for this in this site)
Depending on what you want to achieve with PGMB, using DTAQ is a great for passing values between programs , because PGMA knows when “end of data” is reached (instead of having to read all DS dataset), can make subsequent requests to PGMB to retrieve more data …
From the Returning result sets from stored procedures topic (V5R4): The interfaces that can work with stored procedure result sets include JDBC, CLI, and ODBC.</li>
If you want PGMA to be RPG, then you will want to use the SQL CLI APIs to get it done. If you have, say, a Visual Basic ODBC function that accesses your stored proc, then you pretty much convert that to RPG. The ODBC APIs translate almost directly to SQL CLI.