[Info-vax] COBOL PIC format for a 64 bit unsigned int ("long long") ?
glen herrmannsfeldt
gah at ugcs.caltech.edu
Tue Oct 13 13:06:47 EDT 2009
Jan-Erik S?derholm <jan-erik.soderholm at telia.com> wrote:
< glen herrmannsfeldt wrote:
<> Jan-Erik S?derholm <jan-erik.soderholm at telia.com> wrote:
<> < Jim Duff wrote:
<> <> Jan-Erik S?derholm wrote:
(snip)
<> <>> 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);
(snip)
<> < And also for my original code. I changed the type of the
<> < "unsigned long long" variable into a "pointer to unsigned
<> < long long", but the effect is the same...
<> No, that doesn't help and probably makes it worse.
< It worked.
<> Did you allocate any memory for the pointer to point to?
< I assigning the pointer the value of another pointer
< pointing to a "long long" with the actual value.
< I didn't *allocate* anything myself, doesn't the pointer
< gets allocated by the pointer variable declaration ?
Allocating the pointer doesn't give it anything to point to.
<> Did you add * to all references to it?
< > Instead, just put an &
<> in front of non-array arguments in the call.
< The same thing as actualy using a pointer as paramater in
< the first place, not ?
<> rc = MES101(cob_inart, &cob_insernr, cob_utben, cob_utordnr);
<> That tells C to pass the address of (a pointer to) cob_insernr
<> instead of the value.
< Yes, if cob_insernr isn't already a pointer by itself, not ?
< In that case it can (and should) be used without the "&".
< Right now I have :
< struct inval_struct {
< char *inart;
< unsigned long long *insernr;
< };
That puts the pointer inside a struct, but that doesn't give
it a value.
< int my_func(struct soap *soap,
< struct inval_struct *input_values,
< struct retval_struct *return_values)
< {
You didn't should the above statement for the previous version,
so there is nothing to compare it with. Now the calling program
has to supply the pointer, hopefully pointing to something.
< unsigned long long *cob_insernr;
< int rc;
< cob_insernr = input_values->insernr;
< rc = MES101(cob_inart, cob_insernr, cob_utben, cob_utordnr);
< I guess I could also use "input_values->insernr" directly as
< paramater in the call to MES101 without going through
< cob_insert, but that's another thing...
Yes, since it is now a pointer.
< Apart from the fact that the above might not be "nice C",
< is there any real error now ?
You moved the problem to the calling routine. Without seeing that,
one can't say.
-- glen
More information about the Info-vax
mailing list