0

So, I've got myself a query to list our RPG programs:

SELECT OBJNAME
FROM
    (SELECT OBJNAME AS SCHEMA FROM TABLE (QSYS2.OBJECT_STATISTICS('*ALLSIMPLE', 'LIB')) S) AS SCHEMAS
    ,LATERAL (SELECT * FROM TABLE(QSYS2.OBJECT_STATISTICS(SCHEMAS.SCHEMA, 'PGM')) X) AS PROGRAMS
    LEFT JOIN QSYS2.PROCEDURES
        ON QSYS2.PROCEDURES.PROCNAME = PROGRAMS.OBJNAME
        AND QSYS2.PROCEDURES.PROCSCHEMA = PROGRAMS.OBJLONGSCHEMA
WHERE
    PROCNAME IS NULL
    AND SCHEMAS.SCHEMA = 'MYLIB'
;

Now, is there any way, given the name of an RPG program, to get the contents of it via SQL?

(Or, failing SQL, some other way to get the contents from within a C# application?)

0

Depends on your definition of "contents"...

At v7.3 and more at v7.4 IBM has added some services for program info, module info, ect... IBM i Services (SQL)

But if you're thinking "contents" as in a source list...

Then you'd have needed to have the program compiled with DBGVIEW(*LIST|*COPY|*ALL) and then use the debugger APIs to retrieve the source...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.