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 control block
  void ** asxb;  // -> ASXB - address space extension block
  char *  asxbuser;  // -> ASCBUSER - userid
  ascb = ptr(548); // -> ASCB
  asxb = ptr(*ascb+108);   // ASCB+108 -> ASXB
  asxbuser = ptr(*asxb+192);   // ASXB+192 -> ASXBUSER
  return asxbuser;
}

main()
{
printf("'%8.8s'\n",userid());
  return 0;
}

Of course, we're all waiting on IBM to supply C header files for the 
assembler macros.


On 9/02/2018 3:47 AM, Bernd Oppolzer wrote:

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 *, then you REALLY add 0x6c,
and then you cast the result back to int *.

That's C ... the other solutions suggested (templates etc.) are C++
and don't apply in your case.

HTH, kind regards

Bernd



Am 08.02.2018 um 17:45 schrieb Barkow, Eileen:
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.
I am still not sure that I understand how to fix it but I will try 
based on your info.





--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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!

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-09 Thread retired mainframer
Since pointer arithmetic is performed in terms of object size, you want to
do the arithmetic on a char pointer because sizeof(char) is guaranteed to be
1.

So replace your statement
 ASXB=ASCB+0x6c;
with
 ASXB=(int*)((char*)ASCB+0x6c);
which means
   convert the type of the address in ASCB to a character pointer (value is
unchanged as is the contents of ASCB)
   add the desired offset (sum is still a character pointer)
   convert the sum to an integer pointer
   store the result

> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.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 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 char *; int *; void *; adding
decimal 108; but still get
> the same thing.
> 
> My little program correctly picks up the address of a valid ASCB
(00FCAA00) from the
> PSA.
> Now I just want to point to the address at 00FCAA6C which is a pointer to
the ASXB
> which contains the jobname at offset 0XC0.
> 
> But somehow I cannot add 6C to the ASCB pointer FCAA00 and get the ASXB
pointer at
> FCAA6C.
> Instead I get FCABB0 (or some other address depending on which ASCB is
obtained).
> Can some C guru please tell me what I am doing wrong?
> 
> i will post the program and results - this is running on UNIX/OMVS.
> 
> 
>  MVSZ MVSZ - Storage Contents : ACSCEXB -- (00FCAA00,,SQA)
---
>  Command ===>  Scroll ===>
PAG
> 
>  Address  Offset  0-1-2-3-  4-5-6-7-  8-9-A-B-  C-D-E-F-
0---4---8---C---
>  00FCAA00 +0  C1E2C3C2  00FBC100  00FCAB80    |
ASCB..A...¿Ø |
>  00FCAA10+10          |
 |
>  00FCAA20+20  02E4  0078  000100FF    |
...U.Ì.. |
>  00FCAA30+30  7FF19E00    19A77000    |
"1Æ..xø. |
>  00FCAA40+40    00308F46  D3DC5674  8B346008  |
..±ãLüîÈ».-. |
>  00FCAA50+50          |
 |
>  00FCAA60+60  00AFF158  8F80    00AFD000  |
.®1ì..±Ø.®}. |
>  00FCAA70+70  1D171020      00AFD520  |
.®N. |
>  00FCAA80+80      80AFFF98  4000  | Ø®.q
... |
> 
>  result running jn2
> $ jn2
> ASCB = FCAA00
> ASXB =  FCABB0
> $
> 
> jn2.c program
> 
> #define _XOPEN_SOURCE
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> int main(int argc, char *argv[])
>  {
> int *PSA;
> int  *ASCB;
> int  *ASXB;
> char jobname[9];
> PSA=(int *)0x224; /* address of PSAAOLD */
> ASCB=(int *)*PSA;
> printf("ASCB = %X\n",ASCB);
> ASXB=ASCB+0x6c;
> printf("ASXB =  %X\n",ASXB);
> }
> 
> to compile:
> c++ -+ -c -o jn2.o -I/u/eileen/j16/cons \
>  -I/usr/lpp/java/J8.0_64/include \
>  -W"c,lp64,dll,xplink,langlvl(longlong,nullptr)" jn2.c
> 
> to link:
> c++ \
> -W l,AMODE=64,lp64,LET=4,xplink,dynam=dll,case=mixed \
> -I=CELQS003.x \
> -o jn2\
>   linkmods/CELQSTRT.o \
>  linkmods/CEESTART.o \
>  linkmods/CELQSG03.o \
>  linkmods/CELQINPL.o \
>  linkmods/CELQETBL.o \
>  linkmods/CELQLLST.o \
>  linkmods/CELQBST.o \
>  linkmods/CELQTRM.o \
>  jn2.o
> 
> 
> 
>   
> 
> 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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

2018-02-09 Thread Charles Mills
Sure. I know.

Sometimes you want the "right" union organization, not just the elementary 
names (which would be sufficient for my trivial example). LayoutA.foo might be 
more meaningful than just foo. Does not work if CDSECT has made hash out of 
LayoutA.

Charles


-Original 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 will also #defines 
symbols that wash the unions out (for convenience).

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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).  Others in PDSes, even
harder to access from UNIX.

IBM ought to get its act together and support UNIX directories in the SYSEXEC
concatenation.  Then there'd be little need for EXECs in PDSes.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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

2018-02-09 Thread Kirk Wolf
Charles,

If you look at how EDCDSECT handles ORG/redefines, it will also #defines
symbols that wash the unions out (for convenience).

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.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Fri, Feb 9, 2018 at 3:36 PM, Charles Mills <charl...@mcn.org> wrote:

