Skip to main content

Dears,

I built the following structure: A CICS program call a Cobol Native and Cobol Native call a Dll of C . In this situation I received a 114 signal 11 when execute the GOBACK command of Cobol Native.

If I run only Cobol Native calling C , execution goes fine;

If I run only CICS calling Cobol Native, execution goes fine;

CICS doesn't pass data to Cobol native (during these tests);

Somebody has some suggestion what I suppose to do?

Best Regards.

 

  


#CICS
#CallingC
#EnterpriseDeveloper

Dears,

I built the following structure: A CICS program call a Cobol Native and Cobol Native call a Dll of C . In this situation I received a 114 signal 11 when execute the GOBACK command of Cobol Native.

If I run only Cobol Native calling C , execution goes fine;

If I run only CICS calling Cobol Native, execution goes fine;

CICS doesn't pass data to Cobol native (during these tests);

Somebody has some suggestion what I suppose to do?

Best Regards.

 

  


#CICS
#CallingC
#EnterpriseDeveloper

Hi ,

This type of issue could be stack corruption. Do you know the call convention used in the C DLL ?

Try call convention 66.  

I would recommend creating a small example showing the issue and raising a support case so we can debug it in more detail.

Regards

David


Dears,

I built the following structure: A CICS program call a Cobol Native and Cobol Native call a Dll of C . In this situation I received a 114 signal 11 when execute the GOBACK command of Cobol Native.

If I run only Cobol Native calling C , execution goes fine;

If I run only CICS calling Cobol Native, execution goes fine;

CICS doesn't pass data to Cobol native (during these tests);

Somebody has some suggestion what I suppose to do?

Best Regards.

 

  


#CICS
#CallingC
#EnterpriseDeveloper

Hi, David.

The call convention is ok. I read about the DLL_CONVENTION to declare which C call convention is used. I tried to put this variable in run-time of properties project. Also in the code. But I couldn't produce difference between the methods. Look my example:

CICS: Example of project of Tutorial CICS. I put two calls: TEMPLATE and ECOSHSM

      IDENTIFICATION DIVISION.                                         06000000

      PROGRAM-ID. ACCT00.                                              12000000

     *

     *

     *  Copyright (C) Micro Focus 2013.

     *  All rights reserved.

     *

     *  This sample code is supplied for demonstration purposes only

     *  on an "as is" basis and "is for use at your own risk".

     *

     *

      ENVIRONMENT DIVISION.                                            48000000

      DATA DIVISION.

      WORKING-STORAGE SECTION.

        77  WS-ECOSHSM                    PIC X(008) VALUE 'ECOSHSM'.

        77  WS-TEMPLATE                   PIC X(008) VALUE 'TEMPLATE'.

        01  A222-REGISTRO.                                            

     * INPUT

          03   A222-LABEL                  PIC X(064).

          03   A222-EXPOENTE               PIC 9(005).

          03   A222-HASH                   PIC X(064).

          03   A222-MODULO                 PIC X(512).

     * OUTPUT

          03   A222-RETORNO                PIC 9(002).

          03   A222-MENSAGEM               PIC X(080).

      LINKAGE SECTION.

      01 DFHCOMMAREA.

       03 AREA01                           PIC 9(002).

       03 AREA02                           PIC X(080).

      PROCEDURE DIVISION.                                              60000000

      INITIAL-MAP.                                                     66000000

          EXEC CICS SEND

                    MAP('ACCTMNU')

                    MAPSET('ACCTSET') FREEKB                           72000000

                    ERASE MAPONLY

          END-EXEC.                                                    79000000

          CALL WS-TEMPLATE USING DFHEIBLK DFHCOMMAREA A222-REGISTRO.

          CALL WS-ECOSHSM USING DFHEIBLK DFHCOMMAREA A222-REGISTRO.

          EXEC CICS RETURN TRANSID('AC01') END-EXEC.

          GOBACK.                                                      93000000

