Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-22 Thread Binyamin Dissen
On Thu, 21 May 2009 15:54:08 -0400 John Kington john.king...@convergys.com
wrote:

: well i finally figured out why my old copy of the Michaels code did not
: work and the new stuff he sent did.
: in one case the macros in the assembler code obtasm.s properly continued
: in column 16 and in the other improperly in column 17.
: But there were no assembly errors. Should not the CEENTRY macro have
: flagged an error if could not recognize the parms beginning with a
: blank? It must have just ignored the parms so the generated code got an
: 0c4 abend.
:If there is a blank in column 16 on a continuation line in a macro,
:everything is treated as a comment. Brings back memories of reading a vsam
:file backward because I could not figure out why I could not do a direct
:read against my ACB.

Nowadays I believe you get a warning about the trailing comma.

--
Binyamin Dissen bdis...@dissensoftware.com
http://www.dissensoftware.com

Director, Dissen Software, Bar  Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-21 Thread Barkow, Eileen
well i finally figured out why my old copy of the Michaels code did not
work and the new stuff he sent did.
in one case the macros in the assembler code obtasm.s properly continued
in column 16 and in the other improperly in column 17.
But there were no assembly errors. Should not the CEENTRY macro have
flagged an error if could not recognize the parms beginning with a
blank? It must have just ignored the parms so the generated code got an
0c4 abend.

good code:

OBTAIN   CEEENTRY PPA=MAINPPA,   ADRESSE AUF PROGRAM PROLOG AREA   X
   AUTO=WORKSIZE,GROESSE DER DSECT (- SAVEAREA!)  X
   NAB=NO,   NAB NICHT ZWINGEND VORHANDEN  X
   MAIN=NO,  KEIN HAUPTPROGRAMMX
   EXPORT=NO,ENTRYPOINT NICHT EXPORTIEREN  X
   BASE=R11  BASISREGISTER

bad code:

OBTAIN   CEEENTRY PPA=MAINPPA,   ADDR OF PROGRAM PROLOG AREA   X
AUTO=WORKSIZE,SIZE OF DSECT (- SAVEAREA!)
XX
NAB=NO,   NAB NOT USED
XX
MAIN=NO,  NO MAINPROG
XX
EXPORT=NO,DONT EXPORT ENTRYPOINT
XX

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Barkow, Eileen
Sent: Monday, May 18, 2009 3:50 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Micheal,  this new stuff you sent works!!
i have to compare them with the old files i was using.

 thanks again

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Monday, May 18, 2009 3:11 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Eileen,

I don't know what is happening at your site, but on our system 
everything runs fine.

I was able to compile and link the source and successfully do an OBTAIN 
for SYS1.PARMLIB on volume Z9RES1.

I'll attach once again my source and also the SYSOUT of the c++ so you

can compare your and my settings


Good luck!


Bye,
Michael


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-21 Thread John Kington
Eileen,

 well i finally figured out why my old copy of the Michaels code did not
 work and the new stuff he sent did.
 in one case the macros in the assembler code obtasm.s properly continued
 in column 16 and in the other improperly in column 17.
 But there were no assembly errors. Should not the CEENTRY macro have
 flagged an error if could not recognize the parms beginning with a
 blank? It must have just ignored the parms so the generated code got an
 0c4 abend.
If there is a blank in column 16 on a continuation line in a macro,
everything is treated as a comment. Brings back memories of reading a vsam
file backward because I could not figure out why I could not do a direct
read against my ACB.
Regards,
John

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-18 Thread Michael Knigge

Eileen,

I don't know what is happening at your site, but on our system 
everything runs fine.


I was able to compile and link the source and successfully do an OBTAIN 
for SYS1.PARMLIB on volume Z9RES1.


I'll attach once again my source and also the SYSOUT of the c++ so you 
can compare your and my settings



Good luck!


Bye,
Michael


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
*--
R0   EQU   0
R1   EQU   1
R2   EQU   2
R3   EQU   3
R4   EQU   4ADRESSIERUNG DER PARAMETER
R5   EQU   5
R6   EQU   6
R7   EQU   7
R8   EQU   8
R9   EQU   9
R10  EQU   10
R11  EQU   11   BASISREGISTER
R12  EQU   12   LE/370 COMMON ANCHOR AREA (CAA)
R13  EQU   13   LE/370 DYNAMIC SAVE AREA (DSA)
R14  EQU   14
R15  EQU   15
*--
PARM DSECT
PARM_FLG DSFFUNKTIONSCODE HEX'C100'
PARM_DSN DSFADRESSE AUF DSN (MUSS 44 BYTES LANG SEIN)
PARM_VOL DSFADRESSE AUF VOLSER (MUSS 6 BYTES LANG SEIN)
PARM_WRK DSFADRESSE AUF 140 BYTE WORK/RETURN-AREA
*--
*--
OBTAIN   CEEENTRY PPA=MAINPPA,   ADRESSE AUF PROGRAM PROLOG AREA   X
   AUTO=WORKSIZE,GROESSE DER DSECT (- SAVEAREA!)  X
   NAB=NO,   NAB NICHT ZWINGEND VORHANDEN  X
   MAIN=NO,  KEIN HAUPTPROGRAMMX
   EXPORT=NO,ENTRYPOINT NICHT EXPORTIEREN  X
   BASE=R11  BASISREGISTER
