Logo
Back

◆ Auto SN Routine

A customer made the following request.

'I wonder if you can help. We've been asked if we can develop a script to help with a tape labelling exercise.
We were thinking along the lines of something to prompt the Ops for a TSN range, performing the first Purge command with the first TSN, waiting for a purge 'OK' message, if OK rewind the tape and continue the loop with the next TSN. If not 'OK' a waiting entry to be sent asking to skip, end or try again?

Although quite a simple concept we feel it may become quite a long winded and complicated script, for an exercise that may not happen again. What do you think?'

A request for further details generated the following.

'The tapes are new unlabelled tapes and need to be SNed.

The tapes already have external 'sticky' labels on them so a specific tape or tape range needs to known before hand.
They will be mounted by hand, probably 10 at a time over on 2 tape drive hoppers, so the tape drive numbers may be variable as well.'

Metalogic's solution was driven by an ODTSequence SN which could be used as follows:

TT DO SN MT 82 HP0001-HP0010

This would SN the first unlabelled tape mounted on MT 82 to HP0001 and then rewind the tape. It would SN the next unlabelled tape to HP0002 and continue in the same vein until it had SNed HP0010.

While this is running at TT DO SN MT 83 HP0011-HP0020 could be entered which would start a similar SNing process on MT 83.

The SN ODTSequence provides a good example of passing a parameter passed to an ODTSequence.

The code to achieve this can be downloaded here.

Once downloaded, unzip and then transfer the file to the MCP system and enter UNWRAP *= OUTOF "AUTOSN.CON". This will unwrap the file *OPALS/SN. A Supervisor Enter from this file will add the following Opal routines to your system:

DEFINE + ODTSEQUENCE AUTOSN(PER):
If Labelled or Scratch Then
Begin
   ODT("RW MT ",UNITNO);
   If #Start > #Stop then
      Abort("Done");
End
Else
Begin
   If #Start > #Stop Then
      Abort("Done");
   ODT("SN MT ",UNITNO,$Prefix,String(#Start,6-Length($Prefix)));
   #Start:=#Start+1;
End;
\
DEFINE + SITUATION AUTOSN1(PER=MT):
  UNITNO=Decimal($Unit) AND NOT NOTREADY and Not InUse
\
DEFINE + SITUATION AUTOSN2(PER=MT):
  UNITNO=Decimal($Unit) AND NOT NOTREADY and Not InUse
\
DEFINE + ODTSEQUENCE SN(MSG):
$Param := Upper(Trim(Text));
If $Param = Empty Then
    $Err:=#("Expects a parameter of Unitno followed by Serial number range",/,
    "Eg. TT DO SN MT50 M00001-M00010")
Else
If $Param HdIs "MT" Then
    $Tmp:=$Param.Split(2); %drop MT
$Unit:=$Param.Split(" ");
$Start:=Trim($Param.Split("-"));
$Stop:=Trim($param);
If $unit=empty Then
   $Err:="Unit number not provided"
Else If $Start=Empty Then
   $Err:="Start Serial Number not provided"
Else If Length($Prefix:=Head($Start,Not "0123456789")) > 5 Then
   $Err:="Start Serial Number must end in at least one digit"
Else If $Stop=Empty Then
   $Err:="Stop Serial Number not provided"
Else If Head($Stop,Not "0123456789") Neq $Prefix Then
   $Err:="Stop Serial prefix must match Start Serial Prefix"
Else If #Start:=Decimal(Drop($Start,Length($Prefix))) >
   #Stop:=Decimal(Drop($Stop,Length($Prefix))) Then
$Err :="Start serial number must be less than Stop serial number";
If $Err neq Empty Then
   Show(#[SUB]"ERROR",/,$Err)
Else
Begin
   SHOW("Will Sn tapes mounted on MT ",$Unit,,"From ",$Start,,
      "For",,#Stop-#Start+1);
If Not OpalInuse("AUTOSN1") Then
Begin
   WHEN AUTOSN1 DO AUTOSN
End
Else If Not OpalInUse("AUTOSN2") Then
Begin
   WHEN AUTOSN2 DO AUTOSN
End
ELSE
   ABORT("Two AUTOSN routines already running");
End
\