|
To fellow ILEers
I'm trying to use a pointer to a data structure to pass data back from a
sub procedure. I had it working at one point but have since made some
changes and now it doesn't work. What's happening is $obcGetType loads
the data structure properly and the pointer is getting passed back to
$obcSelect, however the data in the 'type' data structure in $obSelect
is garbage. It's almost like once $obcGetType goes out of scope the
memory for type_ds gets corrupted. Any suggestions?
D $obcGetType PR *
D obcFile 10 CONST
D obcField 10 CONST
****************************************************************
* $obcSelect - Prompt for valid one-byte codes for a specified
* field in a specific file
*--------------------------------------------------------------*
P $obcSelect B EXPORT
D $obcSelect PI 1
D obcFile 10 CONST
D obcField 10 CONST
D p_type S *
D type DS BASED(p_type) Qualified
D ID 10I 0
D Description 50A
*--------------------------------------------------------------*
C EVAL p_type = $obcGetType(obcFile :
obcField)
.
.
.
C RETURN oneByteCode
*--------------------------------------------------------------*
P $obcSelect E
****************************************************************
* $obcGetType - Given a file and field return the type
*--------------------------------------------------------------*
P $obcGetType B
D $obcGetType PI *
D obcFile 10 CONST
D obcField 10 CONST
D p_type S *
D type S BASED(P_TYPE) LIKE(type_ds)
D type_ds DS Qualified
D ID 10I 0
D Descrptn 50A
*--------------------------------------------------------------*
/FREE
OPEN DOOBCTYP01;
CHAIN (obcFile:obcField) DOOBCTYP01;
IF %FOUND(DOOBCTYP01);
EVAL type_ds.ID = otID;
EVAL type_ds.Descrptn = otDescrptn;
EVAL p_type = %ADDR(type_ds);
ELSE;
EVAL p_type = *NULL;
ENDIF;
CLOSE DOOBCTYP01;
RETURN p_type;
/END-FREE
*--------------------------------------------------------------*
P $obcGetType E
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.