Re: Silly C problem adding hex 6C

2018-02-09 Thread David Crayford
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 cont

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread David Crayford
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! ---

Re: Silly C problem adding hex 6C

2018-02-09 Thread retired mainframer
DU] 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

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Charles Mills
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

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Paul Gilmartin
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). O

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Kirk Wolf
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.rexx anywhere. I do no

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Charles Mills
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.rexx anywhere. I do not think that we have rexx installed on Unix. -Original Me

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Barkow, Eileen
: 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/~s

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Seymour J Metz
frame Discussion List on behalf of Barkow, Eileen 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 a rexx clist and get all kinds of errors. $ ccsect

Re: Silly C problem adding hex 6C

2018-02-09 Thread Elardus Engelbrecht
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 th

Re: Silly C problem adding hex 6C

2018-02-09 Thread Barkow, Eileen
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 this

Re: Silly C problem adding hex 6C

2018-02-09 Thread Ray Pearce
, 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

Re: Silly C problem adding hex 6C

2018-02-09 Thread Barkow, Eileen
- 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

Re: Silly C problem adding hex 6C-psa.h - edcdsect

2018-02-09 Thread Barkow, Eileen
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

Re: Silly C problem adding hex 6C

2018-02-09 Thread Kirk Wolf
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 add

Re: Silly C problem adding hex 6C

2018-02-09 Thread Bernd Oppolzer
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; /* ad

Re: Silly C problem adding hex 6C

2018-02-09 Thread Bernd Oppolzer
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;    printf

Re: Silly C problem adding hex 6C

2018-02-09 Thread Bernd Oppolzer
.. 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 par

Re: Silly C problem adding hex 6C

2018-02-09 Thread Bernd Oppolzer
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 igno

Re: Silly C problem adding hex 6C

2018-02-08 Thread 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 ignorance. Are these discussions about C or C++? Becau

Re: Silly C problem adding hex 6C

2018-02-08 Thread Bernd Oppolzer
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 * 0x6

Re: Silly C problem adding hex 6C

2018-02-08 Thread 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 * 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 *,

Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
obname,JNPI,8); cout<<"jobname = "<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: Silly C problem adding hex 6C On Thu, Feb 8, 2018 at 11:39 AM, Paul Gilmartin < 000433f07

Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
-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 reall

Re: Silly C problem adding hex 6C

2018-02-08 Thread Richard Rogers
ually used. -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

Re: Silly C problem adding hex 6C

2018-02-08 Thread Allan Kielstra
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 sub

Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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 &

Re: Silly C problem adding hex 6C

2018-02-08 Thread Paul Gilmartin
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:

Re: Silly C problem adding hex 6C

2018-02-08 Thread John McKown
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 no

Re: Silly C problem adding hex 6C

2018-02-08 Thread Paul Gilmartin
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 +=

Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
lates "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

Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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

Re: Silly C problem adding hex 6C

2018-02-08 Thread Seymour J Metz
-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 J Metz Sent: Thursday, February 08, 2018 11:12 AM To: IBM-MAIN

Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
->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 s

Re: Silly C problem adding hex 6C

2018-02-08 Thread Allan Kielstra
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)

Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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&#

Re: Silly C problem adding hex 6C

2018-02-08 Thread Seymour J Metz
a.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). something gets added to the pointer but it is not 0x

Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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