Chapter Contents

Previous

Next
FPUT

FPUT



Moves data to the File Data Buffer (FDB) for an external file, starting at the FDB's current column position

Category: External File


Syntax
Details
Example
See Also

Syntax

sysrc=FPUT(file-id,cval<, length>);

rc
contains the return code for the operation:
0 successful
[ne]0 not successful

Type: Numeric

file-id
contains the identifier that was assigned when the file was opened. If file-id is invalid, the program halts.

Type: Numeric

cval
is the data to be moved to the FDB.

Type: Character

length
is the length of the string to move to the FDB. If length is greater than cval, then the string is padded with blanks when it is moved. If length is less than cval, the string is truncated when it is moved. If length is less than 1, the program halts.

Type: Numeric


Details

The unformatted value of cval is passed to FPUT. The number of bytes moved to the FDB is determined by the length of the variable, or by the value of length, if length is specified. The value of the column pointer is then incremented to one position past the end of the new text.


Example

Move data to the FDB and write it to the external file:

   /* Assign the fileref THEFILE to the physical */
   /* filename stored in the variable FNAME      */
   /* and open it in append mode.                */
rc=filename('thefile',fname);
fileid=fopen('thefile','a');
if (fileid>0) then
   do;
      thestring='This is some data.';
      rc=fput(fileid,thestring);
      rc=fwrite(fileid);
      rc=fclose(fileid);
   end;
else
   _msg_=sysmsg();
rc=filename('thefile','');

See Also

FNOTE

FPOINT

FPOS

FWRITE


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.