Re: Problems sending structure to c

From: Cristian Ferrero (cferrero.edesal_at_emdersa.com.ar)
Date: 03/22/04

  • Next message: sb: "Re: Deploying over IIS and VB"
    Date: 22 Mar 2004 10:29:10 -0800
    
    

    cferrero.edesal@emdersa.com.ar (Cristian Ferrero) wrote in message news:<3b9a5e6f.0403220603.1bed1fa9@posting.google.com>...
    > I have problems trying to send a structure as parameter from cobol to c
    > Cobol version is Microfocus Server Express 2.0 revision 011
    >
    > Example :
    >
    > ---------------- Cobol -----------------------
    >
    > WORKING-STORAGE SECTION.
    > 01 LINK-VARIABLES.
    > 05 LNK-CHA1 PIC X(16) VALUE ALL X"00".
    > 05 FILLER PIC X(1) VALUE X"00".
    > 05 LNK-CHA2 PIC X(16) VALUE ALL X"00".
    > 05 FILLER PIC X(1) VALUE X"00".
    > 05 LNK-ENT PIC S9(9) COMP-5.
    >
    > PROCEDURE DIVISION.
    >
    > INICIO.
    > MOVE 333333 TO LNK-ENT.
    > MOVE 'AAAAAAAAAAAAAAAA' TO LNK-CHA1.
    > MOVE 'BBBBBBBBBBBBBBBB' TO LNK-CHA2.
    >
    > CALL 'ruti' USING LINK-VARIABLES.
    >
    > STOP RUN.
    >
    > ---------------- C -----------------------
    > #include <stdio.h>
    > typedef struct {
    > char str1[17];
    > char str2[17];
    > long num1;
    > } estru;
    > void ruti(estru *est) {
    > printf("NUM1 %d \n", est->num1);
    > printf("STR1 %s \n", est->str1);
    > printf("STR2 %s \n", est->str2);
    > }
    >
    > ---------------- Output -----------------------
    > NUM1 370483232
    > STR1 AAAAAAAAAAAAAAAA
    > STR2 BBBBBBBBBBBBBBBB
    >
    > As you can see value from NUM1 is not the real value (333333)

            Michael ,we are in serious troubles because we are in the middle of
    an implementation and this is a serious problem.
            The example i gave to you works fine in OBJECT COBOL 4.1 , and we
    have all our programs like that, now we are trying to move to
    Microfocus Server Express 2.0 , and the example works only if we move
    the numeric value before the string like this :
    WORKING-STORAGE SECTION.
     01 LINK-VARIABLES.
                05 LNK-ENT PIC S9(9) COMP-5.
              05 LNK-CHA1 PIC X(16) VALUE ALL
    X"00".
              05 FILLER PIC X(1) VALUE X"00".
              05 LNK-CHA2 PIC X(16) VALUE ALL
    X"00".
              05 FILLER PIC X(1) VALUE X"00".
              
           PROCEDURE DIVISION.

           INICIO.
               MOVE 333333 TO LNK-ENT.
               MOVE 'AAAAAAAAAAAAAAAA' TO LNK-CHA1.
               MOVE 'BBBBBBBBBBBBBBBB' TO LNK-CHA2.

               CALL 'ruti' USING LINK-VARIABLES.

               STOP RUN.

    ---------------- C -----------------------
    #include <stdio.h>
    typedef struct {
    long num1;
    char str1[17];
    char str2[17];
    } estru;
    void ruti(estru *est) {
    printf("NUM1 %d \n", est->num1);
    printf("STR1 %s \n", est->str1);
    printf("STR2 %s \n", est->str2);
    }

            We try to use your example but the result of the value was 0. Please
    tell me something...

    THANKS !!! AND SORRY ABOUT MY ENGLISH


  • Next message: sb: "Re: Deploying over IIS and VB"

    Relevant Pages