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



Yea - sorry - but someone had to ask and my version worked just fine.

Just a thought - but are you sure it _is_ "nothing" and not just undisplayable characters due to a code page error.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On May 26, 2017, at 1:40 PM, Roger Harman <roger.harman@xxxxxxxxxxx> wrote:

Jeesh Jon, There's obvious and then there is OBVIOUS <grin>. I didn't miss OBVIOUS. Not to say it couldn't happen but not this time!

Note the pseudo mainline has a comment about calling fclose() which I did verify in debug.

It tells me it's writing 18 bytes and I see the file created. Just nothing in it. Yeah, I may end up using open/read/write instead but now it's a grudge match to get this working.

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








From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> on behalf of Jon Paris <jon.paris@xxxxxxxxxxxxxx>
Sent: Friday, May 26, 2017 10:20 AM
To: Rpg400 Rpg400-L
Subject: Re: fputs() in RPGLE

I know this is too obvious to be the answer but ...

The code sample you show does not close the file. It would be buffered I think using the C routines.

I tried out a quick hack combining your stuff with Simon's code from his RPG blog (I've only ever use the unix-style APIs for this stuff) and I certainly got a whole boat load of data in the IFS. Incomprehensible because I didn't bother to set the code pages etc. but it worked just fine.


Jon Paris

www.partner400.com


Partner400 - Your partner in iSeries education
www.partner400.com
If you are looking for the very best in IBM i* Education, Consulting and Mentoring services you have come to the right place! We are dedicated to helping our ...

www.SystemiDeveloper.com


System i Developer - Home Page
www.systemideveloper.com
Welcome. Welcome to System i Developer, a consortium of top experts and educators on IBM i technology. If you develop or manage RPG/DB2 applications, we can help you ...


On May 26, 2017, at 12:45 PM, Roger Harman <roger.harman@xxxxxxxxxxx> wrote:

Nope. There is an assignment appending the null terminator. I tried that in lieu of using %str() on pText to see if it made a difference.

The write function is returning 18 so it appears to have written the data but, again, the file is empty.

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








From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> on behalf of Jeff Davis <Jeff_Davis@xxxxxxxxxx>
Sent: Friday, May 26, 2017 8:03 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: fputs() in RPGLE

Just looking at the code, the procedure is getting the data passed into the variable pText, while the function is writing wkText and the incoming data is not being set into wkText.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Roger Harman
Sent: Thursday, May 25, 2017 5:10 PM
To: 'RPG programming on the IBM i (AS/400 and iSeries)' <rpg400-l@xxxxxxxxxxxx>
Subject: fputs() in RPGLE

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




--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD
HCSC Company Disclaimer

The information contained in this communication is confidential, private,
proprietary, or otherwise privileged and is intended only for the use of
the addressee. Unauthorized use, disclosure, distribution or copying is
strictly prohibited and may be unlawful. If you have received this
communication in error, please notify the sender immediately at
(312)653-6000 in Illinois; (800) 447-7828 in Montana;
(800)835-8699 in New Mexico; (918)560-3500 in Oklahoma;
or (972)766-6900 in Texas.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.