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=00000004
  TIME=10.40.43  SEQ=03238  CPU=0000  ASID=0031
  PSW AT TIME OF ERROR  078D0400   98A0011C  ILC 6  INTC 04
    ACTIVE LOAD MODULE           ADDRESS=18A00000  OFFSET=0000011C
    NAME=CTOASM
    DATA AT PSW  18A00116 - D203B0A4  D0804110  B09858F0
    GR 0: 000003B8   1: 00AC1C48
       2: 000173A8   3: 000107F0
       4: 800173C0   5: 80000000

          thanks Cristi

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Cristi Terpea
Sent: Friday, May 15, 2009 10:42 AM
To: [email protected]
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) {
>     int            Rc;
>     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] = 0xC1000000;
>     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   4        PARMS
> 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 DS    F        FUNCTION-CODE HEX'C1000000'
> PARM_DSN DS    F        ADDR OF DSN (44 BYTES)
> PARM_VOL DS    F        ADDR OF VOLSER (6 BYTES)
> PARM_WRK DS    F        ADDR 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 CEECAA,R12            COMMON ANCHOR AREA
>           USING CEEDSA,R13            DSA + LOCAL (DYNAM.) VARIABLES
>
*----------------------------------------------------------------------
> ,Command ===>,                                                ,Scroll
==
>           L     R4,0(R1)              LOAD ADDR OF PARMS
>           USING PARM,R4               ADDRESS PARMS
> *
>           OBTAIN PARM                 INVOKE OBTAIN
>           ST    R15,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
>           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 +
> 00000086 at entry offset +00000086 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:[email protected]] On
> Behalf Of Michael Knigge
> Sent: Thursday, May 14, 2009 4:47 PM
> To: [email protected]
> 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 [email protected] 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 [email protected] 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:  [email protected]
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 [email protected] 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 [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to