|
Simon, Thanks for your response. Below are displays from my program, the length is specified as 200 bytes. LENGTH=000000200 Data read from file:DATE: 060518 TIME: 081530 ZZZZZZZZZZ IFS-FWRITE LENGTH=000000200 Buffer before write:DATE: 060518 TIME: 081530 xxxxxxxx ZZZZZZZZZZ Data written to file:DATE: 060518 TIME: 081530 xxxxxxxx ZZZZZZZZZZ Length=000000200 RC=000000000J 5900 - DLTF FILE(ZZZWORK/JOPENSF3) More Below is the code that was used to display the displays above. I did change the first parm to be 'by reference' instead of by value. As you can see by the results below, it is still writing garbage. Currently, I will be R/W to byte-stream files. I have another question - is there any benefit to maniputating these files in libraries? Does the files origin have any impact over which API's I use? Thanks again for your help! Adrienne 0107.30 DISPLAY 'IFS-FWRITE'. 0107.32 DISPLAY 'LENGTH=', LENGTH OF BUFFER. 0107.33 DISPLAY 'Buffer before write:' BUFFER. 0107.36 0107.37 CALL PROCEDURE '_C_IFS_fwrite' 0107.38 USING BY REFERENCE BUFFER, 0107.39 BY VALUE LENGTH OF BUFFER, 0107.40 BY VALUE FILE-PTR. 0107.41 * CALL PROCEDURE '_C_IFS_fwrite' 0107.42 * USING BY VALUE ADDRESS OF BUFFER, Results of write in file: 2006050514265300002536 LOG CLOSE F530-LOG LOG01.FILE ÄÁãÅz@ðöðõñø@ãÉÔÅz@ðøòðñö@§§§§§§§§@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ÿÿÿÿ ÿÿÿÿ E¸K 0 E¸K 8 E¸K @ E¸K H E¸K P E¸K X E¸K ` E¸K E¸K " E¸K " E¸K " E¸K "0 E¸K "@ E¸K "H E¸K " E¸K " -----Original Message----- From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of cobol400-l-request@xxxxxxxxxxxx Sent: Wednesday, May 17, 2006 1:00 PM To: cobol400-l@xxxxxxxxxxxx Subject: COBOL400-L Digest, Vol 4, Issue 52 Send COBOL400-L mailing list submissions to cobol400-l@xxxxxxxxxxxx To subscribe or unsubscribe via the World Wide Web, visit http://lists.midrange.com/mailman/listinfo/cobol400-l or, via email, send a message with subject or body 'help' to cobol400-l-request@xxxxxxxxxxxx You can reach the person managing the list at cobol400-l-owner@xxxxxxxxxxxx When replying, please edit your Subject line so it is more specific than "Re: Contents of COBOL400-L digest..." Today's Topics: 1. Re: write API for COBOL - end of record? (Simon Coulter) ---------------------------------------------------------------------- message: 1 date: Wed, 17 May 2006 09:04:45 +1000 from: Simon Coulter <shc@xxxxxxxxxxxxxxxxx> subject: Re: [COBOL400-L] write API for COBOL - end of record? 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 / \ -------------------------------------------------------------------- ------------------------------ -- This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) digest list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l. End of COBOL400-L Digest, Vol 4, Issue 52 *****************************************
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.