*
 USING CEECAA,R12COMMON ANCHOR AREA
 USING CEEDSA,R13DSA + LOKALE (DYNAM.) VARIABLEN
*--
 L R4,0(R1)  ADRESSE AUF PARAMETER LADEN
 USING PARM,R4   PARAMETER ADRESSIEREN
*
 OBTAIN PARM OBTAIN AUFRUFEN
 STR15,RETCODE   RETURNCODE SICHERN
*
 CEETERM RC=RETCODE
*--
MAINPPA  CEEPPA  PROGRAM PROLOG AREA
 LTORG
*--
 CEEDSA  DSECT: DYNAMIC SAVE AREA
RETCODE  DS  F   RETURNCODE
 DS  0D  ALIGNMENT SICHERSTELLEN
WORKSIZE EQU *-CEEDSA
*--
 CEECAA  DSECT: COMMON ANCHOR AREA
 CEEEDB  DSECT: ENCLAVE DATA BLOCK
*--
 END

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
//* c++ 
//COMPILE   EXEC  PGM=CCNDRVR,
//  PARM='POSIX(OFF) ABT(RETCODE) ENVAR(PDFDIR=./, __CBC_EXTENDED=9)/
//  ./ ./ctoasm.c *.c 
//  CMDOPTS(OE,NOLSEARCH,
//  START,LONGNAME,RENT,TERMINAL,
//  OBJECT(ctoasm.o),
//  HALT(16),NOMARGINS,NESTINC(255),NOSEQUENCE,NOSSCOM,
//  NOEVENTS,NOALIAS,TARGET(LE),NOEXPORTALL,
//  ARGPARSE,EXECOPS,PLIST(HOST),REDIR,
//  LOCALE(POSIX),
//  LANGLVL(ANSI),NOUPCONV,NOLIBANSI,ANSIALIAS,
//  NOINLINE(AUTO,NOREPORT,100,1000),MEMORY,MAXMEM(*),SPILL(128),
//  NODEBUG,NOTEST,NOGONUMBER,
//  NOLIST(/dev/fd1),NOSOURCE(/dev/fd1),
//  NOAGGREGATE,NOEXPMAC,NOOFFSET,NOSHOWINC,NOXREF,
//  NOINFO,FLAG(W),NOIPA),
//  DEFINE(errno=™™(*__errno™™(™™)™™)),
//  DEFINE(_OPEN_DEFAULT=1),
//  NOSEARCH,SEARCH(/usr/include/,
///usr/lpp/cbclib/include/,
////''CEE.SCEEH.+'',
////''CBC.SCLBH.+''),
//  NOPPONLY(NOCOMMENTS,NOLINES,/dev/fd1,2048),
//  OPTIMIZE(0)'
//*STEPLIB DD  DSN=CEE.SCEERUN,DISP=SHR
//*DD  DSN=CBC.SCCNCMP,DISP=SHR
//* c++ 
//ASSEMBLE  EXEC  PGM=ASMA90,
//  PARM='NODECK,OBJECT,TERM,
//  NOLIST,NOESD,NORLD,NOXREF,FLAG(4)'
//SYSLIB   DD  DSN='CEE.SCEEMAC',DISP=SHR,DCB=DSORG=DIR
// DD  DSN='SYS1.MACLIB',DISP=SHR,DCB=DSORG=DIR
// DD  DSN='SYS1.MODGEN',DISP=SHR,DCB=DSORG=DIR
//SYSPUNCH DD  DUMMY
//SYSUT1   DD  UNIT=SYSDA,SPACE=(32000,(30,30)),
// STORCLAS=,MGMTCLAS=,DATACLAS=,DSNTYPE=,
// DCB=(RECFM=F,LRECL=4088,BLKSIZE=4088)

Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-18 Thread Barkow, Eileen
Thanks alot Michael.

I am trying to compile and link the programs in batch but am running
into other problems, so you attachments will be a big help.

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Monday, May 18, 2009 3:11 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Eileen,

I don't know what is happening at your site, but on our system 
everything runs fine.

I was able to compile and link the source and successfully do an OBTAIN 
for SYS1.PARMLIB on volume Z9RES1.

I'll attach once again my source and also the SYSOUT of the c++ so you

can compare your and my settings


Good luck!


Bye,
Michael


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-18 Thread Michael Knigge

I am trying to compile and link the programs in batch but am running
into other problems, so you attachments will be a big help.


Well, I usually work under Batch I could send you my compile and 
link JCL complete with all options (for asm, compile and link) if you 
wish



Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-18 Thread Barkow, Eileen
Yes, please send the batch jobs.

as i said in my previous post, your programs now work under unix.

and thanks again Michael.

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Monday, May 18, 2009 3:47 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

 I am trying to compile and link the programs in batch but am running
 into other problems, so you attachments will be a big help.

Well, I usually work under Batch I could send you my compile and 
link JCL complete with all options (for asm, compile and link) if you 
wish


Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-15 Thread Barkow, Eileen
 point OBTAIN at compile unit
offset +
0086 at entry offset +0086 at
 address 18BEA116.
 LEAID ENTERED (LEVEL 04/01/2008 AT 12.32)
 LEAID PROCESSING COMPLETE. RC=0
[1] + Done(139) ctoasm
  83886348  Segmentation violation  ./ctoasm
$

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Thursday, May 14, 2009 4:47 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Barkow, Eileen schrieb:
 i tried to use the assembler code given in a previous post and got