This a TEMPLATE code. It works.

      IDENTIFICATION               DIVISION.

      PROGRAM-ID.                  TEMPLATE.

      ENVIRONMENT                  DIVISION.

      CONFIGURATION                SECTION.

      SPECIAL-NAMES.

      CALL-CONVENTION 66 IS API32.

      WORKING-STORAGE SECTION.

      77 urlBuffer                 PIC X(100).

      77 dwFlags                   PIC 9(9) COMP-5.

      77 dwReserved                PIC 9(9) COMP-5.

      77 dwResult                  PIC S9(9) COMP-5.

      77 visResult                 PIC -------9.

      PROCEDURE DIVISION.

      MAIN-LOGIC.

          STRING  "HTTP://WWW.ACUCORP.NO" DELIMITED BY SPACE

                  LOW-VALUES      DELIMITED BY SIZE

                  INTO            urlBuffer.

          MOVE    1               TO dwFlags.

          INITIALIZE              dwReserved

                                  dwResult.

          SET     ENVIRONMENT     "DLL-CONVENTION" TO "1".

          CALL    "WININET.DLL"

          CALL    "InternetCheckConnectionA" USING

                  BY REFERENCE    urlBuffer

                  BY VALUE        dwFlags

                  BY VALUE        dwReserved

                  GIVING          dwResult.

          MOVE    dwResult        TO visResult.

          CANCEL  "wininet.dll".

          EXIT    PARAGRAPH.

This code calls my dll. If I write it with cdecl call convention, it works. If I write with stdcall, doesn't work.

     *$set ans85 mf defaultbyte"00" case

      identification division.

      program-id. ECOSHSM.

      special-names.

          call-convention 66 is API32.

      data division.

      working-storage section.

      copy "Ecoscard.cpy".

      01  ws-rc-code              pic 9(008) comp-5.

      01  ws-DE55.

       03 ws-Field55              pic x(512).

       03 ws-LenField55           pic 9(004) comp-5.

       03 ws-pCVNout              pic x(002).

       03 filler                  pic x(001).

       03 ws-pATCout              pic x(004).

       03 filler                  pic x(001).

       03 ws-pUNout               pic x(008).

       03 filler                  pic x(001).

       03 ws-pPANSEQout           pic 9(002).

       03 filler                  pic x(001).

       03 ws-pARQCout             pic x(016).

       03 filler                  pic x(001).

       03 ws-pKDV                 pic x(002).

       03 filler                  pic x(001).

      77  ws-label                pic x(064).

      77  ws-pHandleSession       pic 9(008)  comp-5.

      77  ws-SlotID               pic 9(004)  comp-5.

      01  pointer-ECMCHPKC                USAGE PROCEDURE-POINTER.

      linkage section.

      copy dfheiblk.

      01 DFHCOMMAREA.

       03 AREA01                           PIC 9(002).

       03 AREA02                           PIC X(080).

        01  A222-REGISTRO.                                            

     * INPUT

          03   A222-LABEL                  PIC X(064).

          03   A222-EXPOENTE               PIC 9(005).

          03   A222-HASH                   PIC X(064).

          03   A222-MODULO                 PIC X(512).

     * OUTPUT

          03   A222-RETORNO                PIC 9(002).

          03   A222-MENSAGEM               PIC X(080).

      procedure division using dfheiblk dfhcommarea a222-registro.

     * procedure division.

          set environment "dll-convention" to "1".

     *

     ***** Iniciar DLL

     *

          call "ECMCHPKC.dll".

     *

     ***** Iniciar campos

     *

          string "9F02060000000000009F03060000000000009F1A0200769505"

                 "00000000005F2A0209869A031303049C01009F370401020304"

                 "820258009F360200169F10120210A00013220200F5A8000000"

                 "00000000FF9F3501209F2701809F260800A219B250E4D920"

              delimited by size  

              into ws-Field55

     *         with pointer ws-LenField55

          end-string.

     *

          move 198       to ws-LenField55.

          call API32 GetTagsFromDE55 using

               by reference ws-Field55    

               by value     ws-LenField55

               by reference ws-pCVNout    

               by reference ws-pATCout    

               by reference ws-pUNout    

               by reference ws-pPANSEQout

               by reference ws-pARQCout  

               by reference ws-pKDV      

               returning ws-rc-code

          end-call.

     *

     ***** HSM Start

     *

          call API32 EcosCardInitHSM using

               by reference

                  z"C:\\Program Files (x86)\\LunaSA\\cryptoki.dll"

               by reference

                  z"pr020425()"

               returning ws-rc-code

          end-call.

     *

     ***** HSM Open

     *

          move  1  to ws-SlotID.

          call API32 EcosCardOpenSessionHSM using

               by reference ws-pHandleSession

               by value     ws-SlotID

               returning ws-rc-code

          end-call.

     *

     ***** HSM Close

     *

          move  1  to ws-SlotID.

          call API32 EcosCardCloseSessionHSM using

               by value ws-pHandleSession

               returning ws-rc-code

          end-call.

     *

     ***** HSM Finish

     *

          call API32 z"EcosCardFinalizeHSM"

               returning ws-rc-code

          end-call.

      fim-pgm.

          cancel "ECMCHPKC.dll".

          goback.

Regards,

Marcelo.