[Info-vax] COBOL PIC format for a 64 bit unsigned int ("long long") ?

Richard Maher maher_rj at hotspamnotmail.com
Mon Oct 12 18:54:51 EDT 2009


Hi Jan-Erik,

"Jan-Erik Söderholm" <jan-erik.soderholm at telia.com> wrote in message
news:QgNAm.12209$U5.166948 at newsb.telia.net...
> I am trying to call some COBOL code from a piece of C...
>
> The call from C looks like this :
>
>   char cob_inart[16];
>   unsigned long long cob_insernr;
>   char cob_utben[16];
>   char cob_utordnr[16];
>   int rc;
>
>   rc = MES101(cob_inart, cob_insernr, cob_utben, cob_utordnr);
>
> I get a ACCVIO when trying to use the "unsigned long long"
> paramater on the COBOL side. I have probably not got the
> right PIC clause to match the "unsigned long long", I guess.
>
> Currently it looks like this (in MES101.COB) :
>
>   WORKING-STORAGE SECTION.
>   01 Answer             PIC S9(9) COMP.
>
>   LINKAGE SECTION.
>   01 c_inart            PIC X(16).
>   01 c_insernr          pic 9(16) comp.
>   01 c_ben              PIC X(16).
>   01 c_ordnr            PIC X(16).
>
>   PROCEDURE DIVISION USING c_inart c_insernr c_ben c_ordnr
>                            giving Answer.
>
> As soon as I try to do anything  with the "c_insernr"
> paramater (such as DISPLAY or MOVE) the COBOL code ACCVIO's.
>
> Does anyone have a clue what the PIC clause should look
> like to match a "unsigned long long" ?
>
> And yes, I have scanned the COBOL and C User Guides and
> Ref Manuals, but didn't find anything clear on this point.
>
>
>

I'm guessing Pic 9(16) comp should cover it size wize. (If long long =
quadword)

What is the default passing mechanism for long longs? I'm guessing BY VALUE
rather than BY REFERENCE. Try telling C to send it by reference, or in your
COBOL have a pointer (probably ponter-64 but I've never used one) and say
SET MY_POINTER_64 TO REFERENCE C_INSERNR and then DISPLAY C_INSERNR and see
if it contains what you want.

Why you'd be using a quadword to store what is presumably an error number
(or using C at all for that matter) I don't know. But then you're a wrapper
man IIRC.

Cheers Richard Maher






More information about the Info-vax mailing list