You can use RACF callable services to programatically get and set RACF information, for example to list and display digital certificates, and objects.
There is a C interface to these services. These interfaces are easy to use as long as you are careful with your data types, and get your compile JCL right. You can use 31 and 64 mode programs with these services.
JCL to compile a 64 bit program
Below is the JCL I use for compile programs which use gskit and RACF callable services.
//COLINC5 JOB 1,MSGCLASS=H,COND=(4,LE)
//S1 JCLLIB ORDER=CBC.SCCNPRC
// SET LOADLIB=COLIN.LOAD
//*OMPILE EXEC PROC=EDCCB,
//COMPILE EXEC PROC=EDCQCB,
// LIBPRFX=CEE,
// CPARM='OPTFILE(DD:SYSOPTF),LSEARCH(/usr/include/)',
// BPARM='SIZE=(900K,124K),RENT,LIST,RMODE=ANY,AMODE=64,AC=1'
//COMPILE.SYSOPTF DD *
...
/*
//COMPILE.SYSIN DD DISP=SHR,DSN=COLIN.C.SOURCE(...)
//BIND.SYSLMOD DD DISP=SHR,DSN=COLIN.LOAD
//BIND.OBJLIB DD DISP=SHR,DSN=COLIN.OBJLIB
//BIND.GSK DD DISP=SHR,DSN=SYS1.SIEALNKE
//BIND.CSS DD DISP=SHR,DSN=SYS1.CSSLIB
//BIND.SYSIN DD *
INCLUDE GSK(GSKCMS64)
INCLUDE GSK(GSKSSL64)
INCLUDE CSS(IRRSDL64)
NAME AMSCHE64(R)
Note the 64 bit specific items
- PROC=EDCQCB
- RMODE=ANY,AMODE=64
- The includes of the GSK*64 stubs
- The include of the 64 bit RACF callable stub IRRSDL64
The 31 bit equilants are
- PROC=EDCCB
- RMODE=ANY,AMODE=31
- The includes of the GSK*31 stubs: GSKCMS31,GSKSSL
- The include of the 31 bit RACF callable stub IRRSDL00
The source is specified via //COMPILE.SYSIN
SYSOPTF
For both 64 bit and 31 bit programs
//COMPILE.SYSOPTF DD *
LIST,SOURCE
aggregate(offsethex) xref
SEARCH(//'COLIN.C.H',//'SYS1.SIEAHDR.H')
TEST
RENT LO
OE
INFO(PAR,USE)
NOMARGINS EXPMAC SHOWINC XREF
LANGLVL(EXTENDED) sscom dll
DEFINE(_ALL_SOURCE)
DEBUG
Skeleton of C program
#pragma linkage(IRRSFA64 ,OS)
The pragma is needed for the bind operation. It says the module is a z/OS callable service type of module (and not a C program).
#ifdef _LP64
#include <irrpcomy.h>
#else
#include <irrpcomx.h>
#endif
You need a different copy book for the RACF constants depending on the 31/64 bit mode.
IRRPCOMY contains definitions for 64 bit programs, IRRCOMX is for 31 bit programs.
char * workarea ;
workarea = (char *) malloc(1024);
int ALET1= 0;
int parmAlet = 0;
int numParms =11;
short function_code = 1;
int ALET2= 0;
int ALET3= 0;
int SAF_RC = 0;
int RACF_RC = 0;
int RACF_RS = 0;
The variables have to be “int”, not “long”, as they are 4 bytes long. With 64 bit program, a long is 8 bytes long. See here for a table about the types and lengths in 31 bit and 64 bit programs. A short is 2 bytes long.
Set up the parameter list
The macro IRRPCOM? provides header files for some definitions.
For example
char * pSTC = "AZFTOTP1";
char area[1000];
struct fact_getf_plist pl;
pl.fact_getf_options = 0;
pl.fact_getf_factor_length = 8;
pl.fact_getf_factor_a = pSTC;
pl.irrpcomy_dummy_34 = 0;
pl.fact_getf_af_length = sizeof(area);
pl.fact_getf_af_a = & area;
where pl is used below.
Call the function
IRRSFA64( workarea, // WORKAREA
&ALET1 , // ALET
&SAF_RC, // SAF RC
&ALET2, // ALET
&RACF_RC,// RACF RC
&ALET3 , // ALET
&RACF_RS,// RACF Reason
&numParms,
&parmAlet, //
&function_code,
&pl );
The irrpcomx has a structure definition for the parameter list, but I could not get it to work in these programs, as it passes the address of the data, instead of the data itself.
Came across your post on the WordPress feed and just wanted to drop by and say hello ! Your content caught my attention, and I’m eager to explore more of your engaging posts. Although I couldn’t locate the follow button (haha!) , I’ll definitely bookmark your blog ! Rest assured, I’ll Spin8: keep an eye out for your future posts.
Wishing you continued inspiration and success in your blogging journey!
Warm regards,
Thanks – TheDogGod pomeranianpuppies.uk
LikeLike