Decodes a file which was previously encoded with the ENCODE utility or encoded using a MIME aware mail agent.
PMDF DECODE encoded-file-spec output-file-spec
Qualifiers Defaults /ENCODING=type None /FILENAME /NOFILENAME /HEADER /NOHEADER
encoded-file-specSpecifies the name of an encoded input file. The input file must be a file previously created with the ENCODE utility.
output-file-specThe name of the file to produce as output. The file output by DECODE will have the identical format, structure, contents, etc. of the original file encoded with ENCODE. When the /FILENAME qualifier is used, the output-file-spec is treated as a default file specification and as much as possible of the file name, if any, specified in the Content-type: header line is used to generate the actual output file name.
PMDF DECODE and ENCODE have been, for the most part, made obsolete by PMDF MAIL. If you use PMDF MAIL, then files which you send with the SEND command will be encoded automatically, if necessary. Encoded messages which you receive will be decoded automatically, if necessary, and can simply be extracted to a file with the EXTRACT command. If, however, you do not use PMDF MAIL, then read on.
The ENCODE and DECODE utilities are provided with PMDF as a means of transmitting OpenVMS binary files via VMS MAIL and other non-MIME aware agents. With ENCODE, a file can be encoded in a format which uses short records containing only printable characters. Such files can then be transmitted through most any mail system without being altered (e.g., lines wrapped, characters removed or replaced, etc.). ENCODE preserves all file contents and all file attributes when encoding a file. The contents and attributes are properly restored when decoded with DECODE. Absolutely any type of OpenVMS file can be transmitted with these two utilities --- even indexed files with multiple keys and files with extended semantics.
Encoded files have two parts. The first part is a conventional RFC 822 message header. Header lines are used to describe the file format; this information includes a conventional OpenVMS FDL (file description language) description of the file and a description of the encoding used to convert the file into a printable form for transfer. ENCODE creates this header; DECODE reads it and uses the information it contains to reconstruct the file.
Many encoded messages received with PMDF are automatically decoded for you, thus obviating the need to use PMDF DECODE at all. This is especially true when you use PMDF MAIL whose EXTRACT command will extract any MIME encoded message or message body part. If you use VMS MAIL, however, you can occasionally receive an encoded message which PMDF could not deliver in its decoded form to VMS MAIL owing to limitations of VMS MAIL itself.
/ENCODING=typeThis qualifier controls the type of decoding used to decode the input file. The possible values for this qualifier are BASE64, CBASE64 (gzip compressed BASE64), BASE85, BINHEX (encoding only, not the file format), BTOA, HEXADECIMAL, PATHWORKS, QUOTED_PRINTABLE, UUENCODE, CUUENCODE (gzip compressed UUENCODE). If the /HEADER qualifier is specified, then it should not be necessary to specify the encoding used as this should be given in the message header. The /ENCODING qualifier will override the header specification if it is used.
/NOFILENAME (default)When the /FILENAME qualifier is used, the output-file-spec is treated as a default file specification and as much as possible of the file name, if any, specified in the Content-type: header line is used to generate the actual output file name. The default is /NOFILENAME in which case any file name specified in the Content-type: header line is ignored.
/NOHEADER (default)This qualifier controls whether or not the encoded file begins with a MIME-compliant header. /NOHEADER is the default. When /NOHEADER is used, the /ENCODING qualifier is usually needed to specify the encoding since it cannot be determined from the header. To decode material that begins with a MIME-compliant header, e.g., specifying the encoding used, use the /HEADER qualifier.
The following example illustrates a typical scenario: SUE@SAMPLE.COM wants to send an executable program to BOB@EXAMPLE.COM. To do this, Sue might issue the following two commands:
When Bob receives this mail message he should issue the following commands:
$ PMDF ENCODE/ENCODING=BASE64 PROGRAM.EXE PROGRAM.TXT $ MAIL/SUBJECT="Bob, here's the program" PROGRAM.TXT "IN%""BOB@EXAMPLE.COM"""
After decoding the file, Bob can now proceed to run PROGRAM.EXE.
$ MAIL MAIL> EXTRACT/NOHEADER PROGRAM.TXT MAIL> EXIT $ ! Remove any extra material at the beginning and ending of the file. $ PMDF DECODE/ENCODING=BASE64 PROGRAM.TXT PROGRAM.EXE
Note that Sue could also have used PMDF MAIL's SEND command to bypass the need to use PMDF ENCODE in the first place. The use of this command to send binary files is described in Section 1.1.8.