-2

This question pertains to the i5/OS (mainframe, as400, etc.) and its programs that are written in CL. How does one access the parameters within a given .PGM extension file (RPGLE) outside the application itself and without admin privs?

I have tried all available and related functions within the as400 app itself. None of them work. At least not with my user privs.

Overall, this mainframe app utilizes hundreds of libraries within libraries. Add thousands of files to that and you have a daunting task of accessing relevant data outside of the limited menu functions / programs(.PGM file extensions) for which you are granted access.

Frankly, the programs just suck. I really like using a SSH connection and qshell to execute SQL statements to bring up tables within the libraries. I can customize what tables are accessed and how the information is fetched.

This particular program acts as a basic query that accesses data from several tables, presents it in a new table that and allows for realtime filtering based on a limited amount of criteria.

I have tried the CAT command as below:

$ cat someprogam (and several variations with and without extensions, I forget)

But these just give me error codes

I have also tried executing SQL statements at the db2 prompt, but I get SQL STATE return codes (this isn't a .FILE extension so yes it makes sense that it wouldn't work the same way as selecting tables would).

I'd prefer accessing the data within qshell. Perhaps I am doing something wrong? Any help is greatly appreciated. Thank you

Singularity20XX
  • 321
  • 5
  • 20
  • I'm having a hard time grasping what you're asking. Too many concepts are incorrectly referenced, e.g., `libraries within libraries` which simply isn't possible, `access the parameters within a given .PGM extension file` which doesn't make sense since a .PGM isn't a file object, and others. The only apparent example is `$ cat someprogam`, but that makes almost no sense without more context since it's likely that the `someprogram` has a run-time environment that is outside of Qshell. Can you provide a set of specific actual examples with intended results? – user2338816 Aug 22 '14 at 01:38
  • 1
    I also have a hard time understanding what you're wanting to do. But a few points: IBM i (aka i5/OS or OS/400) is object based with built in security. Object based means you can't open a program object and read it like you could with a .EXE on a PC. OPEN and READ are not valid operations for a program object; EXECUTE is. The object level security means that it doesn't matter what interface you used, the same security applies. Lastly, while it is possible to write an RPG program that works from qshell; 99.99% of existing RPG programs won't from qshell. – Charles Aug 22 '14 at 12:42
  • Or maybe think of Qshell like running Linux in a virtual system inside Windows. It's not as separated, though, since calls can be made between Qshell and native environments and the two environments can access objects in the other. But explanations/answers need a couple specific examples in order to show how interactions are useful. – user2338816 Aug 23 '14 at 00:27
  • http://www-01.ibm.com/support/knowledgecenter/ssw_i5_54/rzahh/ifspath.htm – Singularity20XX Aug 23 '14 at 19:09
  • "Too many concepts are incorrectly referenced, e.g., libraries within libraries which simply isn't possible" I could have said: "there are object types within the 'main' system libraries (ie QSYS.LIB or SYSIBM.LIB) that are of object type .LIB (aka library)." My bad – Singularity20XX Aug 23 '14 at 19:29
  • Ah, there is sense in that. In the Qshell perspective, all .LIB objects are presented as subdirectories of the _/QSYS.LIB file system_. The /QSYS.LIB node is the root of that file system. Except for the root, no .LIB entries will contain any other .LIB entries. Qshell uses a naming convention called "IFS naming". IFS refers to 'Integrated File Systems' where all of the various file systems have names in a common format. Everything listed under /QSYS.LIB is from the "native" environment, though potentially accessible to Qshell. – user2338816 Aug 23 '14 at 23:19
  • See [**File systems**](http://www-01.ibm.com/support/knowledgecenter/ssw_i5_54/ifs/rzaaxfsknow.htm?lang=en) for more descriptions of how various 'file systems' are presented and accessed. – user2338816 Aug 25 '14 at 23:53

1 Answers1

1

Qshell is an alternative operating environment to what I'll call native for lack of a better name. Qshell is similar to AIX but not 100% identical. Qshell does not map the output of native programs to stdout, so you can't access the output of a native program via pipes.

If a native program writes to a display, the only reasonable way to redirect that output is to screen scrape it, which can be done by writing your own tn5250 emulator, intercepting the screen output and putting it where you want it to go, including stdout. This is not particularly simple if you're not comfortable with the 5250 communications protocol.

You have two vaguely practical options. 1) Write many SQL stored procedures which, coupled together, replicate the business logic embedded within the programs you want to execute. 2) Ask the midrange developers to refactor out the business logic into a service program (they should understand this) and write a stored procedure for you to use. This way, both the midrange programs and external consumers (you) can reuse the same business logic. And when (not if) that logic changes, it'll change in one place, and all consumers will see the new rules.

Buck Calabro
  • 7,558
  • 22
  • 25