× 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.



I am having a brain freeze on using fputs() in an RPGLE program. It needs to be in old-style /free format for another user.

I have this and it is showing 18 bytes written (retBytes) but the IFS file (in /tmp) is zero bytes - checked with Windows Explorer and wrklnk.

I must be missing something very obvious. Thanks.

// call proc to call _C_IFS_fopen mode 'w'

TextData = 'One Line Of Data' ;
TextBytes = IFS_Write(TextData : TextFileHandle);

// invoke proc to call _C_IFS_fclose

**======================================================================
**
**
**
**======================================================================
p IFS_Write b
d IFS_Write pi 10i 0
d pText 32767a const
d pFileHandle *
**----------
d Sys_IFS_Write PR 10i 0 extproc('_C_IFS_fputs')
d pString * value options(*string)
d pHandle * value
**----------
d retBytes s 10i 0 inz
d wkText s 32767a inz
d CRLF s 2a inz(x'0D25')
**----------

wkText = %trim(pText) + CRLF + x'00';
retBytes = Sys_IFS_Write(%addr(wkText) : pFileHandle);
if retBytes = 0;
dsply ('fputs error - Errno = CPE' + %editc(getErrno() : 'Z'));
endif;

return retBytes;

p IFS_Write e


Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power

 
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.