I don't understand why everyone seems to cast to int * and not void *.
Chasing control blocks is simple in C just using a basic macro.
#include
#include
#include
#include
#define ptr(addr) (void *)((char *)addr)
char * userid(void)
{
void ** ascb; // -> ASCB - address space
On 10/02/2018 6:30 AM, Kirk Wolf wrote:
Yes - edcdsect.rexx is something that I wrote many years ago.
I'm happy to share it off-list with anyone - I didn't post it as to avoid
attacks on my my crappy REXX hackery.
There's nothing wrong with that REXX. I use it all the time!
UA.EDU] On
> Behalf Of Barkow, Eileen
> Sent: Thursday, February 08, 2018 8:06 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Silly C problem adding hex 6C
>
> I am still trying to crawl my way around C/C++ and am just trying to do
one simple thing:
> add value 0X6C to a pointer ad
al Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Kirk Wolf
Sent: Friday, February 9, 2018 2:31 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C-psa.h - edcdsect
Charles,
If you look at how EDCDSECT handles ORG/redefines, it
On Fri, 9 Feb 2018 20:51:41 +, Barkow, Eileen wrote:
>... I do not think that we have rexx installed on Unix. ...
>
Rexx is standard on z/OS UNIX; no install necessary.
*However*, IBM supplies some EXECs in UNIX directories, clumsy to access
from batch or TSO. (Use BPXBATCH or BPXWUNIX).
e-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Barkow, Eileen
> Sent: Friday, February 9, 2018 12:52 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Silly C problem adding hex 6C-psa.h - edcdsect
>
> I do not see edcdsect
[mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Barkow, Eileen
Sent: Friday, February 9, 2018 12:52 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C-psa.h - edcdsect
I do not see edcdsect.rexx anywhere. I do not think that we have rexx
installed on Unix.
-Original Message
: Re: Silly C problem adding hex 6C-psa.h - edcdsect
First, he didn't provide the script, only illustrated its use. Second CLIST and
REXX are two very different languages.
Kirk was showing the OMVS commands to use edcdsect.rexx.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of
Barkow, Eileen <ebar...@doitt.nyc.gov>
Sent: Friday, February 9, 2018 8:40 AM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: Silly C problem adding hex 6C-psa.h - edcdsect
How do you run this script?
I tried it under UNIX and MVS as
Bernd Oppolzer wrote:
>.. in fact, the original source contains some parts, which are not ANSI C, for
>example cout (which is C++) and iostream.h (which is also part of the C++
>library).
>Because I don't like C++ ... and the program claims to be a C program, I would
>(as a QA person) force
if they exist?
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Ray Pearce
Sent: Friday, February 09, 2018 9:18 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Have you looked at the JZOS Toolkit? It makes
, Eileen
Sent: 09 February 2018 14:00
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Actually I do not like C or C++ very much - I am just including some c routines
in a java program I am writing because there are a lot of things that cannot be
done in Java, or least I do
-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Bernd Oppolzer
Sent: Friday, February 09, 2018 6:41 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
.. in fact, the original source contains some parts,
which are not ANSI C, for example
] On Behalf
Of Kirk Wolf
Sent: Friday, February 09, 2018 7:58 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
It is better IMO to use EDCDSECT and create C header files for the system
DSECTS (PSA, ASCB, ASXB, etc), then you don't have to hard code offsets
into your code.
We
It is better IMO to use EDCDSECT and create C header files for the system
DSECTS (PSA, ASCB, ASXB, etc), then you don't have to hard code offsets
into your code.
We have a little rexx shell script that we have been using for a dozen
years that invokes the assembler + EDCDSECT. It is simple to
More simple ... the pointers don't need to be int pointers;
char pointers are just as good:
#include
#include
#include
#include
int main (int argc, char **argv)
{
char *PSA;
char *ASCB;
char *ASXB;
char *ASXBP;
char *JNPI;
char jobname[9];
PSA = (char *) 0x224; /*
This is a slightly modified version of jn2.c:
#include
#include
#include
#include
int main (int argc, char **argv)
{
int *PSA;
int *ASCB;
int *ASXB;
int *ASXBP;
int *JNPI;
char jobname[9];
PSA = (int *) 0x224; /* address of PSAAOLD */
ASCB = (int *) *PSA;
.. in fact, the original source contains some parts,
which are not ANSI C, for example cout (which is C++)
and iostream.h (which is also part of the C++ library).
Because I don't like C++ ... and the program claims to be
a C program, I would (as a QA person) force the coder to
eliminate these
Am 09.02.2018 um 07:45 schrieb Elardus Engelbrecht:
Bernd Oppolzer wrote:
To be more pedantic, use additional parantheses:
ASXB = (int *) (((char *) ASCB) + 0x6c);
I C ( "I see" ;-D )
Seriously, I find this whole thread very interesting.
Just a question please and please excuse my
Bernd Oppolzer wrote:
>To be more pedantic, use additional parantheses:
>ASXB = (int *) (((char *) ASCB) + 0x6c);
I C ( "I see" ;-D )
Seriously, I find this whole thread very interesting.
Just a question please and please excuse my ignorance.
Are these discussions about C or C++?
To be more pedantic, use additional parantheses:
ASXB = (int *) (((char *) ASCB) + 0x6c);
Kind regards
Bernd
Am 08.02.2018 um 20:47 schrieb Bernd Oppolzer:
int *ASCB;
int *ASXB;
ASXB = ASCB + 0x6c;
because ASCB is a pointer to int, and int has sizeof = 4,
you are in fact adding 4 *
int *ASCB;
int *ASXB;
ASXB = ASCB + 0x6c;
because ASCB is a pointer to int, and int has sizeof = 4,
you are in fact adding 4 * 0x6c to ASCB, that's your problem.
use the following notation, and it will work:
ASXB = (int *) ((char *) ASCB + 0x6c);
first you cast the ASCB to a char *,
jobname,JNPI,8);
cout<<"jobname = "<<jobname<<endl;
}
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of John McKown
Sent: Thursday, February 08, 2018 12:48 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re:
-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
(char *)(ASCB + 0x6C) is going to add 0x6c * 4 since ASCB is a pointer to
integer, then that will be recast to a char *.
(char *)ASCB + 06C will add 0x6c.
Define everything as unsigned char *, since that's what you're really pointing
.
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Barkow, Eileen
Sent: Thursday, February 08, 2018 11:14
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
I tried the simplest solution of casting ASXB to a CHAR
Now you ran into another problem
(((char *)pointer) + offset)
is how you want to bind that expression.
(And I still think using structs is better)
(and you may have to add (int*) in front of the line above)
--
For IBM-MAIN
rame Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Paul Gilmartin
Sent: Thursday, February 08, 2018 12:39 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
On Thu, 8 Feb 2018 10:22:40 -0600, Allan Kielstra wrote:
>The size of a char in 1 byte. Try
&
On Thu, 8 Feb 2018 16:45:18 +, Barkow, Eileen wrote:
>Thank you Charles and Seymore. I thought that the problem had something to do
>with adding to pointers but
>I could not find any doc about it in the manuals.
>
In fact, subscripting is defined in terms of addition and dereferencing. So:
On Thu, Feb 8, 2018 at 11:39 AM, Paul Gilmartin <
000433f07816-dmarc-requ...@listserv.ua.edu> 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
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 +=
"automate" that (C++ only).
Charles
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Barkow, Eileen
Sent: Thursday, February 8, 2018 8:45 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Thank y
Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Charles Mills
Sent: Thursday, February 08, 2018 11:33 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Yes, pointer arithmetic is scaled by the item size. Works kind of like a
subscript. If foo is an int* then foo
gov>
Sent: Thursday, February 8, 2018 11:15:32 AM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: Silly C problem adding hex 6C
How do you specify the item size when adding?
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Seymour
->apfelen);
Charles
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Seymour J Metz
Sent: Thursday, February 8, 2018 8:12 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Isn't pointer arithmetic in C sca
The size of a char in 1 byte. Try
(char *) ASXB = (char *) ASCB + 0x6c; /* lazy version */
But that's not really very nice C code. Rather than using int * variables, it
would be preferable to provide a C struct describing the layout of storage and
using a pointer (or a pointer to a pointer)
How do you specify the item size when adding?
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf
Of Seymour J Metz
Sent: Thursday, February 08, 2018 11:12 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C
Isn't
, February 8, 2018 11:06 AM
To: IBM-MAIN@listserv.ua.edu
Subject: Silly C problem adding hex 6C
I am still trying to crawl my way around C/C++ and am just trying to do one
simple thing:
add value 0X6C to a pointer address (which was originally supplied by this list
as a means to get the jobname)
I am still trying to crawl my way around C/C++ and am just trying to do one
simple thing:
add value 0X6C to a pointer address (which was originally supplied by this list
as a means to get the jobname).
something gets added to the pointer but it is not 0x6c.
i tried all different combinations of
38 matches
Mail list logo