Article 173660 of comp.os.vms:
In article <5q2srg$hrd$1@abel.ic.sunysb.edu>, jlauret@tgv.com (Jerome LAURET) writes:
>
>>In article <199707090630.IAA19704@gate.fim.fgan.de>, win@gate.fim.fgan.de writes:
>>
>>the Unix way:
>>
>>	gs -q -dNOPAUSE ps2epsi.ps < ${infile} 1>&2
>>					       ====
>>looks like an input file and any redirection (1>&2). May be you have to
>>redefine any other SYS$xyz logical (e.g. SYS$OUTPUT).
>
>	Well, maybe the Unix way, but with version 403 of GS recently advertized 
>in this newsgroup, ps2epsi program does not seem to work. The nullpage device is
>there (that was the problem in older versions) but still ...
>
>
>$ define/user sys$input test.ps
>$ gs -q "-dNOPAUSE" "-sDEVICE=bit" "-sOutputFile=NUL" ps2epsi.ps
>
>	produces an "Error: /undefined in ps2edict". Any other combination of
>qualifier such as [-q -dNOPAUSE] would produce the same errors. 
>
>	I also used the older ps2pesi.ps program (I initially thought something
>might be wrong with the new one ; diff showed minor PosScript syntax 
>differences).
>
>	Anyboddy had luck with ps2epsi ?

Below is the command file I wrote based on the ps2epsi script that came
with ghostscript.  It writes a temporary file defining ps2edict before
running ghostscript.  I have used this with version 4.03 and version 5.00
of ghostscript.  It uses SED to remove carriage returns and to remove
any preview section from the original ps file, but this could be changed
to DCL code.

$ IF (P1 .EQS. "")
$ THEN
$   TYPE/NOPAGE SYS$INPUT:

    Usage: @UTILS:PS2EPSI input-file [output-file]

    The default extension for input-file is .PS; the default for output-file
    the input file name with .EPSI.

$   EXIT
$ ENDIF
$ INFILE = F$PARSE (P1, ".PS")
$ OUTFILE = F$PARSE (P2, ".EPSI", INFILE)
$ TMPFILE = "TEMP:PS2EPSI" + F$GETJPI("","PID") + ".TMP"
$ TITLE = "%%Title: " + F$PARSE (INFILE,,, "NAME", "SYNTAX_ONLY")
$ CREATOR = "%%Creator: Ghostscript ps2epsi from " + INFILE
$ DATE = "%%CreationDate: " + F$CVTIME(,"ABSOLUTE","DATE")
$ FOR = "%%For: " + F$EDIT(F$GETJPI("","USERNAME"),"TRIM")
$ OPEN/READ IN 'INFILE'
$TITLELOOP:
$ READ/END=TITLEDONE IN REC
$ IF (F$EXTRACT(0,1,REC) .NES. "%") THEN GOTO TITLEDONE
$ TAG = F$ELEMENT(0,":",REC)
$ IF (TAG .EQS. "%%Title") THEN TITLE = REC
$ IF (TAG .EQS. "%%Creator") THEN CREATOR = REC
$ IF (TAG .EQS. "%%CreationDate") THEN DATE = REC
$ IF (TAG .EQS. "%%For") THEN FOR = REC
$ GOTO TITLELOOP
$TITLEDONE:
$ CLOSE IN
$ CREATE/FDL=SYS$INPUT 'TMPFILE'
RECORD
FORMAT STREAM_LF
$ OPEN/APPEND OUT 'TMPFILE'
$ WRITE OUT "/ps2edict 30 dict def"
$ WRITE OUT "ps2edict begin"
$ WRITE OUT "/epsititle (", TITLE, "\n) def"
$ WRITE OUT "/epsicreator (", CREATOR, "\n) def"
$ WRITE OUT "/epsicrdt (", DATE, "\n) def"
$ WRITE OUT "/epsifor (", FOR, "\n) def"
$ WRITE OUT "end"
$ CLOSE OUT
$ DEFINE/USER SYS$INPUT 'INFILE'
$ DEFINE/USER OUTFILE 'OUTFILE'
$ GS "-q" "-dNOPAUSE" "-r72" "-sDEVICE=bit" "-sOutputFile=NLA0:" -
     'TMPFILE' GS_LIB:PS2EPSI.PS 'TMPFILE' "-c quit"
$ DELETE 'TMPFILE';*
$ OPEN/APPEND OUT 'OUTFILE'
$ COPY SYS$INPUT OUT
save
countdictstack
mark
newpath
/showpage {} def
%%EndProlog
%%Page 1 1
$ SED = "$UTILS:SED.EXE"
$ SED -f SYS$INPUT 'INFILE' >OUT
s/
//g
/^%%BeginPreview:/,/%%EndPreview$/d
/^%!PS-Adobe/d
/^%%[A-Za-z][A-Za-z]*$/d
/^%%[A-Za-z][A-Za-z]*: /d
$ COPY SYS$INPUT OUT
%%Trailer
cleartomark
countdictstack exch sub { end } repeat
restore
%%EOF
$ CLOSE OUT
$ EXIT
==========================================================================
John Hasstedt                 Internet: John.Hasstedt@sunysb.edu
Physics Department            Phone: 516-632-8169 or 516-632-8153
State University of New York  FAX: 516-632-8573
Stony Brook, NY  11794-3800