about
 the same 0c4 abend i got using OBTAIN in c.
 can you give me a copy of the assembler code that worked.

The code posted is the code that works.

Give use your code (asm + c) and your compiler+asm+link options and I'll

compare them with mine... maybe we can see what is going wrong


Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-15 Thread Cristi Terpea
  CEEEDB  DSECT: ENCLAVE DATA BLOCK
  END

to compile: (get no errors)

c++ -v -o ctoasm   ctoasm.c   obtasm.s

when run:
$ ctoasm
CEE3204S The system detected a protection exception (System Completion
Code=0C4)
.
 From compile unit OBTAIN at entry point OBTAIN at compile unit
offset +
0086 at entry offset +0086 at
 address 18BEA116.
 LEAID ENTERED (LEVEL 04/01/2008 AT 12.32)
 LEAID PROCESSING COMPLETE. RC=0
[1] + Done(139) ctoasm
  83886348  Segmentation violation  ./ctoasm
$

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Thursday, May 14, 2009 4:47 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Barkow, Eileen schrieb:
  

i tried to use the assembler code given in a previous post and got


about
  

the same 0c4 abend i got using OBTAIN in c.
can you give me a copy of the assembler code that worked.



The code posted is the code that works.

Give use your code (asm + c) and your compiler+asm+link options and I'll

compare them with mine... maybe we can see what is going wrong


Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

  



--
Terpea Cristian
Senior Software Developer

Fortech SRL
Str. C-tin Brancoveanu nr. 6
Cluj-Napoca, 400467
Romania

Tel:+40 264 453 303
Fax:+40 264 438 217

Email:  cristian.ter...@fortech.ro
Web:www.fortech.ro


The information contained in this message is confidential and may be
legally privileged.The information transmitted is intended only for
the person or entity to which it is addressed and may contain
confidential and/or privileged material. If you are not the intended
recipient, you are hereby notified that any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon this information is strictly prohibited and may be unlawful.
If you received this in error, please contact the sender and delete
the material from any computer. Fortech SRL excludes the liability for
any damage which might result from this e-mail message.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-15 Thread Barkow, Eileen
I just added the work parm to see if it made any difference - but it did
not.
when i run the thing in batch with trap OFF and Nospie, i get a real 0c4
abend - i am going to get a system dump to see where the abend is - in
the c or asm module.

IEA995I SYMPTOM DUMP OUTPUT  710
 SYSTEM COMPLETION CODE=0C4  REASON CODE=0004
  TIME=10.40.43  SEQ=03238  CPU=  ASID=0031
  PSW AT TIME OF ERROR  078D0400   98A0011C  ILC 6  INTC 04
ACTIVE LOAD MODULE   ADDRESS=18A0  OFFSET=011C
NAME=CTOASM
DATA AT PSW  18A00116 - D203B0A4  D0804110  B09858F0
GR 0: 03B8   1: 00AC1C48
   2: 000173A8   3: 000107F0
   4: 800173C0   5: 8000

  thanks Cristi

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Cristi Terpea
Sent: Friday, May 15, 2009 10:42 AM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Hey,

One quick look, you're calling call_obtain with 3 arguments.. although
it's got only two. Another thing, don't bother setting 44 spaces, this
will be done in call_obtain.

int   main()
{
call_obtain(DATASET,VOLUME);
}

Best regards,
Cristi Terpea


