× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On 17/05/2006, at 12:55 AM, Adrienne McConnon wrote:

I have a question regarding the 'write' API. Is there an end of record marker that needs to be set when writing to an existing stream file?

No. You specify the length of the data to write. This should be the exact length of the data rather than the length of the variable containing the data.

I have tried CALL PROCEDURE '_C_IFS_fwrite' and CALL PROCEDURE 'WRITE' with no good results

The 1st 2 lines below represent the last 2 lines in an existing stream file. The next line contains some display data and mostly garbage. but it should have written a 200 byte record.

The data you show indicates that you wrote whatever junk just happened to be in storage. How are you invoking 'write' and what do you pass to it?

write (in all its forms) expects the address of the data and the length of the data plus a file descriptor all of which should be passed by VALUE. For example:

CALL PROCEDURE "write" USING BY VALUE FD
                                                         BY VALUE ADDRESS OF 
DATA
                                                         BY VALUE DATA-LEN
                                           RETURNING RC

Note that passing a pointer by VALUE is exactly the same as passing a variable by REFERENCE so if your data fits within the limits of a COBOL variable you can also do:

CALL PROCEDURE "write" USING BY VALUE FD
                                                         BY REFERENCE DATA
                                                         BY VALUE DATA-LEN
                                           RETURNING RC

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.