IBM SG24-6526-00 User Manual

Page of 184
Chapter 6. Tips and techniques 
149
Even Qshell may be confused by the unusual characters. However in this case, there is a 
solution. That is you may quote the name. The easiest way to delete the problem file is to 
navigate into its directory using cd and then delete it by using the 
rm
 command. Enter the file 
name in double quotation marks to prevent Qshell being confused by any special characters, 
for example:
rm “c:\OrderManagement\log\OrderManagement.log”
If you want to use the file, then you can use Qshell commands. It may be easier, however, to 
rename it to a normal name and go back to familiar techniques. Oddly the UNIX command for 
rename is 
mv
 (it is also the move command), for example:
rm “c:\OrderManagement\log\OrderManagement.log” OrderManagement.log
6.2.2  The touch and setccsid commands
These 
touch
 and 
setccsid
 Qshell commands are occasionally useful.  
touch
 is a UNIX-like command. On UNIX, it simply sets the last update time of the stream file 
to the current time. Or if the file does not exist, it creates a new empty stream file. 
An OS/400 enhancement to the 
touch
 command makes it more useful. It has an optional 
parameter –C that you can use to set the CCSID of the file. The option must be an uppercase 
C, that should be followed by a space, the desired CCSID value, and the file name. The 
following command creates the file jms.log in the directory /OrderManagement/log. The file 
will be empty and have the ASCII CCSID 819. 
touch –C 819 /OrderManagement/log/jms.log
Further data written to the file by OS/400 commands should be translated to the specified 
code page.  This should enable the data to be easily read on a PC using a mapped drive (if it 
is textual data).  
If the file already exists, then the code page is not changed. You can use the 
setccsid
 
command instead. But it may be appropriate to delete the file and create it again empty using 
the 
touch
 command. You can delete the file by using the 
rm
 command. 
The 
setccsid
 command changes the CCSID of a stream file to a specified value. Note that 
the syntax is a little different. The command is followed by the desired code page and then the 
file name as shown in this example: 
setccsid 819 /OrderManagement/log/jms.log
This command does not translate any data already in the file. If the file already exists and 
contains data that you cannot read on a PC, then this command will not help. In fact, it can 
make the situation worse, since after the command, the data may be misinterpreted on the 
iSeries server. 
6.2.3  Viewing an iSeries stream file using the Qshell tail command
There are a number of Qshell commands for viewing files. 
򐂰
cat
: Displays the contents of the file in Qshell. 
򐂰
head
: Displays the first few lines of a file. 
򐂰
tail
: Displays the last few lines of a file. 
These commands are rarely useful. However, there is an option in the 
tail
 command that 
can be useful. If you specify the option –f between the 
tail
 command and the file name, then 
you can see the last few lines of the file and then monitor the file for more lines being written.