> I think it is local to Kirk.
>
> CDSECT or EDCDSECT is part of the C/C++ compiler package. Search for it in
> the User's or Programming Guide -- I forget which. Works decently although
> less than perfectly wonderfully.
>
> - Good for MVS data areas because while the result may not be pretty, it is
> technically correct and so perfectly usable. You can tweak the results if
> you wish.
> - Not as good IMHO for your own records because the result may look like
> junk and therefore be hard to understand. If you tweak it then if your
> record changes you have to re-tweak it after re-running CDSECT.
>
> It tends to do a funky job on redefinitions. Working untested from memory,
> if you code
>
> A DS C
> B DS C
> C DS C
>   ORG *-3
> X DS C
> Y DS C
> Z DS C
>
> Probably the most meaningful C equivalent would be something like
>
> union {
>  struct { char a; char b; char b; };
>  struct { char x; char y; char z; }; };
>
> that is, you probably think of it as two alternative 3-byte areas. But
> CDSECT tends to do
>
> union { char a; char x; };
> union { char b; char y; };
> union { char c; char z; };
>
> that is, as three areas each of which has two alternative names.
>
> Charles
>
>
> -Original Message-
> 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 not think that we have rexx
> installed on  Unix.
>
> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Seymour J Metz
> Sent: Friday, February 09, 2018 3:26 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: 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
>
> ____
> From: IBM Mainframe 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 a rexx clist and get all kinds of errors.
>
> $ ccsect
> psa.h:: ccsect 1: FSUM7351 not found
> edcdsect.rexx: ccsect 4: FSUM7351 not found $
>
> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 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 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 recipes to your
> Makefile for whatever system headers you want.
>
> For example:
>
> psa.h:
> echo "  IHAPSA " > asm_temp.s
> echo "  END" >> asm_temp.s
> edcdsect.rexx asm_temp.s  > psa.h
>
> Then you can do:
>
> #include "psa.h"
> struct psa* pPSA = (struct psa*)0;
> struct ascb* pASCB = (struct ascb*)pPSA->psaaold; ...
>
> EDCDSECT is not perfect, but it generally works pretty well.
>
>
> Kirk Wolf
> Dovetailed Technologies
> http://secure-web.cisco.com/12TWE8dXdbRVXzcJYbEA-
> byAvN6cSXeP1rhfnhh7Pa0wEeRF
> 7mWSLoZ6goOOhN-t5hX_thEGjwBDQ5gSI8NqWhi6LjidYzSAXz
> KkKFzZw3nd2Y0Js2LoiFS29Ylj
> bOBrGQX0f5bWALkUNdJIOmT6GJgUYeSW61vUrayUrir72UXGxNNWqdq9kYlK
> XrQjKMr_yqb8lasC
> wZfSutQl221odQZH4QvP-FhM4k39wet0AE_TrUe5bv9Px9RQd2eHVSYBdtn0PQ17R
> vquapDqCGAn
> vV2mr66eC9N9mIBW2tOH7-hg7A6bAgssqsCVXtCObu9iRexaPkE_
> 5NNvnjIuly_-Go7oOwjv6eUz
> 9PN0PhYlIzIHKBfXfeEOACeMlYo6mW72dXK972uIiNQmgc9gGw3YjN9KTaRf
> xUdIMuDiFPkRvblp
> Zt-NOXRidkWltUZ8BPzHr

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

2018-02-09 Thread Charles Mills
I think it is local to Kirk.

CDSECT or EDCDSECT is part of the C/C++ compiler package. Search for it in
the User's or Programming Guide -- I forget which. Works decently although
less than perfectly wonderfully.

- Good for MVS data areas because while the result may not be pretty, it is
technically correct and so perfectly usable. You can tweak the results if
you wish.
- Not as good IMHO for your own records because the result may look like
junk and therefore be hard to understand. If you tweak it then if your
record changes you have to re-tweak it after re-running CDSECT.

It tends to do a funky job on redefinitions. Working untested from memory,
if you code

A DS C
B DS C
C DS C
  ORG *-3
X DS C
Y DS C
Z DS C

Probably the most meaningful C equivalent would be something like

union {
 struct { char a; char b; char b; };
 struct { char x; char y; char z; }; };

that is, you probably think of it as two alternative 3-byte areas. But
CDSECT tends to do

union { char a; char x; };
union { char b; char y; };
union { char c; char z; };

that is, as three areas each of which has two alternative names.

Charles


-Original Message-
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 not think that we have rexx
installed on  Unix. 

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Seymour J Metz
Sent: Friday, February 09, 2018 3:26 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: 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


From: IBM Mainframe 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 a rexx clist and get all kinds of errors.

$ ccsect
psa.h:: ccsect 1: FSUM7351 not found
edcdsect.rexx: ccsect 4: FSUM7351 not found $

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 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 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 recipes to your
Makefile for whatever system headers you want.

For example:

psa.h:
echo "  IHAPSA " > asm_temp.s
echo "  END" >> asm_temp.s
edcdsect.rexx asm_temp.s  > psa.h

Then you can do:

#include "psa.h"
struct psa* pPSA = (struct psa*)0;
struct ascb* pASCB = (struct ascb*)pPSA->psaaold; ...

EDCDSECT is not perfect, but it generally works pretty well.


Kirk Wolf
Dovetailed Technologies
http://secure-web.cisco.com/12TWE8dXdbRVXzcJYbEA-byAvN6cSXeP1rhfnhh7Pa0wEeRF
7mWSLoZ6goOOhN-t5hX_thEGjwBDQ5gSI8NqWhi6LjidYzSAXzKkKFzZw3nd2Y0Js2LoiFS29Ylj
bOBrGQX0f5bWALkUNdJIOmT6GJgUYeSW61vUrayUrir72UXGxNNWqdq9kYlKXrQjKMr_yqb8lasC
wZfSutQl221odQZH4QvP-FhM4k39wet0AE_TrUe5bv9Px9RQd2eHVSYBdtn0PQ17RvquapDqCGAn
vV2mr66eC9N9mIBW2tOH7-hg7A6bAgssqsCVXtCObu9iRexaPkE_5NNvnjIuly_-Go7oOwjv6eUz
9PN0PhYlIzIHKBfXfeEOACeMlYo6mW72dXK972uIiNQmgc9gGw3YjN9KTaRfxUdIMuDiFPkRvblp
Zt-NOXRidkWltUZ8BPzHr/http%3A%2F%2Fdovetail.com%0D%0A%0D%0AOn%20Fri%2C%20Feb
%209%2C%202018%20at%206%3A02%20AM%2C%20Bernd%20Oppolzer%20%3Cbernd.oppolzer%
40t-online.de>
wrote:

> 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; /* address of PSAAOLD */
>ASCB = (char *) (*PSA);
>printf ("ASCB = %p\n", ASCB);
>ASXB = ASCB + 0x6c;
>printf ("ASXB = %p\n", ASXB);
>ASXBP = (char *) (*ASXB);
>printf ("ASXBP = %p\n", ASXBP);
>JNPI = ASXBP + 0xC0;
>printf ("JNPI = %p\n", JNPI);
>memcpy (jobname, JNPI, 8);
>jobname [8] = 0x00;
>printf ("jobname = %s\n", jobname); }
>
>
>
> Am 09.02.2018 um 12:57 schrieb Bernd Oppolzer

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

2018-02-09 Thread Barkow, Eileen
I do not see edcdsect.rexx anywhere. I do not think that we have rexx installed 
on  Unix. 

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Seymour J Metz
Sent: Friday, February 09, 2018 3:26 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: 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


From: IBM Mainframe 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 a rexx clist and get all kinds of errors.

$ ccsect
psa.h:: ccsect 1: FSUM7351 not found
edcdsect.rexx: ccsect 4: FSUM7351 not found
$

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 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 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 recipes
to your Makefile for whatever system headers you want.

For example:

psa.h:
echo "  IHAPSA " > asm_temp.s
echo "  END" >> asm_temp.s
edcdsect.rexx asm_temp.s  > psa.h

Then you can do:

#include "psa.h"
struct psa* pPSA = (struct psa*)0;
struct ascb* pASCB = (struct ascb*)pPSA->psaaold;
...

EDCDSECT is not perfect, but it generally works pretty well.


Kirk Wolf
Dovetailed Technologies
http://secure-web.cisco.com/12TWE8dXdbRVXzcJYbEA-byAvN6cSXeP1rhfnhh7Pa0wEeRF7mWSLoZ6goOOhN-t5hX_thEGjwBDQ5gSI8NqWhi6LjidYzSAXzKkKFzZw3nd2Y0Js2LoiFS29YljbOBrGQX0f5bWALkUNdJIOmT6GJgUYeSW61vUrayUrir72UXGxNNWqdq9kYlKXrQjKMr_yqb8lasCwZfSutQl221odQZH4QvP-FhM4k39wet0AE_TrUe5bv9Px9RQd2eHVSYBdtn0PQ17RvquapDqCGAnvV2mr66eC9N9mIBW2tOH7-hg7A6bAgssqsCVXtCObu9iRexaPkE_5NNvnjIuly_-Go7oOwjv6eUz9PN0PhYlIzIHKBfXfeEOACeMlYo6mW72dXK972uIiNQmgc9gGw3YjN9KTaRfxUdIMuDiFPkRvblpZt-NOXRidkWltUZ8BPzHr/http%3A%2F%2Fdovetail.com%0D%0A%0D%0AOn%20Fri%2C%20Feb%209%2C%202018%20at%206%3A02%20AM%2C%20Bernd%20Oppolzer%20%3Cbernd.oppolzer%40t-online.de>
wrote:

> 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; /* address of PSAAOLD */
>ASCB = (char *) (*PSA);
>printf ("ASCB = %p\n", ASCB);
>ASXB = ASCB + 0x6c;
>printf ("ASXB = %p\n", ASXB);
>ASXBP = (char *) (*ASXB);
>printf ("ASXBP = %p\n", ASXBP);
>JNPI = ASXBP + 0xC0;
>printf ("JNPI = %p\n", JNPI);
>memcpy (jobname, JNPI, 8);
>jobname [8] = 0x00;
>printf ("jobname = %s\n", jobname);
> }
>
>
>
> Am 09.02.2018 um 12:57 schrieb 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 ("ASCB = %p\n", ASCB);
>>ASXB = (int *) ((char *) ASCB + 0x6c);
>>printf ("ASXB = %p\n", ASXB);
>>ASXBP = (int *) *ASXB;
>>printf ("ASXBP = %p\n", ASXBP);
>>JNPI = (int *) ((char *) ASXBP + 0xC0);
>>printf ("JNPI = %p\n", JNPI);
>>memcpy (jobname, JNPI, 8);
>>jobname [8] = 0x00;
>>printf ("jobname = %s\n", jobname);
>> }
>>
>> a) pure ANSI C
>>
>> b) some intermediate steps and variables removed
>>
>> c) there is a subtle error in the original version:
>> the terminating hex zero in jobname is missing. I added it.
>>
>> Caution: untested ...
>>
>> Kind regards
>>
>> Bernd
>>
>>
>>
>> Am 09.02.2018 um 12:41 schrieb Bernd Oppolzer:
>>
>&g

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

2018-02-09 Thread Seymour J Metz
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


From: IBM Mainframe 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 a rexx clist and get all kinds of errors.

$ ccsect
psa.h:: ccsect 1: FSUM7351 not found
edcdsect.rexx: ccsect 4: FSUM7351 not found
$

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 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 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 recipes
to your Makefile for whatever system headers you want.

For example:

psa.h:
echo "  IHAPSA " > asm_temp.s
echo "  END" >> asm_temp.s
edcdsect.rexx asm_temp.s  > psa.h

Then you can do:

#include "psa.h"
struct psa* pPSA = (struct psa*)0;
struct ascb* pASCB = (struct ascb*)pPSA->psaaold;
...

EDCDSECT is not perfect, but it generally works pretty well.


Kirk Wolf
Dovetailed Technologies
http://secure-web.cisco.com/12TWE8dXdbRVXzcJYbEA-byAvN6cSXeP1rhfnhh7Pa0wEeRF7mWSLoZ6goOOhN-t5hX_thEGjwBDQ5gSI8NqWhi6LjidYzSAXzKkKFzZw3nd2Y0Js2LoiFS29YljbOBrGQX0f5bWALkUNdJIOmT6GJgUYeSW61vUrayUrir72UXGxNNWqdq9kYlKXrQjKMr_yqb8lasCwZfSutQl221odQZH4QvP-FhM4k39wet0AE_TrUe5bv9Px9RQd2eHVSYBdtn0PQ17RvquapDqCGAnvV2mr66eC9N9mIBW2tOH7-hg7A6bAgssqsCVXtCObu9iRexaPkE_5NNvnjIuly_-Go7oOwjv6eUz9PN0PhYlIzIHKBfXfeEOACeMlYo6mW72dXK972uIiNQmgc9gGw3YjN9KTaRfxUdIMuDiFPkRvblpZt-NOXRidkWltUZ8BPzHr/http%3A%2F%2Fdovetail.com%0D%0A%0D%0AOn%20Fri%2C%20Feb%209%2C%202018%20at%206%3A02%20AM%2C%20Bernd%20Oppolzer%20%3Cbernd.oppolzer%40t-online.de>
wrote:

> 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; /* address of PSAAOLD */
>ASCB = (char *) (*PSA);
>printf ("ASCB = %p\n", ASCB);
>ASXB = ASCB + 0x6c;
>printf ("ASXB = %p\n", ASXB);
>ASXBP = (char *) (*ASXB);
>printf ("ASXBP = %p\n", ASXBP);
>JNPI = ASXBP + 0xC0;
>printf ("JNPI = %p\n", JNPI);
>memcpy (jobname, JNPI, 8);
>jobname [8] = 0x00;
>printf ("jobname = %s\n", jobname);
> }
>
>
>
> Am 09.02.2018 um 12:57 schrieb 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 ("ASCB = %p\n", ASCB);
>>ASXB = (int *) ((char *) ASCB + 0x6c);
>>printf ("ASXB = %p\n", ASXB);
>>ASXBP = (int *) *ASXB;
>>printf ("ASXBP = %p\n", ASXBP);
>>JNPI = (int *) ((char *) ASXBP + 0xC0);
>>printf ("JNPI = %p\n", JNPI);
>>memcpy (jobname, JNPI, 8);
>>jobname [8] = 0x00;
>>printf ("jobname = %s\n", jobname);
>> }
>>
>> a) pure ANSI C
>>
>> b) some intermediate steps and variables removed
>>
>> c) there is a subtle error in the original version:
>> the terminating hex zero in jobname is missing. I added it.
>>
>> Caution: untested ...
>>
>> Kind regards
>>
>> Bernd
>>
>>
>>
>> Am 09.02.2018 um 12:41 schrieb 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

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 the coder to eliminate these parts of the code.

Thanks for all your posts explaining that. That was very interesting.

Anyways, any languages including C and C++ which require more than two of my 
braincells to be working are too hard for me... ;-D

Perhaps I'm getting too lazy... 

Thanks again!

Groete / Greetings
Elardus Engelbrecht

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-09 Thread Barkow, Eileen
I looked at JZOS.
The only jzos samples I have is for 32 bit addressing - I cannot find 64 bit 
samples to use with 64 bit java.
IBM gives you a run-around. They  point to a non-existent or useless link in 
the java jzos readme file and there are no 64 bit samples.
Where are the new JZOS samples 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 easy.

String jobName = ZUtil.getCurrentJobname();
WtoMessage msg = new WtoMessage(jobName);
MvsConsole.wto(msg);

Regards

Ray


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Barkow, 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 not know how to do them. But I know java little 
better than I know c/c++. In this case, I am using the C console2 routine and 
Want to output the running jobname to the system console.

I used cout to print the jobname because I could not get get it to print 
correctly with printf.
I see that you added code to 0 out the last byte of jobname - that must have 
fixed the formatting.


--
This e-mail message has been scanned and cleared by Google Message Security
and the UNICOM Global security systems. This message is for the named
person's use only. If you receive this message in error, please delete it
and notify the sender.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-09 Thread Ray Pearce
Have you looked at the JZOS Toolkit? It makes this easy.

String jobName = ZUtil.getCurrentJobname();
WtoMessage msg = new WtoMessage(jobName);
MvsConsole.wto(msg);

Regards

Ray


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Barkow, 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 not know how to do them. But I know java little 
better than I know c/c++. In this case, I am using the C console2 routine and 
Want to output the running jobname to the system console.

I used cout to print the jobname because I could not get get it to print 
correctly with printf.
I see that you added code to 0 out the last byte of jobname - that must have 
fixed the formatting.


-- 
This e-mail message has been scanned and cleared by Google Message Security 
and the UNICOM Global security systems. This message is for the named 
person's use only. If you receive this message in error, please delete it 
and notify the sender. 

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-09 Thread Barkow, Eileen
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 not know how to do them. But I know java little better than 
I know c/c++. In this case, I am using the C console2 routine and
Want to output the running jobname to the system console.

I used cout to print the jobname because I could not get get it to print 
correctly with printf.
I see that you added code to 0 out the last byte of jobname - that must have 
fixed the formatting.

-Original Message-
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 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 parts of the code.

Kind regards

Bernd


Am 09.02.2018 um 12:32 schrieb 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 ignorance.
>>
>> Are these discussions about C or C++?
>>
>> Because:
>>
>> OP said 'crawl my way around C/C++'
>> Shmuel and Paul are talking about C and Charles talked about C++ (for
>> his 2 templates)
>>
>> Feel free to teach me so I can C...
>>
>> TIA!
>>
>> Groete / Greetings
>> Elardus Engelbrecht
>>
>>
>
> I went back to the original post which started the thread;
> the OP said "C / C++", but posted a C program (called jn2.c),
> so I guess, the discussion should in fact be about C.
>
> a) It's all pure C syntax
> b) with C++, the filetype would have been "cpp"
>
> HTH, kind regards
>
> Bernd
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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

2018-02-09 Thread Barkow, Eileen
How do you run this script?
I tried it under UNIX and MVS as a rexx clist and get all kinds of errors.

$ ccsect
psa.h:: ccsect 1: FSUM7351 not found
edcdsect.rexx: ccsect 4: FSUM7351 not found
$

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 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 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 recipes
to your Makefile for whatever system headers you want.

For example:

psa.h:
echo "  IHAPSA " > asm_temp.s
echo "  END" >> asm_temp.s
edcdsect.rexx asm_temp.s  > psa.h

Then you can do:

#include "psa.h"
struct psa* pPSA = (struct psa*)0;
struct ascb* pASCB = (struct ascb*)pPSA->psaaold;
...

EDCDSECT is not perfect, but it generally works pretty well.


Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Fri, Feb 9, 2018 at 6:02 AM, Bernd Oppolzer <bernd.oppol...@t-online.de>
wrote:

> 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; /* address of PSAAOLD */
>ASCB = (char *) (*PSA);
>printf ("ASCB = %p\n", ASCB);
>ASXB = ASCB + 0x6c;
>printf ("ASXB = %p\n", ASXB);
>ASXBP = (char *) (*ASXB);
>printf ("ASXBP = %p\n", ASXBP);
>JNPI = ASXBP + 0xC0;
>printf ("JNPI = %p\n", JNPI);
>memcpy (jobname, JNPI, 8);
>jobname [8] = 0x00;
>printf ("jobname = %s\n", jobname);
> }
>
>
>
> Am 09.02.2018 um 12:57 schrieb 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 ("ASCB = %p\n", ASCB);
>>ASXB = (int *) ((char *) ASCB + 0x6c);
>>printf ("ASXB = %p\n", ASXB);
>>ASXBP = (int *) *ASXB;
>>printf ("ASXBP = %p\n", ASXBP);
>>JNPI = (int *) ((char *) ASXBP + 0xC0);
>>printf ("JNPI = %p\n", JNPI);
>>memcpy (jobname, JNPI, 8);
>>jobname [8] = 0x00;
>>printf ("jobname = %s\n", jobname);
>> }
>>
>> a) pure ANSI C
>>
>> b) some intermediate steps and variables removed
>>
>> c) there is a subtle error in the original version:
>> the terminating hex zero in jobname is missing. I added it.
>>
>> Caution: untested ...
>>
>> Kind regards
>>
>> Bernd
>>
>>
>>
>> Am 09.02.2018 um 12:41 schrieb 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 parts of the code.
>>>
>>> Kind regards
>>>
>>> Bernd
>>>
>>>
>>> Am 09.02.2018 um 12:32 schrieb 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 ignorance.
>>>>>
>>>>> Are these discussions about C or C++?
>>>>>
>>>>> Because:
>>>>>
>>>>> OP said 'crawl my way around C/C++'
>>>>> Shmuel and Paul are talking ab

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 recipes
to your Makefile for whatever system headers you want.

For example:

psa.h:
echo "  IHAPSA " > asm_temp.s
echo "  END" >> asm_temp.s
edcdsect.rexx asm_temp.s  > psa.h

Then you can do:

#include "psa.h"
struct psa* pPSA = (struct psa*)0;
struct ascb* pASCB = (struct ascb*)pPSA->psaaold;
...

EDCDSECT is not perfect, but it generally works pretty well.


Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Fri, Feb 9, 2018 at 6:02 AM, Bernd Oppolzer 
wrote:

> 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; /* address of PSAAOLD */
>ASCB = (char *) (*PSA);
>printf ("ASCB = %p\n", ASCB);
>ASXB = ASCB + 0x6c;
>printf ("ASXB = %p\n", ASXB);
>ASXBP = (char *) (*ASXB);
>printf ("ASXBP = %p\n", ASXBP);
>JNPI = ASXBP + 0xC0;
>printf ("JNPI = %p\n", JNPI);
>memcpy (jobname, JNPI, 8);
>jobname [8] = 0x00;
>printf ("jobname = %s\n", jobname);
> }
>
>
>
> Am 09.02.2018 um 12:57 schrieb 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 ("ASCB = %p\n", ASCB);
>>ASXB = (int *) ((char *) ASCB + 0x6c);
>>printf ("ASXB = %p\n", ASXB);
>>ASXBP = (int *) *ASXB;
>>printf ("ASXBP = %p\n", ASXBP);
>>JNPI = (int *) ((char *) ASXBP + 0xC0);
>>printf ("JNPI = %p\n", JNPI);
>>memcpy (jobname, JNPI, 8);
>>jobname [8] = 0x00;
>>printf ("jobname = %s\n", jobname);
>> }
>>
>> a) pure ANSI C
>>
>> b) some intermediate steps and variables removed
>>
>> c) there is a subtle error in the original version:
>> the terminating hex zero in jobname is missing. I added it.
>>
>> Caution: untested ...
>>
>> Kind regards
>>
>> Bernd
>>
>>
>>
>> Am 09.02.2018 um 12:41 schrieb 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 parts of the code.
>>>
>>> Kind regards
>>>
>>> Bernd
>>>
>>>
>>> Am 09.02.2018 um 12:32 schrieb 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 ignorance.
>
> Are these discussions about C or C++?
>
> Because:
>
> OP said 'crawl my way around C/C++'
> Shmuel and Paul are talking about C and Charles talked about C++ (for
> his 2 templates)
>
> Feel free to teach me so I can C...
>
> TIA!
>
> Groete / Greetings
> Elardus Engelbrecht
>
>
>
 I went back to the original post which started the thread;
 the OP said "C / C++", but posted a C program (called jn2.c),
 so I guess, the discussion should in fact be about C.

 a) It's all pure C syntax
 b) with C++, the filetype would have been "cpp"

 HTH, kind regards

 Bernd

 --
 For IBM-MAIN subscribe / signoff / archive access instructions,
 send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


>>>
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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; /* address of PSAAOLD */
   ASCB = (char *) (*PSA);
   printf ("ASCB = %p\n", ASCB);
   ASXB = ASCB + 0x6c;
   printf ("ASXB = %p\n", ASXB);
   ASXBP = (char *) (*ASXB);
   printf ("ASXBP = %p\n", ASXBP);
   JNPI = ASXBP + 0xC0;
   printf ("JNPI = %p\n", JNPI);
   memcpy (jobname, JNPI, 8);
   jobname [8] = 0x00;
   printf ("jobname = %s\n", jobname);
}



Am 09.02.2018 um 12:57 schrieb 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 ("ASCB = %p\n", ASCB);
   ASXB = (int *) ((char *) ASCB + 0x6c);
   printf ("ASXB = %p\n", ASXB);
   ASXBP = (int *) *ASXB;
   printf ("ASXBP = %p\n", ASXBP);
   JNPI = (int *) ((char *) ASXBP + 0xC0);
   printf ("JNPI = %p\n", JNPI);
   memcpy (jobname, JNPI, 8);
   jobname [8] = 0x00;
   printf ("jobname = %s\n", jobname);
}

a) pure ANSI C

b) some intermediate steps and variables removed

c) there is a subtle error in the original version:
the terminating hex zero in jobname is missing. I added it.

Caution: untested ...

Kind regards

Bernd



Am 09.02.2018 um 12:41 schrieb 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 parts of the code.

Kind regards

Bernd


Am 09.02.2018 um 12:32 schrieb 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 ignorance.

Are these discussions about C or C++?

Because:

OP said 'crawl my way around C/C++'
Shmuel and Paul are talking about C and Charles talked about C++ 
(for his 2 templates)


Feel free to teach me so I can C...

TIA!

Groete / Greetings
Elardus Engelbrecht




I went back to the original post which started the thread;
the OP said "C / C++", but posted a C program (called jn2.c),
so I guess, the discussion should in fact be about C.

a) It's all pure C syntax
b) with C++, the filetype would have been "cpp"

HTH, kind regards

Bernd

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN





--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 ("ASCB = %p\n", ASCB);
   ASXB = (int *) ((char *) ASCB + 0x6c);
   printf ("ASXB = %p\n", ASXB);
   ASXBP = (int *) *ASXB;
   printf ("ASXBP = %p\n", ASXBP);
   JNPI = (int *) ((char *) ASXBP + 0xC0);
   printf ("JNPI = %p\n", JNPI);
   memcpy (jobname, JNPI, 8);
   jobname [8] = 0x00;
   printf ("jobname = %s\n", jobname);
}

a) pure ANSI C

b) some intermediate steps and variables removed

c) there is a subtle error in the original version:
the terminating hex zero in jobname is missing. I added it.

Caution: untested ...

Kind regards

Bernd



Am 09.02.2018 um 12:41 schrieb 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 parts of the code.

Kind regards

Bernd


Am 09.02.2018 um 12:32 schrieb 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 ignorance.

Are these discussions about C or C++?

Because:

OP said 'crawl my way around C/C++'
Shmuel and Paul are talking about C and Charles talked about C++ 
(for his 2 templates)


Feel free to teach me so I can C...

TIA!

Groete / Greetings
Elardus Engelbrecht




