/* Write out some text to a record */ IF CHAROUT(mailslotname, "This is some text") \== 0 THEN SAY "ERROR writing mailslot:" STREAM(mailslotname, 'D')Normally, you'll be limited to writing one line of text in a single record, unless you insert the sequence '0D0A'X between concatenated lines. For example, here we write out 2 lines of text to a record:
/* Write out some text to a record */ IF LINEOUT(mailslotname, "This is line 1." || '0D0A'X || "This is line 2") \== 0 THEN SAY "ERROR writing mailslot:" STREAM(mailslotname, 'D')After you're finally done writing out records and do not wish to write out anything more, you can use STREAM's 'CLOSE' command to close the mailslot. (Do not use CloseHandle). But if you forget to do this, REXX will automatically close it for you when your script ends.
To handle errors, you can use REXX's NOTREADY condition just like you would with any other stream.