Thank you John, Charles, Seymour, Allan,Paul and everyone else for their help
with this.
I finally got the program to work and display the job name. Of course there are
more efficient ways of coding this using struct and templates,
but this is the way I can best understand the strange workings of this somewhat
convoluted compiler.
$ jn2
ASCB = FB7A00
ASXBC = FB7A6C
ASXB = FB7A6C
ASXBP = AFD000
JNP = AFD0C0
jobname = ACSCEXB
jn2.c
********************************************
define _XOPEN_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <iostream.h>
int main(int argc, char *argv[])
{
int *PSA;
int *ASCB;
int *ASXB=nullptr;
unsigned char *ASXBC;
unsigned char *JNPC;
int * ASXBP;
int * JNPI;
unsigned char jobname[9];
unsigned char * JNP;
PSA=(int *)0x224; /* address of PSAAOLD */
ASCB=(int *)*PSA;
printf("ASCB = %X\n",ASCB);
ASXBC= (unsigned char *)ASCB + 0x6c;
printf("ASXBC = %X\n",ASXBC);
ASXB= (int *)ASXBC;
printf("ASXB = %X\n",ASXB);
ASXBP = (int *)*ASXB;
printf("ASXBP = %X\n",ASXBP);
JNP = (unsigned char *)ASXBP+0XC0;
printf("JNP = %X\n",JNP);
JNPI = (int *)JNP;
memcpy (jobname,JNPI,8);
cout<<"jobname = "<<jobname<<endl;
}
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf
Of John McKown
Sent: Thursday, February 08, 2018 12:48 PM
To: [email protected]
Subject: Re: Silly C problem adding hex 6C
On Thu, Feb 8, 2018 at 11:39 AM, Paul Gilmartin <
[email protected]> wrote:
> On Thu, 8 Feb 2018 10:22:40 -0600, Allan Kielstra wrote:
>
> >The size of a char in 1 byte. Try
> >
> >(char *) ASXB = (char *) ASCB + 0x6c; /* lazy version */
> >
> ANSI says a cast may not be used as an L-value. IBM's C compiler
> enforces this. I once did something like (IIRC?):
> *(char * *) ASXB += 0x6c;
>
I did it this way:
char *psaaold;
char *ascbjbni;
unsigned char *ascbjbns;
unsigned char *ascbjbn;
unsigned char *a;
unsigned char jobname[9];
psaaold = *(unsigned char **)0x224; /* address of PSAAOLD */
ascbjbni = *(unsigned char **)(psaaold + 0xac);
ascbjbns = *(unsigned char **)(psaaold + 0xb0);
>
> My head hurts.
>
> -- gil
>
--
I have a theory that it's impossible to prove anything, but I can't prove
it.
Maranatha! <><
John McKown
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
________________________________
This e-mail, including any attachments, may be confidential, privileged or
otherwise legally protected. It is intended only for the addressee. If you
received this e-mail in error or from someone who was not authorized to send it
to you, do not disseminate, copy or otherwise use this e-mail or its
attachments. Please notify the sender immediately by reply e-mail and delete
the e-mail from your system.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN