Created On:  15 December 2010

Problem:

When trying to run the MFSORT utility from within a .bat file, an error occurs when attempting to redirect the output of MFSORT to a filename using command line redirection if the filename is specified as an environment variable.

The following error will be written to the file an errorlevel will be set to 8.

     "Unable to write to SYSOUT. Switching to console output instead"

Example:

@ECHO OFF

SET OUTFILE=outfile.dat
ECHO [�TE% %TIME%] Step MFSORT started. >> %OUTFILE%
MFSORT USE DATA.DAT ORG LS RECORD (F,7) GIVE DATA.DAT SORT FIELDS (1,7,ch,a) >> %OUTFILE%
ECHO [�TE% %TIME%] Step MFSORT finished.  Error Level = %ERRORLEVEL% >> %OUTFILE%
ECHO Error Level = %ERRORLEVEL%

Resolution:

This can be remedied by setting the COBSW environment variable to S5 in the .bat file.

Example:

@ECHO OFF

SET COBSW= S5
SET OUTFILE=outfile.dat
ECHO [�TE% %TIME%] Step MFSORT started. >> %OUTFILE%
MFSORT USE DATA.DAT ORG LS RECORD (F,7) GIVE DATA.DAT SORT FIELDS (1,7,ch,a) >> %OUTFILE%
ECHO [�TE% %TIME%] Step MFSORT finished.  Error Level = %ERRORLEVEL% >> %OUTFILE%
ECHO Error Level = %ERRORLEVEL%
Incident #2490152