Table of Contents

DMSCPY Abstract

Statistics

Type ASSEMBLE
Source Lines : 3,942
Fixes Applied : 11
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [R13560DS]

Synopsis

Module

       DMSCPY (COPYFILE)

Function

       TO COPY DISK FILES, SPECIFYING VARIOUS CONVERSIONS.

Attributes

       REENTRANT, DISK RESIDENT

Operation

       OPERATION TAKES PLACE IN SEVERAL STEPS.

       STEP 1.   THE WORK SPACE  IA ALLOCATED  VIA 'GETMAIN'
       AND ITS FIELDS ARE INITIALIZED.

       STEP 2.  THE  FILE NAME LIST IS SCANNED.  A FLAG BYTE
       IS SET UP FOR EACH  FILE NAME, INDICATING THE FIELDS,
       IF ANY, IN WHICH AN ASTERISK OR AN EQUAL SIGN OCCURS.

       STEP 3.  THE OPTION LIST IS SCANNED.  FOR EACH OPTION
       IN  THE  USER-SUPPLIED  LIST, A  SPECIAL  ROUTINE  IS
       ENTERED TO HANDLE IT.  THE HANDLING ROUTINE CAN SET A
       FLAG, AND CAN HANDLE SUB-FIELDS OF THE OPTION NAME.

       STEP   4.    ADDITIONAL  OPTION   PROCESSING.    THIS
       INCLUDES:
              CHECKING FOR OPTION CONFLICTS.
              SETTING MULTIPLE OR SINGLE MODE, AS SPECIFIED.
              READING  'SPECS'  LIST,  IF  THAT  OPTION  WAS
              GIVEN.
              SETTING UP TRANSLATE TABLE, IF NECESSARY.
              READING  TABLE  FOR  TERMINAL  IF  'TRANSLATE'
              SPECIFIED.

       STEPS 4 AND 5.  PERFORM THE ACTUAL COPYING OPERATION.

       DUE TO THE NUMBER OF  OPTIONS AND MODES AVAILABLE, IT
       WAS FELT THAT A STRAIGHTFORWARD CODING OF THE COPYING
       STEP WOULD  LEAD TO  VERY COMPLEX  AND HARD-TO-MANAGE
       CODE.  IN  ORDER TO AVOID  THIS PROBLEM,  A DIFFERENT
       SCHEME WAS  USED. THIS SCHEME  WAS DESIGNED  WITH THE
       FOLLOWING OBJECTIVES IN MIND:
          FAST EXECUTION SPEED
          EASY TO DEBUG CODE
          EASY TO MODIFY CODE

       THE  IDEA   BEHIND  THE  COPYING  OPERATION   IS  THE
       FOLLOWING: THE COPYING OPERATION IS  BROKEN UP INTO A
       LARGE NUMBER OF SMALL  ROUTINES, HANDLING THE VARIOUS
       TASKS  TO  BE  PERFORMED  AS   PART  OF  THE  COPYING
       OPERATION.  EACH OF  THE ROUTINES  IS MADE  TO BE  AS
       STRAIGHT-LINE AS POSSIBLE, SO THAT IT WON'T DEPEND ON
       WHICH OPTIONS HAVE BEEN SPECIFIED.

       IT MUST, THEREFORE, BE DETERMINED IN ADVANCE WHICH OF
       THESE ROUTINES ARE TO BE EXECUTED. A ONE-BYTE CODE IS
       ASSIGNED TO EACH OF THE ROUTINES, AND TABLES ARE MADE
       UP, DEPENDING UPON THE  OPTIONS WHICH WERE SPECIFIED,
       TO CALL ONLY THE ROUTINES WHICH SHOULD BE INVOKED FOR
       THE SPECIFIED OPTIONS.

       STEP 4,  THEN, SETS  UP THE  CODE STRINGS,  DEPENDING
       UPON WHICH OPTIONS WERE  SPECIFIED.  THE CODE STRINGS
       ARE GROUPED INTO 'PHASES', REPRESENTING THE DIFFERENT
       LOGICAL PHASES OF THE COPYING OPERATION.  (PHASES ARE
       NECESSARY FOR A DIFFERENT REASON:  THEY REPRESENT THE
       ONLY  REAL   MEANS  FOR  PROVIDING   FOR  CONDITIONAL
       BRANCHES AMONG ROUTINES DURING  THE COPYING OPERATION
       -  A   CONDITIONAL  BRANCH   IS  ACCOMPLISHED   BY  A
       CONDITIONAL CHANGE OF PHASE.)

       STEP  5  PERFORMS  THE ACTUAL  COPYING  OPERATION  BY
       BRANCHING TO THE  ROUTINES, IN TURN, AS  SPECIFIED BY
       THE CODE TABLES.

Calls to Other Routines

       STRINIT:   TO INITIALIZE STORAGE
       GETMAIN (OS MACRO):  TO ALLOCATE STORAGE AND BUFFERS
       WAITRD:  TO READ FORM THE CONSOLE
       FSTLKP:  TO FIND THE FST FOR A FILE
       ADTLKP:  TO FIND ADT FOR OUTPUT DISK (TO SEE IF IT'S RDONLY)
       RDBUF:  TO READ A RECORD FROM A DISK FILE
       WRBUF:  TO WRITE A RECORD TO A DISK FILE
       FREEMAIN (OS MACRO):  TO FREE ALLOCATED STORAGE
       FINIS:  TO RELEASE ACTIVE FILES
       ERASE:  TO ERASE FILES
       DMSERR:  TO TYPE OUT INFORMATION ERROR MESSAGES
       ALTER:  TO ALTER TEMP FILE NAME TO REAL OUTPUT FILE NAME