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

P. Sture paul.nospam at sture.ch
Wed Oct 14 15:01:24 EDT 2009


In article <hb0aa3$ah6$1 at naig.caltech.edu>,
 glen herrmannsfeldt <gah at ugcs.caltech.edu> wrote:

> Jan-Erik S?derholm <jan-erik.soderholm at telia.com> wrote:
> < 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.
> 
> I don't know specifically about COBOL, but calls from C to
> many other languages expect the address of, not the value of,
> the arguments.  For arrays that happens sort of automatically
> (an array name is a constant pointer to the first element),
> but not for scalars.  Try an & in front of the non-array.
> 
> (Maybe %ref would also work.)
> 

COBOL expects arguments to be passed by reference. You can actually pass 
a string argument by descriptor if the receiving COBOL routine has the 
code to unpick the descriptor. LIB$ANALYZE_SDESC does the job here.

-- 
Paul Sture



More information about the Info-vax mailing list