Table of Contents

DMSFOR Abstract

Statistics

Type ASSEMBLE
Source Lines : 1,748
Fixes Applied : 2
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [HRC013DS]

Synopsis

Module

     DMSFOR  (FORMAT)

Function

       TO PHYSICALLY  INITIALIZE A  DISK SPACE  FOR THE  CMS
       DATA MANAGEMENT  ROUTINES.  FOR AN EXISTING  DISK, IT
       MAY IN EFFECT BE CLEARED; A LABEL MODIFIED; RECOMPUTE
       THE NUMBER OF CYLINDERS THAT ARE ALLOWED TO BE USED.

Attributes

     DISK RESIDENT;  SERIALLY REUSABLE.

Operation

       INITIALIZATION PHASE

       DMSFOR VALIDATES THE PARAMETER LIST.  A CHECK IS
     MADE TO VERIFY THAT THE SPECIFIED CCU IS VALID (NONZERO)
       AND NOT GREATER THAN X'FFF'.  FURTHER, THE MODE
       IS CHECKED FOR VALIDITY AND A SPECIFICATION OF 'S'
       FOR THE SYSTEM DISK WILL, OF COURSE, NOT BE
       ALLOWED.  THE SPECIFIED DEVICE IS THEN VERIFIED TO
       BE A READ/WRITE DASD DEVICE. A CP DIAGNOSE IS
       THEN ISSUED TO DETERMINE IF THE DEVICE IS
       ATTACHED AND READY AND TO DETERMINE THE ACTUAL
       DEVICE TYPE.  IF ANY CONDITION IS NOT MET OR THE
       DEVICE TYPE IS NOT RECOGNIZABLE AN ERROR CODE AND
       SUITABLE MESSAGE IS PRODUCED.

       DMSFOR CONTINUES AS DESCRIBED IN THE FOLLOWING
       SECTIONS.

       REAL FORMAT (FORMAT CCU MODE <NN>)

       IF THE  DISK IS REALLY TO  BE FORMATTED (NONE  OF THE
       SPECIAL OPTIONS R, OR L WAS SPECIFIED), THE PROCEDURE
       USED IS AS FOLLOWS.  THE  GENERAL DESCRIPTION WILL BE
       THAT  OF  THE  PROCEDURE  FOLLOWED  FOR  THE  A-DISK;
       FORMATTING  OF  THE  OTHER   DISKS  IS  IDENTICAL  IN
       OPERATION.   WHERE   THERE  ARE  DIFFERENCES   FOR  A
       DYNAMICALY  CREATED DISK  SPACE, THEY  ARE NOTED  AND
       ALSO  SUMMARIZED IN  A LATER  SECTION. A  DYNAMICALLY
       CREATED  DISK  SPACE  IS  CARVED OUT  OF  A  POOL  OF
       AVAILABLE CYLINDERS  BY CP.  THE  USER HAS  A VIRTUAL
       MACHINE DIRECTORY  ENTRY WHICH SPECIFIES A  TEMP DISK
       AT ADDRESS 192 IS TO BE NN CYLINDERS.  AT LOGON TIME,
       CP  PRESENTS  TO  CMS  A DISK  SPACE  AT  192  OF  NN
       CYLINDERS  WITH  RELATIVE  TRACK 00  00  ZEROED  OUT.
       THEREFORE,  AFTER USING  A  DYNAMICALLY CREATED  DISK
       SPACE (HEREAFTER TO BE REFERRED TO AS THE DY- DISK) AND
       LOGOUT FROM  CP, THE INFORMATION  THAT WAS  PLACED ON
       THAT  DISK  IS  LOST.  ALTHOUGH,  DURING  A  TERMINAL
       SESSION, THE  DISK AND INFORMATION THEREUPON  IS KEPT
       ALIVE ACROSS THE RE-IPLING OF THE CMS NUCLEUS.

       1. TO GUARD  AGAINST ACCIDENTAL OR INCORRECT  CALL OF
            DMSFOR, WHICH CAN CAUSE THE ERADICATION OF
            ALL FILES ON A DISK, A MESSAGE IS TYPED ON THE
            USER'S TERMINAL BEFORE ANY TABLES ARE CLEARED OR
            ANYTHING  IS WRITTEN  ON TO  DISK. THIS  MESSAGE
            (WITH DISK-MODE AND DEVICE-ADDRESS  FILLED IN TO
            THEIR CORRECT VALUES) REQUIRES A REPLY OF 'YES'
            OR 'NO' BEFORE THE PROGRAM WILL RESUME.

            THE USER MUST  TYPE IN YES FOR  FORMATTING TO BE
            UNDERTAKEN.  ANY OTHER  INPUT  AT  ALL FROM  THE
            TERMINAL WILL  RESULT IN AN ERROR-CODE  11 BEING
            RETURNED, NOTHING AT ALL IN  THE NUCON OR ACTIVE
            DISK  TABLE BEING  AFFECTED,  AND A MESSAGE
            INDICATING THAT FORMAT WILL NOT BE EXECUTED
            IS TYPED AT THE VIRTUAL CONSOLE.

            FOR THE DY-DISK, DURING CMS INITIALIZATION
            THIS  ENTIRE STEP IS  OMITTED; FORMATTING
            PROCEEDS  WITH NO  MESSAGE  TO  THE TERMINAL  OR
            FURTHER INPUT FROM THE USER.

       2.   DMSCRD IS THEN CALLED TO  OBTAIN THE LABEL TYPED
            BY THE USER IN RESPONCE TO THE LABEL REQUEST
            MESSAGE THAT IS PART OF THE FORMAT PROCEDURE.

            THE TYPED-IN  LABEL (BLANK-FILLED  IF LESS  THAN
            SIX BYTES, TRUNCATED IF MORE)  IS WRITTEN ON THE
            FIRST TEN BYTES OF RECORD  3 WHEN THE FORMATTING
            IS DONE.
            (FOR EXAMPLE, IF  THE USER TYPED IN  MYDISK, THE
            LABEL WOULD BE: VOL1MYDISK). FOR THE DY-DISK, NO
            MESSAGE IS GIVEN, NO USER  REPLY, AND A LABEL OF
            VOL1DYDISK IS ALWAYS USED.

       3. AT THIS  POINT, DMSALU  IS CALLED  TO RELEASE  AND
            CLEAR ALL APPROPRIATE
            RESIDENT TABLES FOR  THIS DISK, AND THE  R/O AND
            R/W FLAG-BITS  IN THE  ADTFLG1 FLAG-BYTE  IN THE
            ACTIVE DISK TABLE ARE CLEARED.

       4. JUST BEFORE FORMATTING STARTS, A MESSAGE IS TYPED,
            OF THE FOLLOWING FORM:

               FORMATTING CCU DISK'MODE'  (2314|3330).

            THIS  MESSAGE  CONFIRMS  TO THE  USER  THAT  THE
            FORMAT PROGRAM  IS FORMATTING THE  DESIRED DISK,
            AND INDICATES  THE DISK  TYPE.

            FORMATTING OF  THE DISK THEN COMMENCES.   A 3330
            IS FORMATTED BY WRITING 14 800-BYTE RECORDS PER
            HEAD, 19 HEADS PER CYLINDER. A 3340 IS FORMATTED
            BY WRITING 8 800-BYTE RECORDS PER HEAD, 12 HEADS
            PER CYLINDER. A 3350 IS FORMATED BY WRITING 19
            800-BYTE RECORDS PER HEAD, 30 HEADS PER CYLINDER.
            A 3380 IS FORMATTED WITH 36 800-BYTE RECORDS PER HRC004DS
            HEAD AND 15 HEADS PER CYLINDER.                  HRC004DS
            A 2314 OR 2319 IS FORMATTED WITH
            15 800-BYTE RECORDS PER TWO HEADS, FOR TEN PAIRS
            OF HEADS PER CYLINDER.  THE DATA WRITTEN (EXCEPT
            FOR  THE LABEL)  CONSISTS OF  BINARY ZEROES.   A
            READ-AFTER-WRITE CHECK  IS INCLUDED  IN THE  CCW
            CHAIN FOR  THE DISK, WHERE  THE DATA  WRITTEN ON
            THE DISK  IS IMMEDIATELY  READ (IN  NON-TRANSMIT
            MODE)   TO  CHECK   THAT   THE  FORMATTING   WAS
            SUCCESSFUL.    FOR   PURPOSE   OF   SPEED,   THE
            READ-AFTER-WRITE CHECK  IS NOT PERFORMED  ON THE
            DY-DISK, AS  THE DY-DISK  MAY BE  FORMATTED ONCE
            FOR EACH TERMINAL SESSION, WHILE THE OTHER DISKS
            ARE  USUALLY  FORMATTED  ONLY ONCE  IN  A  GREAT
            WHILE.

            IF ERRORS DO OCCUR,  REPEATED EFFORTS TO RECOVER
            ARE MADE BY CP AND IF AN ERROR RETURN FROM THE
            CP DIAGNOSE IS RECEIVED, THE ERROR IS CONSIDERED
            TO BE PERMANENT.  A MESSAGE INDICTING THE POINT
            AT WHICH FORMATTING WAS TRUNCATED AND AN
            ANNOUNCEMENT OF THE ERROR CONDITION IS MADE TO
            USER THAT HE MIGHT TAKE THE APPROPRIATE ACTION.

       5. FORMATTING OF THE  DISK CONCLUDES WHEN THE  END OF
            DISK  IS  REACH  (DETERMINED  BY  A  UNIT  CHECK
            COUPLED WITH  A SENSE  BYTE OF  X'81'), OR  IF A
            SPECIFIED  LIMIT BY  THE  USER  IS REACHED  (FOR
            EXAMPLE, 50 CYLINDERS FOR FORMAT  A 50), OR IF A
            PERMANENT ERROR OCCURS, WHICHEVER HAPPENS FIRST.

            IF THE  NUMBER OF  CYLINDERS FORMATTED  IS ZERO,
            THEN DMSFOR EXITS WITH AN ERROR
            MESSAGE, AND NO FURTHER ACTION IS TAKEN.

       6. IF  AT   LEAST  ONE   CYLINDER  WAS   SUCCESSFULLY
            FORMATTED, THEN DMSFOR CONCLUDES AS
            FOLLOWS:

          A.   STORES THE NUMBER OF  CYLINDERS ADTCYL IN THE
                 ACTIVE DISK TABLE.

          B.   TYPES A MESSAGE INDICATING HOW MANY CYLINDERS
            WERE FORMATTED.

          C.  STORES THE DEVICE DEPENDANT UNIT-TYPE-BYTE
                 IN THE APPROPRIATE SLOT IN THE NUCON TABLE.

          D.   OBTAINS A  816-BYTE BLOCK FROM  FREE STORAGE,
                 IF NECESSARY, FOR THE FIRST FST HYPERBLOCK,
                 CLEARS IT,  AND PLACES  ITS ADDRESS  IN THE
                 ACTIVE DISK TABLE.

          E.   OBTAINS A  200-BYTE BLOCK FROM  FREE STORAGE,
                 IF NECESSARY,  FOR THE QQMSK  TABLE, CLEARS
                 IT,  AND  PLACES  ITS ADDRESS  IN  THE  ADT
                 TABLE.

          F.   OBTAINS FREE  STORAGE FOR  THE QMSK  BIT-MASK
                 TABLE, THE SIZE DEPENDING  ON THE NUMBER OF
                 CYLINDERS,  SETS  THE  FIRST  WORD  TO  ITS
                 DEFAULT VALUE  OF X'F00000000',  CLEARS THE
                 REMAINDER  OF  THE TABLE,  AND  PLACES  ITS
                 ADDRESS IN THE ADT TABLE.

          G.   INITIALIZES ALL OTHER COUNTS IN THE ADT TABLE
                 AS  NEEDED (ADTNUM,  ETC.),  AND FLAGS  THE
                 DISK AS LOGGED IN AND READ-WRITE.

          H.   CALLS  DMSAUD  TO  WRITE  THE  FINISHED  FILE
                 DIRECTORY ON DISK.

       7. FINALLY,  DMSFOR RETURNS  TO THE  CALLER WITH  THE
            APPROPRIATE ERROR-CODE IN R15.
            WAS SUCCESSFUL) IN R15.

            CORRECT VALUE OF ADTNUM.  THE ACTUAL BITS IN THE
            QMSK BIT-MASK ARE THEN COUNTED

       RECOMPUTING FORMAT (FORMAT CUU MODE <NN> (R))

       RECOMPUTING FORMAT      (WITH   NO  CYLINDER   AMOUNT
       SPECIFIED),  IS  USED  TO  ASCERTAIN  THE  NUMBER  OF
       CYLINDERS AND RECOMPUTE THE DISK COUNTS, BUT ALSO HAS
       THE CAPABILITY OF  REVISING THE DISK COUNT  UPWARD IF
       ADTNUM IS GREATER THAN IT WAS PREVIOUSLY.

       FORMAT MODE RECOMP  NN (WHERE NN IS  A DECIMAL NUMBER
       OF  CYLINDERS  DESIRED)  WORKS LIKE  RECOMP  WITH  NO
       OPTIONS,  EXCEPT  THAT  THE NUMBER  OF  CYLINDERS  IS
       LIMITED TO THE 'NN' GIVEN BY THE USER.

       THE ACTION TAKEN  FOR FORMAT RECOMP (WITH  OR WITHOUT
       OPTIONS) IS AS FOLLOWS:

       1. DMSLAD IS CALLED AND THE DISK CHECKED TO MAKE SURE
            IT IS ACCESSED IN READ/WRITE MODE.
            IN AND IN READ-WRITE FORM.

       2. SUCCESSIVE  SEEKS TO  THE  DISK  ARE PERFORMED  TO
            DETERMINE THE ACTUAL NUMBER  OF CYLINDERS ON THE
            DISK.

       3. THE NUMBER OF  RECORDS ON DISK ADTNUM  IS COMPUTED
            FROM  THE  ACTUAL  NUMBER OF  CYLINDERS,  IF  NO
            OPTIONS WERE GIVEN.  IF  "NN" WAS SPECIFIED, THE
            "NN" COUNT OR THE ACTUAL  NUMBER OF CYLINDERS IS
            USED, WHICHEVER IS LESS. THE REVISED DISK COUNTS
            ARE THEN COMPUTED.  THE ACTUAL BITS IN  THE QMSK
            BIT-MASK ARE THEN COUNTED TO COMPUTE THE VALUE
            OF ADTUSED  (NUMBER OF RECORDS IN  USE), ADTLEFT
            (NUMBER LEFT), AND ADTLAST. ADTLAST  IS CLEARED,
            AND THE  NUMBER OF  CYLINDERS ADTCYL  IS STORED.
            "ADTLAST" (PLUS  A SAFETY  FACTOR IN  THE ADTRES
            RESERVE COUNT) IS  LESS THAN THE OLD  ADTLAST, A
            LOSS  OF DATA  WOULD  RESULT;  IN THIS  CASE,  A
            WARNING MESSAGE  IS GIVEN TO  THE USER,  THE OLD
            DISK COUNTS  ARE LEFT  INTACT, AND  ERROR 13  IS
            RETURNED TO  THE CALLER.  IF  THE NEW  ADTNUM IS
            THE SAME AS THE OLD, FORMATTING TERMINATES
            AFTER A CALL TO DMSAUD AND DMSQRY.

            DMSAUD  IS  THEN  CALLED   TO  ENSURE  THAT  THE
            RECOMPUTED COUNTS ARE STORED ON DISK.
            FINALLY, DMSQRY IS CALLED TO DISPLAY THE DISK
            COUNTS TO  THE USER.
       4. IF THE TOTAL NUMBER OF RECORDS INDICATED IN ADTNUM
            FOR THE DISK TO BE RECOMPUTED IS NOT THE SAME AS
            PREVIOUSLY (AND NO DATA-LOSS WILL OCCUR), RECOMP
            OBTAINS A  NEW QMSK BIK-MASK CORRESPONDS  TO THE
            NEW  DISK COUNTS,  MOVES THE  OLD QMSK  BIT-MASK
            THERETO,   TRUNCATING   OR   ZERO   FILLING   AS
            APPROPRIATE, AND GIVES BACK  THE OLD BIT-MASK TO
            FREE STORAGE.  THEN ALL NEW COUNTS ARE STORED IN
            THE ACTIVE DISK TABLE
            (INCLUDING THE  REVISED ADTCYL  CYLINDER COUNT),
            DMSAUD IS CALLED, AND FINALLY DMSQRY.

       RECOMP  MAKES IT  POSSIBLE TO  REVISE DISKS  WHENEVER
       FEASIBLE,  TO LARGER  OR SMALLER  SIZES, WITHOUT  THE
       NECESSITY OF  DUMPING FILES  OUT ON  TAPE, FORMATTING
       THE DISK, AND  LOADING THEM BACK IN  AGAIN.  THE ONLY
       REQUIREMENT,  OTHER THAN  THOSE  DISCUSSED ABOVE,  IS
       THAT  WHEN  A DISK  IS  ENLARGED  VIA RECOMP  IT  WAS
       PREVIOUSLY FORMATTED AT SOME TIME TO ITS FULL SIZE.

       CMS DISK-LABEL

       RECORD 3 (CYLINDER 0, HEAD 0, RECORD 3) OF A CMS DISK
       INCLUDES  A   TEN-BYTE  LABEL,   CONSISTING  OF   THE
       FOLLOWING:

       1. FOUR CHARACTERS:  VOLI

       2. SIX CHARACTERS:   DESIRED LABEL
                       (BLANK-FILLED IF LESS THAN 6;
                       TRUNCATED IF MORE THAN 6 CHARACTERS)

       3. REMAINING 790 BYTES OF RECORD=00 (BINARY ZEROES)

       OPTION TO WRITE A LABEL ON DISK

       AS MENTIONED EARLIER,  THE OPTION TO FORMAT   A
       CMS DISK CAUSES THE DISK  TO BE FORMATTED INCLUDING A
       LABEL ON RECORD 3.

       A LABEL CAN  ALSO BE ENTERED ON A DISK  THAT HAS BEEN
       FORMATTED  PREVIOUSLY  TO CHANGE  AN  EXISTING  LABEL
       WITHOUT AFFECTING ANY OTHER INFORMATION ON DISK.

       LABEL FORMAT (FORMAT CCU MODE (LABEL))

       THE LOGIC PERFORMED FOR A LABEL-ONLY FORMAT IS AS
       FOLLOWS:

       1. DMSLAD IS  CALLED TO MAKE  SURE A DISK  EXISTS FOR
            THE PLIST SPECIFICATION.  (OTHER VERIFICATION IS
            ACCOMPLISHED AS PART OF THE GENERAL INITIALIZING
            PROCESS.)   THE   DISK  MUST,   OF  COURSE,   BE
            ATTACHED, READY,  AND BE A READ-WRITE  DISK, FOR
            THE COMMAND TO SUCCEED.

       2. DMSDIOR IS CALLED TO READ  THE OLD LABEL FROM DISK
            INTO AN 800-BYTE I/O  BUFFER. (IF DMSDIOR SHOULD
            FAIL, A DESCRIPTIVE ERROR  MESSAGE IS GIVEN.)

       3. A MESSAGE IS TYPED ON THE USER TERMINAL ASKING FOR
            A 6-BYTE LABEL TO BE ENTERED.

       4. DMSCRD IS CALLED  TO OBTAIN THE LABEL  TYPED IN BY
            THE USER.

       5. VOLI (FOUR BYTES)  AND THE FIRST SIX  BYTES OF THE
            ENTERED LABEL
            (BLANK-FILLED, IF LESS THAN 6 WERE INPUTTED) ARE
            MOVED TO THE FIRST TEN BYTES OF THE 800-BYTE I/O
            BUFFER.

       6. DMSDIOW IS THEN CALLED TO WRITE THE NEW LABEL BACK
            ON  THE  DISK.   (IF   DMSDIOW  SHOULD  FAIL,  A
            DESCRIPTIVE  ERROR  MESSAGE IS  GIVEN,  AND  THE
            ERROR-CODE  FROM  DMSDIOW  IS  RETURNED  TO  THE
            CALLER.

       SUMMARY OF DIFFERENCES IN FORMATTING A DYNAMIC-DISK

       AS MENTIONED ABOVE, THERE  ARE SEVERAL DIFFERENCES IN
       THE WAY  A DY-DISK  IS FORMATTED  FROM THE  PROCEDURE
       USED FOR OTHER READ-WRITE DISK.  THESE ARE SUMMARIZED
       AS FOLLOWS:

       1. A LABEL OF VOL1DYDISK IS AUTOMATICALLY WRITTEN ON
            RECORD 3. (SEE NOTE BELOW)

       2. THE  READ-AFTER-WRITE CHECK  IN THE  CCW CHAIN  TO
            FORMAT THE DISK IS OMITTED,  IN THE INTERESTS OF
            MAKING  THE FORMATTING  OF A  TEMPORARY DISK  AS
            FAST AS POSSIBLE.

       3. THE REQUIREMENT FOR THE USER TO TYPE IN YES BEFORE
            FORMATTING  BEGINS  IS WAIVED.

       4. NO INFORMATION MESSAGES ARE TYPED DURING
            CMS INITIALIZATION.
            APPROPRIATE) IS  OMITTED (AS WELL AS  THE NORMAL
            FORMATTING MESSAGES)  IF THE  (NOTYPE) PARAMETER
            WAS GIVEN.

       NOTE:  IF  DESIRED TO CHANGE  THE LABEL ON  A DY-DISK
       AFTER IT HAS BEEN FORMATTED, THE COMMAND

                FORMAT 192 D (LABEL)

       CAN BE ISSUED, AND THE REPLACEMENT LABEL WRITTEN.

Calls to Other Routines

      DMSLAD,  DMSFRE,  DMSFRET,  DMSDIOR,  DMSALU,  DMSSTD,
       DMSAUD, DMSDIOW, DMSCRD, DMSCRW, DMSERR

       CALLED BY:

          DMSINT, OR USER FROM TERMINAL

       EXTERNAL REFERENCES:

            ADTSECT, FVSECT