Using MAIL8 in Batch

We must first note that the batch environment is not the same as TSS. In TSS, MAIL8 is a special privileged program which can send mail to any mailbox. In batch, MAIL8 does not automatically have this privilege. In batch, normal users can only send mail to mailboxes for which they have write permissions; sending mail to other mailboxes requires a $PRIVITY card.

Unfortunately, the use of this privileged control card is highly restricted. For this reason, non-privileged users must content themselves with sending batch MAIL8 to mailboxes on which they have write permission (usually just their own).

When you do have write permission on a mailbox, batch MAIL8 works almost exactly the same as TSS MAIL8. One notable exception is that batch MAIL8 cannot send

          YOU HAVE MAIL8

messages to users when it sends them a message.

Despite these difficulties, MAIL8 can still be useful in batch jobs. For example, you can use MAIL8 as the last activity in the job, to send yourself a message giving the job completion status or the like.

Basic JCL:

To use MAIL8 in batch, you need the usual $IDENT card and $USERID card. The MAIL8 activity should begin with the cards

          $      program mail
          $      limits  5,95k
          $      prmfl   **,r/c,r,mail8/bmail

You can pass batch MAIL8 a series of several interactive mode commands in file code I*. For example,

          $      data    i*
          to sneezy Subject=Work
          hi ho

sends the message "hi ho" to the given user.

The indication of the end of a message with batch MAIL8 is the end of the file. You may not use "." followed by a carriage return. Thus

          $      data    i*
          to swhite
          some day your prince will come
          .
          to sbeauty
          some day yours will too

does NOT work the way it would in time-sharing. If you want to send a number of messages in one activity, you must use redirection as described in the next section.

There is one last point to make about submitting batch MAIL8 jobs. If you submit the job through the TSS JRN command, JRN will normally convert all the characters in the job stream into BCD. If you place your mail messages in the job stream with $DATA cards as shown above, the messages are converted into BCD along with everything else. Batch MAIL8 can read both BCD and ASCII input, so there is no problem in reading the messages you send; however, case distinctions and special ASCII characters disappear when the messages are translated into BCD. If you want to prevent the batch processor from converting input into BCD, put a $ASCII card immediately after the $DATA card, and put a $ENX card at the end of the input.

If you wish, you can also pass batch MAIL8 a single command mode command line in file code CZ. For example,

          $      data    cz
          mail *p

issues a *P command to print everything in your Saved drawer.

If you have an I*, you don't need a CZ. If you have a CZ, MAIL8 ignores I*.

Redirection in Batch:

When batch MAIL8 encounters a construct of the form "<fc*xx" it takes input for the current MAIL8 command from the file code XX. For example,

          $      data    i*
          to swhite <fc*aa s="Prince Charming"
          to sbeauty <fc*bb s="Prince Charming
          again"
          $      data    aa
          some day your prince will come
          $      data    bb
          some day yours will too

sends the two different messages to "swhite" and "sbeauty". This kind of input redirection can also be used in a file code CZ command line.

In the above example, we put a Subject= option on the command line. If you do not specify a Subject in this way and Option +Ask_Subject is in effect, MAIL8 assumes that the line after a To command is a Subject line. Thus with

          to swhite <fc*aa
          to sbeauty <fc*bb

the second To command might be taken as the Subject line for the first To command.

Output redirection works in much the same way as input redirection, using a construction of the form ">fc*xx". Thus

          $      data    i*
          *p +unread >fc*hi
          $      prmfl   hi,w,s,ppan/stuff

displays all your unread messages into file code HI, the permanent file ppan/stuff.

Format of Messages in Files

When you are using batch MAIL8 to send a mail message that is stored in a file, the file must be an ASCII file with a format that MAIL8 recognizes. The first line in the file must be

          To: NAME NAME NAME ...

where the NAMEs are valid userids separated by one or more spaces. The next three lines in the file may be

          CC: NAME NAME NAME ...
          Bcc: NAME NAME NAME ...
          Subject: STRING...

These three may be in any order and any or all of the lines may be omitted. Finally, the file must contain one or more empty lines, followed by the actual text of the message.

The forms To:, CC:, etc. may be given with letters in either upper or lower case.

Miscellaneous Batch Notes

The output from batch MAIL8 is sent to report code 72. Command lines (from CZ) are also printed to the output. However, you will not see the text of the message.

The batch processor always grows files by adding multiples of 12 llinks. This can be problematic in batch MAIL8. If a batch job sends a message to a user and has to grow that user's mailbox to make room for the message, it attempts to increase the mailbox's size by 12 llinks. This leads to an error if such an increase causes the box to exceed its maximum size.

Batch MAIL8 always behaves as if you have set Option -NOVICE. Therefore, you should not use the Novice mode form of commands, if the form makes a difference.

Privileged Batch MAIL8:

Operations staff may supply a $PRIVITY card in the MAIL8 activity. This enables your job to send mail to any mailbox, regardless of whether or not you have write permissions on the box. Using the $PRIVITY card in a batch job naturally requires operator intervention from the console to reply to the ASKS PRIVITY query.

Copyright © 1997, Thinkage Ltd.