Skip to content

Instantly share code, notes, and snippets.

@covener
Created January 9, 2018 20:28
Show Gist options
  • Save covener/bdfaa4a77a1ac3b19319ffa08ce124c4 to your computer and use it in GitHub Desktop.
Save covener/bdfaa4a77a1ac3b19319ffa08ce124c4 to your computer and use it in GitHub Desktop.
jobname stuff
static void getnamas(server_rec *main_server, apr_pool_t * pconf)
{
char buf[256], buf1[10], buf2[10], buf3[10], buf4[10];
struct mypsa
{
unsigned char filler1[540];
void *__ptr32 tcb;
unsigned char filler2[4];
void *__ptr32 ascb;
};
struct myascb
{
unsigned char fill1[36];
char asid[2];
char fill2[18];
void *__ptr32 cscb;
char fill3[112];
void *__ptr32 jbni;
void *__ptr32 jbns;
char fill4[156];
void *__ptr32 assb;
};
struct mycscb
{
unsigned char filler[8];
char chkey[8];
};
struct mytcb
{
unsigned char fill1[180];
void *__ptr32 jscb;
};
struct myjscb
{
unsigned char fill1[316];
void *__ptr32 ssib;
};
struct myassb
{
unsigned char fill1[168];
void *__ptr32 jsab;
};
struct myjsab
{
unsigned char fill1[20];
char jbid[8];
};
struct myssib
{
char seye[4];
unsigned char fill1[8];
char jbid[8];
};
struct mypsa *__ptr32 ptr;
struct myascb *__ptr32 ptra;
struct mycscb *__ptr32 ptrb;
struct mytcb *__ptr32 ptrc;
struct myjscb *__ptr32 ptrd;
struct myssib *__ptr32 ptre;
struct myassb *__ptr32 ptrf;
struct myjsab *__ptr32 ptrg;
int *p = 0;
ptr = (void *) 0; /* load hard address of psa pointer */
ptra = (void *) ptr->ascb; /* load the address of the ASCB */
ptrb = (void *) ptra->cscb; /* load the address of the CSCB */
asid[0] = ptra->asid[0];
asid[1] = ptra->asid[1];
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server, "add asid %x %x", asid[0], asid[1]);
if (ptra->jbni != NULL) {
memcpy(buf1, ptra->jbni, 8);
buf1[8] = '\0'; /* terminate it */
jobname = apr_pstrdup(pconf, buf1);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
"[%" APR_PID_T_FMT "] job name via ASCBJBNI = %s",
getpid(), jobname);
}
else if ((ptrb != NULL) && (ptrb->chkey[0] != ' ')) {
memcpy(buf2, ptrb->chkey, 8);
buf2[8] = '\0'; /* terminate it */
jobname = apr_pstrdup(pconf, buf2);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
"[%" APR_PID_T_FMT "] job name via CSCBCHKEY= %s",
getpid(), jobname);
}
else if (ptra->jbns != NULL) {
memcpy(buf3, ptra->jbns, 8);
buf3[8] = '\0'; /* terminate it */
jobname = apr_pstrdup(pconf, buf3);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
"[%" APR_PID_T_FMT "] job name via ASCBJBNS= %s",
getpid(), jobname);
}
/* No need to check if ASSB and JSAB addresses are null since e if they
would imply there is a much larger problem in z/OS
*/
ptrf = (void *) ptra->assb; /* load the address of the ASSB */
ptrg = (void *) ptrf->jsab; /* Load the address of the JSAB */
memcpy(buf4, ptrg->jbid, 8);
buf4[8] = '\0'; /* terminate it */
jobid = apr_pstrdup(pconf, buf4);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
"[%" APR_PID_T_FMT "] jsabjbid = %s",
getpid(), jobid);
/*
sc.smfjobasid=0;
memcpy(((char *)&sc.smfjobasid)+2,ptra->asid,2);
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment