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 <[email protected]> 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:[email protected]] On > Behalf Of Barkow, Eileen > Sent: Friday, February 9, 2018 12:52 PM > To: [email protected] > 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:[email protected]] On > Behalf Of Seymour J Metz > Sent: Friday, February 09, 2018 3:26 PM > To: [email protected] > 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 <[email protected]> on behalf > of > Barkow, Eileen <[email protected]> > Sent: Friday, February 9, 2018 8:40 AM > To: [email protected] > 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:[email protected]] On > Behalf Of Kirk Wolf > Sent: Friday, February 09, 2018 7:58 AM > To: [email protected] > 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/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 <stdlib.h> > > #include <stdio.h> > > #include <string.h> > > #include <errno.h> > > > > 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 <stdlib.h> > >> #include <stdio.h> > >> #include <string.h> > >> #include <errno.h> > >> > >> 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 [email protected] with the message: INFO > IBM-MAIN > >>>> > >>>> > >>> > >> ---------------------------------------------------------------------- > >> For IBM-MAIN subscribe / signoff / archive access instructions, > >> send email to [email protected] with the message: INFO IBM-MAIN > >> > >> > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > > ________________________________ > > This e-mail, including any attachments, may be confidential, privileged or > otherwise legally protected. It is intended only for the addressee. If you > received this e-mail in error or from someone who was not authorized to > send > it to you, do not disseminate, copy or otherwise use this e-mail or its > attachments. Please notify the sender immediately by reply e-mail and > delete > the e-mail from your system. > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
