How to get psds info in C ++

Using the ILE compiler in RPG, you can use PSDS to get information about the current user, job title, etc.

How do you get the same information in a C ++ program using ILE?

+5
source share
4 answers

There is no direct equivalent to PSDS RPG in C ++.

(For those who don’t know, in the RPG programming language, you can declare a data structure called the “Program Status Data Structure” and it will be automatically filled with a lot of information about the runtime, including the job identifier (for example, process identifier), name user, last error occurred and a lot of other information.)

If you can specify exactly what information you are looking for and what platform you need (or you need it to be cross-platform), we can probably help.

+4
source

QUSRJOBI api will provide you with the information you mentioned. The returned jobInfo structure is defined in the QUSRJOBI.h header (QSYSINC.H file) and will return the current username / username and job number plus more if called like this:

Qwc_JOBI0600_t jobInfo;
QUSRJOBI (& jobInfo, sizeof (Qwc_JOBI0600_t), "JOBI0600", "*", "", & errCode);

+4
source

To add to Scott's answer, the data structure in the RPG is similar to the C ++ structure — you could build a structure that contains this data, and you could probably populate some of them with various system API calls. Some things, however, are simply not available.

+3
source

You can get the program name and program library from the first parameter passed to the C or C ++ program. argv [0] is a string in the form "MYLIB / MYPGM".

If you ever need a module name, perhaps the easiest way would be to send yourself a message using QMHSNDPM and then receive it using QMHRCVPM with the format RCVM0300, which has “sender information”; Sender information has the name of the sending module and the name of the receiving module. You can also get the name and library of the program this way.

+2
source

Source: https://habr.com/ru/post/1204538/


All Articles