Barkow, Eileen wrote:
 here goes - the c program (cotasm.c) was also copied from a post (i
 think Crista's) and added the main section.
 i thought i knew a little C from studying Microsoft's c# for Windows,
 but when i look at c, c++ on the mainframe I know next to nothing - c#
 is completely different. That is why i got interested in this topic.

 actually, i get the same type of abend (segmentation violation) trying
 to run some of the jni examples i have found (using c and java),
 although some do work and others abend. and the abends happen when
 running both batch and under OMVS. i have not yet looked up what the
 segmentation violation abend means.


 ctoasm.c

 int OBTAIN(unsigned long[]);

 #pragma linkage(OBTAIN, OS)

 #pragma pack(1) /* 1 byte alignment */
 typedef struct
 {
 char   Ds1FmtId;
 char   Ds1Dssn[6];
 unsigned short Ds1VolSq;
 char   Ds1CreDt[3];
 char   Ds1ExpDt[3];
 unsigned char  Ds1NoEpv;
 unsigned char  Ds1NoBdb;
 unsigned char  Ds1Flag1;
 char   Ds1SysCd[13];
 char   Ds1RefDt[3];
 unsigned char  Ds1SmsFg;
 unsigned char  Ds1ScXft;
 unsigned short Ds1ScXtv;
 unsigned char  Ds1DsOrg[2];
 unsigned char  Ds1RecFm;
 unsigned char  Ds1OptCd;
 unsigned short Ds1BlkL;
 unsigned short Ds1LrecL;
 unsigned char  Ds1KeyL;
 unsigned short Ds1Rkp;
 unsigned char  Ds1DsInd;
 unsigned char  Ds1ScAl1;
 unsigned char  Ds1ScAl3[3];
 unsigned char  Ds1LstAr[3];
 unsigned short Ds1TrBal;
 unsigned char  Reserved;
 unsigned char  Ds1Tthi;
 unsigned char  Ds1Ext1[10];
 unsigned char  Ds1Ext2[10];
 unsigned char  Ds1Ext3[10];
 unsigned char  Ds1PtrDs[5];
 char   Filler[44];
 } DSCB;
 #pragma pack() /* default alignment */


 int call_obtain(char *Dsn, char *VolSer) {
 intRc;
 unsigned long  Parm[4];
 char   ParmDsn[44];
 char   ParmVolSer[6];
 DSCB   Dscb;

 memset(ParmDsn, ' ', 44);
 memcpy(ParmDsn, Dsn, strlen(Dsn));
 memset(ParmVolSer, ' ', 6);
 memcpy(ParmVolSer, VolSer, strlen(VolSer)); /*should be 6
always!*/

 Parm[0] = 0xC100;
 Parm[1] = (unsigned long) ParmDsn;
 Parm[2] = (unsigned long) ParmVolSer;
 Parm[3] = (unsigned long) Dscb;

 if((Rc = OBTAIN(Parm[0])) != 0)
return(Rc);

 /* do something with DSCB */
 return(0);
 }
int   main()
 {
 char dsname[44], volume[6];
  memset(dsname,' ',44);
 ,Command ===,
  memcpy(dsname, XCICS.EILEEN.PDSE, 17);
  memset(volume,' ', 6);
  memcpy(volume, CICH92, 6);
  memset(work,' ',140);
 call_obtain(dsname,volume,work);
   }

 **assembler program obtasm.s

 * Top of Data *
 *
 R0   EQU   0
 R1   EQU   1
 R2   EQU   2
 R3   EQU   3
 R4   EQU   4PARMS
 R5   EQU   5
 R6   EQU   6
 R7   EQU   7
 R8   EQU   8
 R9   EQU   9
 R10  EQU   10
 R11  EQU   11   BASE
 R12  EQU   12   LE/370 COMMON ANCHOR AREA (CAA)
 R13  EQU   13   LE/370 DYNAMIC SAVE AREA (DSA)
 R14  EQU   14
 R15  EQU   15
 *
 PARM DSECT
 PARM_FLG DSFFUNCTION-CODE HEX'C100'
 PARM_DSN DSFADDR OF DSN (44 BYTES)
 PARM_VOL DSFADDR OF VOLSER (6 BYTES)
 PARM_WRK DSFADDR OF 140 BYTE WORK/RETURN-AREA
 *
 *
 OBTAIN   CEEENTRY PPA=MAINPPA,   ADDR OF PROGRAM PROLOG AREA
X
 AUTO=WORKSIZE,SIZE OF DSECT (- SAVEAREA!)
 XX
 NAB=NO,   NAB NOT USED
 XX
 MAIN=NO,  NO MAINPROG
 XX
 EXPORT=NO,DONT EXPORT ENTRYPOINT
 XX
 BASE=R11  BASE
 *
   USING

Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-15 Thread Michael Knigge

Hi,


but when i look at c, c++ on the mainframe I know next to nothing - c#
is completely different. That is why i got interested in this topic.


Well, C# ist more like Java as C or C++




although some do work and others abend. and the abends happen when
running both batch and under OMVS. i have not yet looked up what the
segmentation violation abend means.


segmentation violation is a S0C4.




   int   main()
{
char dsname[44], volume[6];
 memset(dsname,' ',44);
,Command ===,
 memcpy(dsname, XCICS.EILEEN.PDSE, 17);
 memset(volume,' ', 6);
 memcpy(volume, CICH92, 6);
 memset(work,' ',140);
call_obtain(dsname,volume,work);


Try

call_obtain(XCICS.EILEEN.PDSE, CICH92);

and remove the stuff above...




Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-15 Thread Barkow, Eileen
I removed all the stuff and got the same abend at the same offset, which
appears to be in the c module.
i have to get the load map, or maybe compile in batch but the jcl
generated with -v gives so many parms that it is hard to copy over for
batch run.
i just copied the hfs module into a pdse and executed it, which i think
is okay to do.

thanks for looking at this Michael. 

 int   main()
  {
  call_obtain(XCICS.EILEEN.PDSE, CICH92);
 /*char dsname[44], volume[6]; */
 /* memset(dsname,' ',44); */
 /* memcpy(dsname, XCICS.EILEEN.PDSE, 17); */
 /* memset(volume,' ', 6); */
 /* memcpy(volume, CICH92, 6); */
/* call_obtain(dsname,volume); */
 }

IEA995I SYMPTOM DUMP OUTPUT  311
 SYSTEM COMPLETION CODE=0C4  REASON CODE=0004
  TIME=11.57.15  SEQ=03253  CPU=  ASID=0031
  PSW AT TIME OF ERROR  078D0400   98A0011C  ILC 6  INTC 04
ACTIVE LOAD MODULE   ADDRESS=18A0  OFFSET=011C
NAME=CTOASM
DATA AT PSW  18A00116 - D203B0A4  D0804110  B09858F0
GR 0: 03B8   1: 00AC1C48
   2: 00017368   3: 000107F0
   4: 80017380   5: 8000
   6: 0001   7: 98F8AA3A
   8: 0030   9: 8000

-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Michael Knigge
Sent: Friday, May 15, 2009 11:46 AM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Hi,

 but when i look at c, c++ on the mainframe I know next to nothing - c#
 is completely different. That is why i got interested in this topic.

Well, C# ist more like Java as C or C++



 although some do work and others abend. and the abends happen when
 running both batch and under OMVS. i have not yet looked up what the
 segmentation violation abend means.

segmentation violation is a S0C4.



int   main()
 {
 char dsname[44], volume[6];
  memset(dsname,' ',44);
 ,Command ===,
  memcpy(dsname, XCICS.EILEEN.PDSE, 17);
  memset(volume,' ', 6);
  memcpy(volume, CICH92, 6);
  memset(work,' ',140);
 call_obtain(dsname,volume,work);

Try

call_obtain(XCICS.EILEEN.PDSE, CICH92);

and remove the stuff above...




Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Cristi Terpea
But when I compile, the C compiler is looking for the OBTAIN symbol. Where
do I need to put the asm routine to be found by the compiler?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Hunkeler Peter (KIUK 3)
But when I compile, the C compiler is looking for the OBTAIN symbol. 
Where do I need to put the asm routine to be found by the compiler?

Assuming the assembler code is in file obtain.s and your
C++ code is in file mainprog.c then

   c++ -o mainprog mainprog.C obtain.s

will invoke the C/C++ compiler to compile mainprog.C into
mainprog.o, will then invoke the assembler to assemble obtain.s 
into obtain.o and will finally link mainprog.o and obtain.o into
load module mainprog.

Out of curiosity: What do you want to accomplish reading DSCBs?

-- 
Peter Hunkeler
CREDIT SUISSE

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Cristi Terpea
Thanks. It worked.
I'm trying to reproduce the output of ftp's ls command

Best regards,
Cristi Terpea

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Cristi Terpea
Thanks for the code.
It worked like a charm.

Best regards,
Cristi Terpea

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Kirk Wolf
Cristi -

You might want to use our free catsearch command, which is included with
the Co:Z toolkit. It combines IGGCSI00 (catalog search) with reading the
dataset DSCBs.  For example:

/home/g1java1 catsearch -l g1java1.private.cookbook.**

Volume  Referred  Ext  TracksUsed Recfm Lrecl BlkSz Dsorg  Dsname
PRV002 2009/04/19   1 150   2  VB1020 27920  PO
 G1JAVA1.PRIVATE.COOKBOOK.COBADATA
PRV001 2009/04/20   1 150   1  FB  80  6160  PO
 G1JAVA1.PRIVATE.COOKBOOK.COBOL
 VS
 G1JAVA1.PRIVATE.COOKBOOK.INVEN.KSDS
PRV001 2009/04/19   1  15   ?  U0 0  VS
 G1JAVA1.PRIVATE.COOKBOOK.INVEN.KSDS.DATA
PRV001  1  15   ?  U0 0  VS
 G1JAVA1.PRIVATE.COOKBOOK.INVEN.KSDS.INDEX
 VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.ESDS
PRV002 2009/04/19   1  15   ?  U0 0  VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.ESDS.DATA
 VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.AIX
PRV003 2009/04/19   1  15   ?  U0 0  VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.AIX.DATA
PRV003  1  15   ?  U0 0  VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.AIX.INDEX
 VS
 G1JAVA1.PRIVATE.COOKBOOK.INVHIST.PATH
PRV002 2009/04/20   1 150   2  FB  80  6160  PO
 G1JAVA1.PRIVATE.COOKBOOK.JCL
PRV001 2009/04/19   1  15   1  VB 166  6144  PS
 G1JAVA1.PRIVATE.COOKBOOK.TRANSREC

There is also a -t option, which causes the output to be formatted with
tab delimiters between each field, which is easy to parse from a calling
program or shell script.  For more information:
http://dovetail.com/docs/coz/dsp-ref_catsearch.html

Kirk Wolf
Dovetailed Technologies

On Thu, May 14, 2009 at 3:16 AM, Cristi Terpea cristi.ter...@fortech.ro
wrote:
 Thanks. It worked.
 I'm trying to reproduce the output of ftp's ls command

 Best regards,
 Cristi Terpea

 --
 For IBM-MAIN subscribe / signoff / archive access instructions,
 send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
 Search the archives at http://bama.ua.edu/archives/ibm-main.html


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread John McKown
On Thu, 14 May 2009 08:59:46 -0500, Kirk Wolf k...@dovetail.com wrote:

Cristi -

You might want to use our free catsearch command, which is included with
the Co:Z toolkit. It combines IGGCSI00 (catalog search) with reading the
dataset DSCBs.  For example:

/home/g1java1 catsearch -l g1java1.private.cookbook.**


Kirk,

Have you considered a companion command, perhaps called dasdlist, which
would output the same type of information, but you give it a volume name or
volume name pattern instead of a catalog name?

dasdlist -v TSO*

would list all the datasets on all on-line volumes which start with TSO... .

Just a weird idea.

--

John

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Barkow, Eileen
i tried to use the assembler code given in a previous post and got about
the same 0c4 abend i got using OBTAIN in c.
can you give me a copy of the assembler code that worked.

the code i used started with:
*
R0   EQU   0
R1   EQU   1
R2   EQU   2
R3   EQU   3
R4   EQU   4PARMS
R5   EQU   5
R6   EQU   6
R7   EQU   7
R8   EQU   8
R9   EQU   9
R10  EQU   10
R11  EQU   11   BASE
R12  EQU   12   LE/370 COMMON ANCHOR AREA (CAA)
R13  EQU   13   LE/370 DYNAMIC SAVE AREA (DSA)

 thanks


-Original Message-
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Cristi Terpea
Sent: Thursday, May 14, 2009 4:20 AM
To: IBM-MAIN@bama.ua.edu
Subject: Re: C/C++ Calling OBTAIN / IGC0002G

Thanks for the code.
It worked like a charm.

Best regards,
Cristi Terpea

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-14 Thread Kirk Wolf
John,

We haven't, but it sounds like a good idea.

On Thu, May 14, 2009 at 9:16 AM, John McKown joa...@swbell.net wrote:

 On Thu, 14 May 2009 08:59:46 -0500, Kirk Wolf k...@dovetail.com wrote:

 Cristi -
 
 You might want to use our free catsearch command, which is included with
 the Co:Z toolkit. It combines IGGCSI00 (catalog search) with reading the
 dataset DSCBs.  For example:
 
 /home/g1java1 catsearch -l g1java1.private.cookbook.**
 

 Kirk,

 Have you considered a companion command, perhaps called dasdlist, which
 would output the same type of information, but you give it a volume name or
 volume name pattern instead of a catalog name?

 dasdlist -v TSO*

 would list all the datasets on all on-line volumes which start with TSO...
 .

 Just a weird idea.

 --

 John

 --
 For IBM-MAIN subscribe / signoff / archive access instructions,
 send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
 Search the archives at http://bama.ua.edu/archives/ibm-main.html


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Cristi Terpea
I'm trying to call OBTAIN by fetching IGC0002G and executing but keep
getting errors.
This is the code I'm using:

int main (int argc, char *argv[]) {

typedef int OBTAIN(char* ,char*, char*);
#pragma linkage(OBTAIN, OS)
OBTAIN *OBTAIN_FN;
char dsname[44], volume[6];
char search_work_area[140];
int rc = -1;

memset(dsname,' ',44);
memcpy(dsname, IBMUSER.TESTUP, 14);
memset(volume,' ', 6);
memcpy(volume, S6SYS1, 6);
memset(search_work_area, 0, 140);

OBTAIN_FN = (OBTAIN *) fetch(IGC0002G);
printf(Fetched %x\n, OBTAIN_FN);
rc = OBTAIN_FN(dsname, volume, search_work_area);

printf(Result: %d\n, rc);
return 0;
}

Fetched 1163fd00
Segmentation fault

and the error I'm getting:

CEE3204S The system detected a protection exception (System Completion
Code=0C4).
 From entry point main at compile unit offset +0150 at entry
offset +0150 at address 11608A68.
CEE3204S The system detected a protection exception (System Completion
Code=0C4).
 From entry point main at compile unit offset +0150 at entry
offset +0150 at address 11608A68.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Miklos Szigetvari

Hi

I think you got this not in OBTAIN , but memcpy as dsname already a pointer.
If I correct this:
- I got the Fetched message
- a S0C2 i(priv op exception) in OBTAIN

Cristi Terpea wrote:


I'm trying to call OBTAIN by fetching IGC0002G and executing but keep
getting errors.
This is the code I'm using:

int main (int argc, char *argv[]) {

typedef int OBTAIN(char* ,char*, char*);
#pragma linkage(OBTAIN, OS)
   OBTAIN *OBTAIN_FN;
   char dsname[44], volume[6];
   char search_work_area[140];
   int rc = -1;

   memset(dsname,' ',44);
   memcpy(dsname, IBMUSER.TESTUP, 14);
   memset(volume,' ', 6);
   memcpy(volume, S6SYS1, 6);
   memset(search_work_area, 0, 140);

   OBTAIN_FN = (OBTAIN *) fetch(IGC0002G);
   printf(Fetched %x\n, OBTAIN_FN);
   rc = OBTAIN_FN(dsname, volume, search_work_area);

   printf(Result: %d\n, rc);
   return 0;
}

Fetched 1163fd00
Segmentation fault

and the error I'm getting:

CEE3204S The system detected a protection exception (System Completion
Code=0C4).
From entry point main at compile unit offset +0150 at entry
offset +0150 at address 11608A68.
CEE3204S The system detected a protection exception (System Completion
Code=0C4).
From entry point main at compile unit offset +0150 at entry
offset +0150 at address 11608A68.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


 



--
Miklos Szigetvari

Development Team
ISIS Information Systems Gmbh 
tel: (+43) 2236 27551 570
Fax: (+43) 2236 21081 

E-mail: miklos.szigetv...@isis-papyrus.com 

Info: i...@isis-papyrus.com 
Hotline: +43-2236-27551-111 

Visit our Website: http://www.isis-papyrus.com 
---

This e-mail is only intended for the recipient and not legally
binding. Unauthorised use, publication, reproduction or
disclosure of the content of this e-mail is not permitted.
This email has been checked for known viruses, but ISIS accepts
no responsibility for malicious or inappropriate content.
--- 


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Hunkeler Peter (KIUK 3)
That's an SVC routine which can only be invoked using
an SVC machine instruction. You can't CALL it.

--
Peter Hunkeler
CREDIT SUISSE

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Binyamin Dissen
On Wed, 13 May 2009 05:17:54 -0500 Cristi Terpea cristi.ter...@fortech.ro
wrote:

:I'm trying to call OBTAIN by fetching IGC0002G and executing but keep
:getting errors.
:This is the code I'm using:
:
:int main (int argc, char *argv[]) {
:
:typedef int OBTAIN(char* ,char*, char*);
:#pragma linkage(OBTAIN, OS)
:OBTAIN *OBTAIN_FN;
:char dsname[44], volume[6];
:char search_work_area[140];
:int rc = -1;
:
:memset(dsname,' ',44);
:memcpy(dsname, IBMUSER.TESTUP, 14);
:memset(volume,' ', 6);
:memcpy(volume, S6SYS1, 6);
:memset(search_work_area, 0, 140);
:
:OBTAIN_FN = (OBTAIN *) fetch(IGC0002G);
:printf(Fetched %x\n, OBTAIN_FN);
:rc = OBTAIN_FN(dsname, volume, search_work_area);
:
:printf(Result: %d\n, rc);
:return 0;
:}
:
:Fetched 1163fd00
:Segmentation fault
:
:and the error I'm getting:
:
:CEE3204S The system detected a protection exception (System Completion
:Code=0C4).
: From entry point main at compile unit offset +0150 at entry
:offset +0150 at address 11608A68.
:CEE3204S The system detected a protection exception (System Completion
:Code=0C4).
: From entry point main at compile unit offset +0150 at entry
:offset +0150 at address 11608A68.

Not at all an expert on C, but OBTAIN cannot be called directly. It must be
invoked via an SVC instruction.

--
Binyamin Dissen bdis...@dissensoftware.com
http://www.dissensoftware.com

Director, Dissen Software, Bar  Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Cristi Terpea
I tried using assembly code (
https://ls2.cmich.edu/cgi-bin/wa?A2=ind9806L=C370-LP=968 ) to call it but
still I get a protection exception.

I tested with:

void main() {
SVC_REGISTER *r15 = NULL, *r00 = NULL, *r01;
char dsname[44] = IBMUSER.TESTUP;
char volume[6] = S6SYS1;
r01 = malloc(16);
memset(r01, 0, 16);
memcpy(r01, \xc1\x00, 2);
r01 += 4;
r01 = (unsigned int*)dsname;
r01 += 4;
r01 = (unsigned int*)volume;
r01 += 4;
r01 = malloc(140);
CCasvc(27, r15, r00, r01);
}

What am I doing wrong?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Walt Farrell
On Wed, 13 May 2009 08:06:03 -0500, Cristi Terpea cristi.ter...@fortech.ro
wrote:

I tried using assembly code (
https://ls2.cmich.edu/cgi-bin/wa?A2=ind9806L=C370-LP=968 ) to call it but
still I get a protection exception.

I tested with:

void main() {
SVC_REGISTER *r15 = NULL, *r00 = NULL, *r01;
char dsname[44] = IBMUSER.TESTUP;
char volume[6] = S6SYS1;
r01 = malloc(16);
memset(r01, 0, 16);
memcpy(r01, \xc1\x00, 2);
r01 += 4;
r01 = (unsigned int*)dsname;
r01 += 4;
r01 = (unsigned int*)volume;
r01 += 4;
r01 = malloc(140);
CCasvc(27, r15, r00, r01);
}

What am I doing wrong?

I'm not completely sure, as I've never tried this in C/C++, but in part I
think your problem is that you've lost the original value of r01 (from that
malloc(16) call), which is what you need to pass to the OBTAIN SVC.  

Why don't you simply call an assembler subroutine and have it do an OBTAIN?
 Building SVC parameter lists by hand is both complex and very error-prone.

-- 
  Walt Farrell, CISSP
  IBM STSM, z/OS Security Design

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Michael Knigge

Cristi Terpea schrieb:

What am I doing wrong?


I really don't know ;)  But why don't you use a little ASM routine?

*
R0   EQU   0
R1   EQU   1
R2   EQU   2
R3   EQU   3
R4   EQU   4PARMS
R5   EQU   5
R6   EQU   6
R7   EQU   7
R8   EQU   8
R9   EQU   9
R10  EQU   10
R11  EQU   11   BASE
R12  EQU   12   LE/370 COMMON ANCHOR AREA (CAA)
R13  EQU   13   LE/370 DYNAMIC SAVE AREA (DSA)
R14  EQU   14
R15  EQU   15
*
PARM DSECT
PARM_FLG DSFFUNCTION-CODE HEX'C100'
PARM_DSN DSFADDR OF DSN (44 BYTES)
PARM_VOL DSFADDR OF VOLSER (6 BYTES)
PARM_WRK DSFADDR OF 140 BYTE WORK/RETURN-AREA
*
*
OBTAIN   CEEENTRY PPA=MAINPPA,   ADDR OF PROGRAM PROLOG AREA   X
   AUTO=WORKSIZE,SIZE OF DSECT (- SAVEAREA!)  X
   NAB=NO,   NAB NOT USED  X
   MAIN=NO,  NO MAINPROG   X
   EXPORT=NO,DONT EXPORT ENTRYPOINTX
   BASE=R11  BASE
*
 USING CEECAA,R12COMMON ANCHOR AREA
 USING CEEDSA,R13DSA + LOCAL (DYNAM.) VARIABLES
*--
 L R4,0(R1)  LOAD ADDR OF PARMS
 USING PARM,R4   ADDRESS PARMS
*
 OBTAIN PARM INVOKE OBTAIN
 STR15,RETCODE   SAVE RC
*
 CEETERM RC=RETCODE
*--
MAINPPA  CEEPPA  PROGRAM PROLOG AREA
 LTORG
*--
 CEEDSA  DSECT: DYNAMIC SAVE AREA
RETCODE  DS  F   RETURNCODE
 DS  0D  ENSURE ALIGNMENT!!!
WORKSIZE EQU *-CEEDSA
*--
 CEECAA  DSECT: COMMON ANCHOR AREA
 CEEEDB  DSECT: ENCLAVE DATA BLOCK
*--




So... now you can invoke OBTAIN from C by

int OBTAIN(unsigned long[]);

#pragma linkage(OBTAIN, OS)

#pragma pack(1) /* 1 byte alignment */
typedef struct
{
   char   Ds1FmtId;
   char   Ds1Dssn[6];
   unsigned short Ds1VolSq;
   char   Ds1CreDt[3];
   char   Ds1ExpDt[3];
   unsigned char  Ds1NoEpv;
   unsigned char  Ds1NoBdb;
   unsigned char  Ds1Flag1;
   char   Ds1SysCd[13];
   char   Ds1RefDt[3];
   unsigned char  Ds1SmsFg;
   unsigned char  Ds1ScXft;
   unsigned short Ds1ScXtv;
   unsigned char  Ds1DsOrg[2];
   unsigned char  Ds1RecFm;
   unsigned char  Ds1OptCd;
   unsigned short Ds1BlkL;
   unsigned short Ds1LrecL;
   unsigned char  Ds1KeyL;
   unsigned short Ds1Rkp;
   unsigned char  Ds1DsInd;
   unsigned char  Ds1ScAl1;
   unsigned char  Ds1ScAl3[3];
   unsigned char  Ds1LstAr[3];
   unsigned short Ds1TrBal;
   unsigned char  Reserved;
   unsigned char  Ds1Tthi;
   unsigned char  Ds1Ext1[10];
   unsigned char  Ds1Ext2[10];
   unsigned char  Ds1Ext3[10];
   unsigned char  Ds1PtrDs[5];
   char   Filler[44];
} DSCB;
#pragma pack() /* default alignment */


int call_obtain(char *Dsn, char *VolSer)
{
   intRc;
   unsigned long  Parm[4];
   char   ParmDsn[44];
   char   ParmVolSer[6];
   DSCB   Dscb;

   memset(ParmDsn, ' ', 44);
   memcpy(ParmDsn, Dsn, strlen(Dsn));

   memset(ParmVolSer, ' ', 6);
   memcpy(ParmVolSer, VolSer, strlen(VolSer)); /should be 6 always!

   Parm[0] = 0xC100;
   Parm[1] = (unsigned long) ParmDsn;
   Parm[2] = (unsigned long) ParmVolSer;
   Parm[3] = (unsigned long) Dscb;

   if((Rc = OBTAIN(Parm[0])) != 0)
  return(Rc);

   // do something with DSCB
   return(0);
}



This is how it works for me in a multithreaded application written in C...


Bye,
Michael

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Cristi Terpea
I don't want to compile also the asm routine on the target machine. It would
be great to have one executable (is it possible to link statically the asm
object with the C object?).
I also searched this area, but couldn't find an easy way to compile asm and
how to link C and asm.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Walt Farrell
On Wed, 13 May 2009 10:09:40 -0500, Cristi Terpea cristi.ter...@fortech.ro
wrote:

I don't want to compile also the asm routine on the target machine. It would
be great to have one executable (is it possible to link statically the asm
object with the C object?).
I also searched this area, but couldn't find an easy way to compile asm and
how to link C and asm.

You don't need to compile the assembler routine on the target machine, as
far as I know.  The assembler routine should be compatible with any release
of the system.

-- 
  Walt

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: C/C++ Calling OBTAIN / IGC0002G

2009-05-13 Thread Steve Comstock

Cristi Terpea wrote:

I don't want to compile also the asm routine on the target machine. It would
be great to have one executable (is it possible to link statically the asm
object with the C object?).
I also searched this area, but couldn't find an easy way to compile asm and
how to link C and asm.


Yes, of course it is possible to link statically.

Sounds like you could use our course Secrets of Inter-Language
Communication in z/OS. Currently we have a 3.5 day version that
includes DLLs. I'm thinking of creating a two-day version that
would not include the DLL part. The current course covers four
languages (Assembler, COBOL, PL/I, and C), although the students
decide which languages to include in lecture and labs (this
could actually be done with a single language). Anyway, the
discussion covers, for all selected languages:


* How to define elementary data items
  - classic fields
  - null terminated strings
* How to define structures and arrays
* Ways to access the JCL PARM value
* Static calls and function references
* Passing arguments (by reference, by value, by content)
* Receiving parameters (by reference, by content)
* How to code and check for optional parameters
* Object code formats and the program binder
* How to code and use alternate entry points
* How to code and use shared external data
* Dynamic calls
* DLL calls

 and more!

For details, see:

  http://www.trainersfriend.com/Language_Environment_courses/m520descr.htm

this page includes links to even more details: course
objectives, and detailed topical outline

I see from your email address you are in Romania. We
would love to come and teach there! If that's of
interest, contact me off list.


Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
* Our classes include
   + How things work
   + Programming examples with realistic applications
   + Starter / skeleton code
   + Complete working programs
   + Useful utilities and subroutines
   + Tips and techniques

== Check out the Trainer's Friend Store to purchase z/OS  ==
== application developer toolkits. Sample code in four==
== programming languages, JCL to Assemble or compile, ==
== bind and test. ==
==   http://www.trainersfriend.com/TTFStore/index.html==

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html