I went back to the original post which started the thread;
the OP said "C / C++", but posted a C program (called jn2.c),
so I guess, the discussion should in fact be about C.

a) It's all pure C syntax
b) with C++, the filetype would have been "cpp"

HTH, kind regards

Bernd

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN





--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 parts of the code.

Kind regards

Bernd


Am 09.02.2018 um 12:32 schrieb 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 ignorance.

Are these discussions about C or C++?

Because:

OP said 'crawl my way around C/C++'
Shmuel and Paul are talking about C and Charles talked about C++ (for 
his 2 templates)


Feel free to teach me so I can C...

TIA!

Groete / Greetings
Elardus Engelbrecht




I went back to the original post which started the thread;
the OP said "C / C++", but posted a C program (called jn2.c),
so I guess, the discussion should in fact be about C.

a) It's all pure C syntax
b) with C++, the filetype would have been "cpp"

HTH, kind regards

Bernd

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 ignorance.

Are these discussions about C or C++?

Because:

OP said 'crawl my way around C/C++'
Shmuel and Paul are talking about C and Charles talked about C++ (for his 2 
templates)

Feel free to teach me so I can C...

TIA!

Groete / Greetings
Elardus Engelbrecht




I went back to the original post which started the thread;
the OP said "C / C++", but posted a C program (called jn2.c),
so I guess, the discussion should in fact be about C.

a) It's all pure C syntax
b) with C++, the filetype would have been "cpp"

HTH, kind regards

Bernd

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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++?

Because:

OP said 'crawl my way around C/C++'
Shmuel and Paul are talking about C and Charles talked about C++ (for his 2 
templates)

Feel free to teach me so I can C...

TIA!

Groete / Greetings
Elardus Engelbrecht

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 * 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 *, then you REALLY add 0x6c,
and then you cast the result back to int *.

That's C ... the other solutions suggested (templates etc.) are C++
and don't apply in your case.

HTH, kind regards

Bernd



Am 08.02.2018 um 17:45 schrieb Barkow, Eileen:
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.
I am still not sure that I understand how to fix it but I will try 
based on your info.





--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 *, then you REALLY add 0x6c,
and then you cast the result back to int *.

That's C ... the other solutions suggested (templates etc.) are C++
and don't apply in your case.

HTH, kind regards

Bernd



Am 08.02.2018 um 17:45 schrieb Barkow, Eileen:

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.
I am still not sure that I understand how to fix it but I will try based on 
your info.




