The sample code below should be entered inside the Edit window's Command mode and not inside the File I/O dialog box.
The following code writes whatever the user inputs into an input comment, and appends a colon to be used as a delimiter.
C1=COMMENT/INPUT,Type any string. PC-DMIS will append a colon (for delimiter purposes) and write the string to a file of your choice
C2=COMMENT/INPUT,Type the name of the file to write
,to (include the complete path).
FPTR=FILE/OPEN,C2.INPUT,APPEND
ASSIGN/WRITETHIS=C1.INPUT+":"
COMMENT/OPER,"Text to write is: "+WRITETHIS
FILE/WRITELINE,FPTR,WRITETHIS
FILE/CLOSE,FPTR
Code Explanation
Some of this code is similar to that explained in "Sample Code for Read Character" or in "Sample Code for Read Line".
Only explanations unique to this example are given here.
FPTR=FILE/OPEN,C2.INPUT,APPEND
This line opens the file specified in the C2 comment for appending, and
assigns it to the file pointer, FPTR.
ASSIGN/WRITETHIS=C1.INPUT+":"
This line appends a colon to the text contained in C1.INPUT
and assigns the new string to the user defined variable, WRITETHIS.
FILE/WRITELINE,FPTR,WRITETHIS
This line writes the values contained in WRITETHIS
to the file specified by the file pointer, FPTR.
You can later read-in text from the file by using the colon as a delimiter.
Command Mode Commands after Comments
After you insert a PC-DMIS comment, to type additional PC-DMIS commands in Command Mode, you must first press Enter twice after the COMMENT command. This tells PC-DMIS that you no longer want to add text to the comment but are ready to add a new command.