全部博文(287)
分类: 系统运维
2010-06-04 16:53:56
Here's the prototype that is used in the CGILIB (similar to CGIDEV2) D Qp0zGetEnv PR * ExtProc('Qp0zGetEnv') D envvar * VALUE OPTIONS(*STRING) D nCCSID 10I 0 The 2nd parm, CCSID, can be set to 0 for the current CCSID. Here's the wrapper I built for CGILIB so that you don't have to deal with the C string return values: P GetEnvVar B Export D GetEnvVar PI 65535A VARYING D pInEnv * VALUE OPTIONS(*STRING) D pEnv S * Inz D nCCSID S 10I 0 Inz(0) C eval pEnv = Qp0zGetEnv(pInEnv : nCCSID) C C if pEnv = *NULL C return '' C endif C return %str(pEnv) P GetEnvVar E CGILIB is available in the RPG xTools at Thanks to Bob Cozzi