--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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 
#include 
#include 
#include 
#include 
#include 
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: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 <
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 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 lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
Will not win any prizes from your Computer Science professor but may well be 
the best way to skin the cat.

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Richard Rogers
Sent: Thursday, February 8, 2018 10:30 AM
To: IBM-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 
to.  Then recast to int or whatever when and as actually used.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Richard Rogers
(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 
to.  Then recast to int or whatever when and as actually 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 to a  CHAR * since I am not 
familiar with templates and  basically got the same value as before.
I will try some of the other solutions .

Thanks everyone  $ jn2 ASCB = FB7A00 ASXBC =  FB7BB0


int *PSA;
 int  *ASCB;
 int  *ASXB=nullptr;
 char *ASXBC;
 char jobnameÝ9¨;
 PSA=(int *)0x224; /* address of PSAAOLD */  ASCB=(int *)*PSA;  printf("ASCB = 
%X\n",ASCB);  ASXBC= (char *)(ASCB + 0x6c);  printf("ASXBC =  %X\n",ASXBC);

-Original Message-
From: IBM Mainframe 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
>
>(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;

My head hurts.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu 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 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
I tried the simplest solution of casting ASXB to a  CHAR * since I am not 
familiar with templates and  basically got the same value as before.
I will try some of the other solutions .

Thanks everyone
 $ jn2
ASCB = FB7A00
ASXBC =  FB7BB0


int *PSA;
 int  *ASCB;
 int  *ASXB=nullptr;
 char *ASXBC;
 char jobnameÝ9¨;
 PSA=(int *)0x224; /* address of PSAAOLD */
 ASCB=(int *)*PSA;
 printf("ASCB = %X\n",ASCB);
 ASXBC= (char *)(ASCB + 0x6c);
 printf("ASXBC =  %X\n",ASXBC);

-Original Message-
From: IBM Mainframe 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
>
>(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;

My head hurts.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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:
Array[ index ]  means  *( Array + index )

Since addition is commutative, this is entirely equivalent to *( index + Array )
so, index[ Array ].

Or, an outrageous example:
"wombat"[ 3 ]  means the same as  3[ "wombat" ]  --  both mean 'b'.

Don't you ever dare code that!

>I am still not sure that I understand how to fix it but I will try based on 
>your info.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 += 0x6c;

My head hurts.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
Let's say foo is a struct with some variable length, typical of various MVS
data areas.

struct foo *pFoo;

If you say pFoo++ it increments pFoo by the declared static length of a foo,
not by 1. Increments by the declared length of struct foo.

If bar is an integer that has the actual length of this particular foo and
you want to increment pFoo by that amount, then you could code

pFoo = (foo *)((char *)foo + bar);

You are casting foo to a char* so ++ would add one to it. Then you add bar
(absolute value in bar) and then cast back to a foo* so you can assign it to
pFoo.

My two templates "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 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.
I am still not sure that I understand how to fix it but I will try based on
your info.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Barkow, Eileen
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.
I am still not sure that I understand how to fix it but I will try based on 
your info.

-Original Message-
From: IBM Mainframe 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+1 points to the next integer. (IOW
foo+4 if you think in assembler terms.)

The basic strategy is to cast it to a char* and then back.

If you would like, here are two template functions that will do the trick
you want to accomplish.

// Pointer absolute arithmetic
// This one matches if no explicit typename
template static inline T *PointerAdd(const T *ptr, const int
increment)
{
return (T *)( reinterpret_cast(ptr)+increment );
}

// This one matches if explicit typename
template static inline T *PointerAdd(const void *ptr, const
int increment)
{
return (T *)( reinterpret_cast(ptr)+increment );
}

How to use? Here is an example of adding an absolute length to a struct
pointer:

apfePtr = PointerAdd(apfePtr, apfePtr->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 scaled by the item size?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Seymour J Metz
You use an appropriate type when you declare the pointer. ISAGN for unspec.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Barkow, Eileen <ebar...@doitt.nyc.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 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 pointer arithmetic in C scaled by the item size?


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Barkow, Eileen <ebar...@doitt.nyc.gov>
Sent: Thursday, 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).
 something gets added to the pointer but it is not 0x6c.
i tried all different combinations of char *; int *; void *; adding decimal 
108; but still get the same thing.

My little program correctly picks up the address of a valid ASCB (00FCAA00) 
from the PSA.
Now I just want to point to the address at 00FCAA6C which is a pointer to the 
ASXB which contains the jobname at offset 0XC0.

But somehow I cannot add 6C to the ASCB pointer FCAA00 and get the ASXB pointer 
at FCAA6C.
Instead I get FCABB0 (or some other address depending on which ASCB is 
obtained).
Can some C guru please tell me what I am doing wrong?

i will post the program and results - this is running on UNIX/OMVS.


 MVSZ MVSZ - Storage Contents : ACSCEXB -- (00FCAA00,,SQA) ---
 Command ===>  Scroll ===> PAG

 Address  Offset  0-1-2-3-  4-5-6-7-  8-9-A-B-  C-D-E-F-0---4---8---C---
 00FCAA00 +0  C1E2C3C2  00FBC100  00FCAB80    | ASCB..A...¿Ø |
 00FCAA10+10          |  |
 00FCAA20+20  02E4  0078  000100FF    | ...U.Ì.. |
 00FCAA30+30  7FF19E00    19A77000    | "1Æ..xø. |
 00FCAA40+40    00308F46  D3DC5674  8B346008  | ..±ãLüîÈ».-. |
 00FCAA50+50          |  |
 00FCAA60+60  00AFF158  8F80    00AFD000  | .®1ì..±Ø.®}. |
 00FCAA70+70  1D171020      00AFD520  | .®N. |
 00FCAA80+80      80AFFF98  4000  | Ø®.q ... |

 result running jn2
$ jn2
ASCB = FCAA00
ASXB =  FCABB0
$

jn2.c program

#define _XOPEN_SOURCE
#include 
#include 
#include 
#include 
#include 
#include 
int main(int argc, char *argv[])
 {
int *PSA;
int  *ASCB;
int  *ASXB;
char jobname[9];
PSA=(int *)0x224; /* address of PSAAOLD */
ASCB=(int *)*PSA;
printf("ASCB = %X\n",ASCB);
ASXB=ASCB+0x6c;
printf("ASXB =  %X\n",ASXB);
}

to compile:
c++ -+ -c -o jn2.o -I/u/eileen/j16/cons \
 -I/usr/lpp/java/J8.0_64/include \
 -W"c,lp64,dll,xplink,langlvl(longlong,nullptr)" jn2.c

to link:
c++ \
-W l,AMODE=64,lp64,LET=4,xplink,dynam=dll,case=mixed \
-I=CELQS003.x \
-o jn2\
  linkmods/CELQSTRT.o \
 linkmods/CEESTART.o \
 linkmods/CELQSG03.o \
 linkmods/CELQINPL.o \
 linkmods/CELQETBL.o \
 linkmods/CELQLLST.o \
 linkmods/CELQBST.o \
 linkmods/CELQTRM.o \
 jn2.o



  

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

---

Re: Silly C problem adding hex 6C

2018-02-08 Thread Charles Mills
Yes, pointer arithmetic is scaled by the item size. Works kind of like a
subscript. If foo is an int* then foo+1 points to the next integer. (IOW
foo+4 if you think in assembler terms.)

The basic strategy is to cast it to a char* and then back.

If you would like, here are two template functions that will do the trick
you want to accomplish.

// Pointer absolute arithmetic
// This one matches if no explicit typename
template static inline T *PointerAdd(const T *ptr, const int
increment)
{
return (T *)( reinterpret_cast(ptr)+increment );
}

// This one matches if explicit typename
template static inline T *PointerAdd(const void *ptr, const
int increment)
{
return (T *)( reinterpret_cast(ptr)+increment );
}

How to use? Here is an example of adding an absolute length to a struct
pointer:

apfePtr = PointerAdd(apfePtr, apfePtr->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 scaled by the item size?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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) of that type.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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't pointer arithmetic in C scaled by the item size?


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Barkow, Eileen <ebar...@doitt.nyc.gov>
Sent: Thursday, 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).
 something gets added to the pointer but it is not 0x6c.
i tried all different combinations of char *; int *; void *; adding decimal 
108; but still get the same thing.

My little program correctly picks up the address of a valid ASCB (00FCAA00) 
from the PSA.
Now I just want to point to the address at 00FCAA6C which is a pointer to the 
ASXB which contains the jobname at offset 0XC0.

But somehow I cannot add 6C to the ASCB pointer FCAA00 and get the ASXB pointer 
at FCAA6C.
Instead I get FCABB0 (or some other address depending on which ASCB is 
obtained).
Can some C guru please tell me what I am doing wrong?

i will post the program and results - this is running on UNIX/OMVS.


 MVSZ MVSZ - Storage Contents : ACSCEXB -- (00FCAA00,,SQA) ---
 Command ===>  Scroll ===> PAG

 Address  Offset  0-1-2-3-  4-5-6-7-  8-9-A-B-  C-D-E-F-0---4---8---C---
 00FCAA00 +0  C1E2C3C2  00FBC100  00FCAB80    | ASCB..A...¿Ø |
 00FCAA10+10          |  |
 00FCAA20+20  02E4  0078  000100FF    | ...U.Ì.. |
 00FCAA30+30  7FF19E00    19A77000    | "1Æ..xø. |
 00FCAA40+40    00308F46  D3DC5674  8B346008  | ..±ãLüîÈ».-. |
 00FCAA50+50          |  |
 00FCAA60+60  00AFF158  8F80    00AFD000  | .®1ì..±Ø.®}. |
 00FCAA70+70  1D171020      00AFD520  | .®N. |
 00FCAA80+80      80AFFF98  4000  | Ø®.q ... |

 result running jn2
$ jn2
ASCB = FCAA00
ASXB =  FCABB0
$

jn2.c program

#define _XOPEN_SOURCE
#include 
#include 
#include 
#include 
#include 
#include 
int main(int argc, char *argv[])
 {
int *PSA;
int  *ASCB;
int  *ASXB;
char jobname[9];
PSA=(int *)0x224; /* address of PSAAOLD */
ASCB=(int *)*PSA;
printf("ASCB = %X\n",ASCB);
ASXB=ASCB+0x6c;
printf("ASXB =  %X\n",ASXB);
}

to compile:
c++ -+ -c -o jn2.o -I/u/eileen/j16/cons \
 -I/usr/lpp/java/J8.0_64/include \
 -W"c,lp64,dll,xplink,langlvl(longlong,nullptr)" jn2.c

to link:
c++ \
-W l,AMODE=64,lp64,LET=4,xplink,dynam=dll,case=mixed \
-I=CELQS003.x \
-o jn2\
  linkmods/CELQSTRT.o \
 linkmods/CEESTART.o \
 linkmods/CELQSG03.o \
 linkmods/CELQINPL.o \
 linkmods/CELQETBL.o \
 linkmods/CELQLLST.o \
 linkmods/CELQBST.o \
 linkmods/CELQTRM.o \
 jn2.o



  

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Silly C problem adding hex 6C

2018-02-08 Thread Seymour J Metz
Isn't pointer arithmetic in C scaled by the item size?


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Barkow, Eileen <ebar...@doitt.nyc.gov>
Sent: Thursday, 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).
 something gets added to the pointer but it is not 0x6c.
