|
qsrvbas@xxxxxxxxxxxxx (Tom Liotta) wrote: >Subject: Re: API parm confusion > > Bruce managed to clear up the issue that caused all the confusion in an > off-line note that I'm going to post my reply to here later. Just so others will benefit from my blindness after being mostly away from COBOL for five years, I'll give the C function prototype for the Qp0lGetPathFromFileID() API along with my incorrect COBOL interpretation, and then the corrected COBOL. #include <Qp0lstdi.h> char *Qp0lGetPathFromFileID(char *buf, size_t size, Qp0lFID_t fileid); I accessed this API in COBOL with these statements (minus a bunch of irrelevant snipped stuff): PROCESS NOMONOPRC Special-names. Linkage type is prc for 'Qp0lGetPathFromFileID' . 01 W-PathPtr pointer. 01 W-BytPrv Pic S9(9) binary. 01 W-FileID Pic X(16). 01 W-Path Pic X(1024). 90-Get-Path Section. 90-Initialize. set W-PathPtr to NULL . 90-Convert-FileID-to-Path. move 1024 to W-BytPrv call 'Qp0lGetPathFromFileID' using W-Path by value W-BytPrv W-FileID giving W-PathPtr end-call if W-PathPtr = null move 'N/A' to W-Path end-if . The corrected portion is: call 'Qp0lGetPathFromFileID' using by reference W-Path by value W-BytPrv by reference W-FileID giving W-PathPtr end-call Explicit coding of BY REFERENCE on the third parm in particular was what I'd missed. My personal COBOL coding standards are hereby changed always to include explicit BY clauses. Trivial flaw in coding technique, but what a tough item to see, at least for me. Tom Liotta -- Tom Liotta The PowerTech Group, Inc. 19426 68th Avenue South Kent, WA 98032 Phone 253-872-7788 Fax 253-872-7904 http://www.powertechgroup.com __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
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.