i tried all different combinations of char *; int *; void *; adding decimal 
108; but still get the same thing.

My little program correctly picks up the address of a valid ASCB (00FCAA00) 
from the PSA.
Now I just want to point to the address at 00FCAA6C which is a pointer to the 
ASXB which contains the jobname at offset 0XC0.

But somehow I cannot add 6C to the ASCB pointer FCAA00 and get the ASXB pointer 
at FCAA6C.
Instead I get FCABB0 (or some other address depending on which ASCB is 
obtained).
Can some C guru please tell me what I am doing wrong?

i will post the program and results - this is running on UNIX/OMVS.


 MVSZ MVSZ - Storage Contents : ACSCEXB -- (00FCAA00,,SQA) ---
 Command ===>  Scroll ===> PAG

 Address  Offset  0-1-2-3-  4-5-6-7-  8-9-A-B-  C-D-E-F-0---4---8---C---
 00FCAA00 +0  C1E2C3C2  00FBC100  00FCAB80    | ASCB..A...¿Ø |
 00FCAA10+10          |  |
 00FCAA20+20  02E4  0078  000100FF    | ...U.Ì.. |
 00FCAA30+30  7FF19E00    19A77000    | "1Æ..xø. |
 00FCAA40+40    00308F46  D3DC5674  8B346008  | ..±ãLüîÈ».-. |
 00FCAA50+50          |  |
 00FCAA60+60  00AFF158  8F80    00AFD000  | .®1ì..±Ø.®}. |
 00FCAA70+70  1D171020      00AFD520  | .®N. |
 00FCAA80+80      80AFFF98  4000  | Ø®.q ... |

 result running jn2
$ jn2
ASCB = FCAA00
ASXB =  FCABB0
$

jn2.c program

#define _XOPEN_SOURCE
#include 
#include 
#include 
#include 
#include 
#include 
int main(int argc, char *argv[])
 {
int *PSA;
int  *ASCB;
int  *ASXB;
char jobname[9];
PSA=(int *)0x224; /* address of PSAAOLD */
ASCB=(int *)*PSA;
printf("ASCB = %X\n",ASCB);
ASXB=ASCB+0x6c;
printf("ASXB =  %X\n",ASXB);
}

to compile:
c++ -+ -c -o jn2.o -I/u/eileen/j16/cons \
 -I/usr/lpp/java/J8.0_64/include \
 -W"c,lp64,dll,xplink,langlvl(longlong,nullptr)" jn2.c

to link:
c++ \
-W l,AMODE=64,lp64,LET=4,xplink,dynam=dll,case=mixed \
-I=CELQS003.x \
-o jn2\
  linkmods/CELQSTRT.o \
 linkmods/CEESTART.o \
 linkmods/CELQSG03.o \
 linkmods/CELQINPL.o \
 linkmods/CELQETBL.o \
 linkmods/CELQLLST.o \
 linkmods/CELQBST.o \
 linkmods/CELQTRM.o \
 jn2.o



  

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


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 char *; int *; void *; adding decimal 
108; but still get the same thing.

My little program correctly picks up the address of a valid ASCB (00FCAA00) 
from the PSA.
Now I just want to point to the address at 00FCAA6C which is a pointer to the 
ASXB which contains the jobname at offset 0XC0.

But somehow I cannot add 6C to the ASCB pointer FCAA00 and get the ASXB pointer 
at FCAA6C.
Instead I get FCABB0 (or some other address depending on which ASCB is 
obtained).
Can some C guru please tell me what I am doing wrong?

i will post the program and results - this is running on UNIX/OMVS.


 MVSZ MVSZ - Storage Contents : ACSCEXB -- (00FCAA00,,SQA) ---
 Command ===>  Scroll ===> PAG

 Address  Offset  0-1-2-3-  4-5-6-7-  8-9-A-B-  C-D-E-F-0---4---8---C---
 00FCAA00 +0  C1E2C3C2  00FBC100  00FCAB80    | ASCB..A...¿Ø |
 00FCAA10+10          |  |
 00FCAA20+20  02E4  0078  000100FF    | ...U.Ì.. |
 00FCAA30+30  7FF19E00    19A77000    | "1Æ..xø. |
 00FCAA40+40    00308F46  D3DC5674  8B346008  | ..±ãLüîÈ».-. |
 00FCAA50+50          |  |
 00FCAA60+60  00AFF158  8F80    00AFD000  | .®1ì..±Ø.®}. |
 00FCAA70+70  1D171020      00AFD520  | .®N. |
 00FCAA80+80      80AFFF98  4000  | Ø®.q ... |

 result running jn2
$ jn2
ASCB = FCAA00
ASXB =  FCABB0
$

jn2.c program

#define _XOPEN_SOURCE
#include 
#include 
#include 
#include 
#include 
#include 
int main(int argc, char *argv[])
 {
int *PSA;
int  *ASCB;
int  *ASXB;
char jobname[9];
PSA=(int *)0x224; /* address of PSAAOLD */
ASCB=(int *)*PSA;
printf("ASCB = %X\n",ASCB);
ASXB=ASCB+0x6c;
printf("ASXB =  %X\n",ASXB);
}

to compile:
c++ -+ -c -o jn2.o -I/u/eileen/j16/cons \
 -I/usr/lpp/java/J8.0_64/include \
 -W"c,lp64,dll,xplink,langlvl(longlong,nullptr)" jn2.c

to link:
c++ \
-W l,AMODE=64,lp64,LET=4,xplink,dynam=dll,case=mixed \
-I=CELQS003.x \
-o jn2\
  linkmods/CELQSTRT.o \
 linkmods/CEESTART.o \
 linkmods/CELQSG03.o \
 linkmods/CELQINPL.o \
 linkmods/CELQETBL.o \
 linkmods/CELQLLST.o \
 linkmods/CELQBST.o \
 linkmods/CELQTRM.o \
 jn2.o



  

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN