Trailing-Edge - PDP-10 Archives - tops10_integ_tools_v4_10jan-86 - 70,6067/cobol1/cbl102.txt
There is 1 other file named cbl102.txt in the archive. Click here to see a list.
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 1

                    TOPS10/20 COBOL-74 to VAX-11 COBOL

          These  notes  can  be  usefull  and  helpfull  tools  with  other
          conversions to VAX-11 COBOL.
          The remarks were sampled from the following projects:

           =  Conversion from TOPS20 COBOL-74  to  VAX-11  COBOL,  done  by
              Jude Braden,     Dublin-office.     (EASINET    MAIL-address:

           =  Conversion from TOPS10 COBOL-74  to  VAX-11  COBOL,  done  by
              Jan Postmus,    Utrecht-office.     (EASINET    MAIL-address:

          Please contact one of the  above  mentioned  persons,  concerning
          remarks on projects like these.

          1.0  GENERAL REMARKS

          1.1  File Specifications

           =  The periode between file-name and file-ext in file-spec,  has
              to  be  specified in VAX COBOL (was omitted in TOPS10 COBOL).
              The specification 'VALUE "COB   DAT"' has to be changed  into
              'VALUE "COB.DAT"'.

           =  The file-specification passed to VAX/VMS  on  runtime,  is  a
              combination  of  'ASSIGN  file-spec' ('SELECT' statement) and
              'VALUE OF ID file-spec' ('FD'  specification).   A  file-spec
              field   given   with  'VALUE  OF  ID'  clause  overrides  the
              corresponding field in the 'ASSIGN' clause.
              For more information, see Chapter "I/O Processing" in "VAX-11
              COBOL User's Guide".

          1.2  Clearing Of Records

          Record clearing, prior to  reading,  or  after  writing,  is  not
          handled  by  VAX  COBOL the way it is done by TOPS COBOL.  One of
          the  best  is,  use  the  'INITIALIZE'  statement,  if  necessary
          together with 'MOVE' instruction(s).
          See also remarks on 'INITIALIZE', 'READ' and 'WRITE'.
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 2


          All single quotes ( ' ) should be changed to double quotes ( " ).

          1.4  Spaces With '=' And ','

          VAX-11 COBOL likes to see spaces around '=' and after ','.



          VAX-11 COBOL wants the name 'IDENTIFICATION DIVISION'  full,  not
          short 'ID DIVISION'.


          3.1  SOURCE-COMPUTER

          Of course this has to be changed to 'VAX-11'.

          3.2  OBJECT-COMPUTER

           =  Of course this has also to be changed to 'VAX-11'.

           =  'MEMORY' clause is for documentation only  on  VAX,  in  TOPS
              COBOL it is presently ignored.

          3.3  SPECIAL-NAMES

           =  Special attention should  be  taken  with  the  SPECIAL-NAMES

           =  Change 'CHANNEL (1)' into 'C01' for use  of  skip  output  to

          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 3

          3.4  SELECT

           =  The SELECT statement may have to be changed for VAX.

           =  To be able to use logical names with 'ASSIGN' and  'VALUE  OF
              ID'  the same as implemented on TOPS, put the logical name in
              quotes and use a colon, p.g.  change:

                  'ASSIGN TO DISK01' into 'ASSIGN TO "DISK01:"'

              See also the remarks about File Specifications.

           =  The  'RECORDING  MODE'  in  the  file  description  has  been
              discontinued, it cannot be used on VAX.

          4.0  DATA DIVISION

          4.1  FD

           =  'BLOCK CONTAINS  0  RECORDS',  used  on  TOPS10  to  indicate
              unblocked  mode, cannot be used on VAX, this statement can be

           =  VAX COBOL likes to  see  a  'RECORD  CONTAINS'  clause,  when
              'BLOCK CONTAINS' is used.

           =  'VALUE OF IDENTIFICATION' should be changed to 'VALUE OF ID'.

           =  With respect to 'VALUE OF ID', see  also  the  remarks  about
              File Specifications.

           =  The  'RECORDING  MODE'  in  the  file  description  has  been
              discontinued, it cannot be used on VAX.

           =  'USER-NUMBER' to specify [PPN] is unknown on VAX, it  has  to
              be  deleted.  Take care about directory-specification through
              file-spec or logical name with 'ASSIGN' or 'VALUE OF ID' (see
              remarks about File Specifications).


          'LINE-COUNTER' and 'PAGE-COUNTER' are reserved  names  in  VAX-11
          COBOL, change these names if present in code.
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 4

          4.3  OCCURS

           =  You may need to check the use of 'REDEFINES' with 'OCCURS'.

           =  VAX does not allow the use of 'OCCURS' with a level-number 01
              or 77, TOPS10/20 COBOL-74 does allow this.

           =  When specifying key and index in the 'OCCURS' clause, the VAX
              wants it in the order:  key first, then index, like:

                  ASCENDING KEY IS ......
                  INDEXED BY ......

          4.4  REDEFINES

           =  Make sure that the REDEFINES item is not bigger than the item

           =  You may need to check the use of 'REDEFINES' with 'OCCURS'.

          4.5  SIGN

          When using the 'SIGN' clause you have to  include  the  character
          'S' in your numeric data description picture.

          4.6  USAGE IS INDEX

          The VAX reacted different as the TOPS did, with respect to  items
          declared  'USAGE  IS INDEX'.  All references in the code to these
          index-items (like  'SET',  'MOVE',  subscripts,  indexing),  were
          rejected  by  the  compiler.   Changed the definition from 'USAGE
          INDEX' into 'PICTURE 9(5) COMPUTATIONAL'.  Technically, the  item
          is  not  an  index-item,  then.   See  also  the  section  'INDEX
          HANDLING' further on.


          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 5

          5.1  Paragraph Header After 'PROCEDURE DIVISION'

          VAX COBOL likes to see a  paragraph  header  directly  after  the
          'PROCEDURE DIVISION' statement.

          5.2  Group-items

          VAX  COBOL  strictly  treates  a  group-item  as   alpha-numeric,
          regardless how the subsequent items are declared.  Some points to
          take care for, concerning group-items:

           =  Because  treated  as  alpha-numeric,  moving  from  a   field
              declared   numeric  with  sign  and/or  decimal  point,  p.g.
              S9(13)V9(5), to a group-item, does work different as it  does
              on TOPS COBOL.

           =  When a group-item exists out of several signed numeric items,
              checking  the  group-item against 'ZERO' cannot be performed,
              each item has to be checked individually.

          5.3  Remarks On Testing For Certain Values

           =  VAX does not like the testing of a numeric field for  spaces.
              Use 'IF FIELD NOT NUMERIC' instead.

           =  When testing items, they have to be of the same type, VAX  is
              very  strict on this, so testing a field, defined as 'PICTURE
              X(8)', against a numeric constant nnn, is not allowed,  while
              TOPS  COBOL  will  take care about translation.  In this case
              the numeric constant has to placed between double quotes,  as

           =  When a group-item exists out of several signed numeric items,
              checking against 'ZERO' cannot be performed.

          5.4  ACCEPT

          When using the 'ACCEPT' statement, VAX COBOL always  treates  the
          receiving  field  as  an  alpha-numeric  field, and justifies the
          received data always left (extended with spaces  to  the  right),
          even when the field is declared 'JUSTIFIED RIGHT' or numeric.
          One of the ways of accepting numeric values or get the data right
          justified,  is  to create subroutines to handle these situations.
          During the Utrecht project, it was necessary to make a subroutine
          to  handle  alpha-numeric  input  and get it right justified, and
          another subroutine to receive alpha-numeric data and translate it
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 6

          into  numeric,  including some basic checking.  Both called after
          accepting the data from the terminal.

          5.5  COPY

          Care should be taken, because  there  are  differences  in  using
          'COPY'  in  VAX  COBOL  or  in  TOPS  COBOL.   When  using 'COPY'
          statement in TOPS  COBOL,  always  code  from  a  source-library,
          created  with  LIBARY,  is  taken.   In  VAX  COBOL,  there are 3

           =  from a file, p.g.  :  'COPY ABCD' - code from  file  ABCD.LIB
              is inserted.

           =  from a library, p.g.  :  'COPY ABCD FROM BCDE'  -  code  from
              text  module  ABCD  in library BCDE.TLB is inserted;  library
              should be a text library, created by VAX LIBRARIAN.

           =  record  definition  from  CDD,  p.g.   :   'COPY  ABCD   FROM
              DICTIONARY'  -  the record definition is inserted from Common
              Data Dictionary;  only record definitions can  be  used  this

          5.6  CLOSE

          'CLOSE file-name WITH DELETE' is unknown on VAX, deleting a file,
          in  case  of  a  detected error in the program, should be handled
          outside  the  program.   See  the  remarks  concerning   "Program
          Detected Errors and Handling.

          5.7  DISPLAY

          In    VAX    COBOL,    index    data    items    and     integers
          (numeric/computational),  cannot  be  used in 'DISPLAY' statement
          straight away, they have to be moved  to  a  field  declared  for
          DISPLAY USAGE.  Example:

            TOPS COBOL statement:
                DISPLAY " TOTAL " INDEX.

            declare display-field, and change code into:
                DISPL    PIC 99.

                SET DISPL TO INDEX.
                DISPLAY " TOTAL " DISPL.

          Use 'MOVE INDEX TO DISPL' instead of 'SET  DISPL  TO  INDEX',  in
          case an integer is involved.
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 7

          5.8  EQUALS

          The word 'EQUALS' should be changed to ' = ' or 'IS EQUAL'.


          These values can be used, as long as testing is done against  the
          same  value  the  field  was previously set to.  Resetting fields
          with 'LOW-VALUES' can cause trouble, better use  'INITIALIZE'  or
          'MOVE ZERO' to reset fields.

          5.10  INITIALIZE

           =  It is advised to use the 'INITIALIZE'  verb,  where  possible
              and  sensible, as spaces and zeroes are not regarded the same
              on VAX.  We found during our  conversions  that  spaces  were
              moved to numeric fields and zeroes to alphabetic fields quite

           =  However,  there  are  some  points  to  regard,   using   the
              'INITIALIZE'.   It  works  very  nice  for normal records and
              fields,  also  when  using  'OCCURS'   without   'DEPENDING',
              computational  fields,  etc.   Care  should be taken with the

               -  Using 'OCCURS' clause  with  'DEPENDING'  phrase  in  the
                  field to be initalized, is not allowed.

               -  It does not work on 'index data items'.

               -  Items declared 'FILLER' are not affected.  When they have
                  to be cleared too, use 'MOVE SPACES' and 'INITIALIZE'.

               -  Mind, the contents, set up with  'VALUE'  phrase  in  the
                  DATA  DIVISION,  is cleared too, except for items defined

               -  Take care with fields  which  are  REDEFINED.   When  the
                  field,  to  be initialized, is REDEFINED, the instruction
                  works O.K., but when one or more sub-ordinate items  have
                  'REDEFINES', 'INITIALIZE' does not affect them.

          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 8

          5.11  INSPECT

          The 'INSPECT'  verb  requires  that  the  compare-value  and  the
          replace-value  be  of  the  same type (i.e.  Numeric, Alphabetic,

          5.12  MOVE

          Special care should be taken with 'MOVE SPACES' and 'MOVE  ZERO',
          use  'INITIALIZE'  where  possible and sensible, instead of these
          instructions (see also the remarks concerning 'INITIALIZE').

          5.13  READ

           =  Using  'AT  END'  clause,  like  'READ   file-name   AT   END
              statement',  the  statements  can only be "imperative", so no
              'IF' can be used.  If necessary, create a paragraph to handle
              the 'IF' after 'AT END'.

           =  Care should be taken with record clearing, prior to a  'READ'
              operation.   VAX  COBOL  does not always clear fields, better
              take care of it yourself, by using the 'INITIALIZE', but mind
              the specifics concerning this statement.

          5.14  SEARCH

           =  Testing a table element  in  the  'WHEN'  clause,  VAX  COBOL
              expects  the element directly behind 'WHEN', while TOPS COBOL
              allows to have them swapped.  For example, VAX COBOL wants:

                  'WHEN table-element = value'

           =  More complex conditions (like using ' < ',  ' > ',  etc.)  in
              the  'WHEN' clause, were rejected for use in the 'SEARCH ALL'
              statement.  It was allowed for the 'SEARCH' statement.

          5.15  SORT

          Only  section  names  are  allowed  by  VAX-11  COBOL  in  'INPUT
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL              Page 9

          5.16  WRITE

           =  Take care about the clearing of the record, after writing and
              before  filling  it, specifically when partly filled, because
              VAX COBOL might not clear it for you.  One of the  best  ways
              is to use the 'INITIALIZE' verb, but mind the specifics about
              this instruction.

           =  In case the total conversion included  also  conversion  from
              TOPS10/20  COBOL-68  to  -74,  mind  the  'ADVANCING BEFORE 1
              LINE'.  Because default  differences  between  -68  and  -74,
              changes  had  to be made for ASCII files, not for SIXBIT.  On
              VAX COBOL, SIXBIT is  unknown,  therefore  mind  the  'WRITE'
              statement,  for  files, which use to be SIXBIT in TOPS COBOL,
              and on VAX in ASCII.

          6.0  INDEX HANDLING

          During the Utrecht project, this showed to be  a  very  difficult
          matter, causing a lot of conversion problems.

          6.1  USAGE IS INDEX

          The VAX reacted different as the TOPS did, with respect to  items
          declared 'USAGE IS INDEX' (in the DATA DIVISION).  All references
          in the code to these items ('SET', 'MOVE', subscripts, etc.) were
          rejected  by  the  compiler.   Changed the definition from 'USAGE
          INDEX' into  'PICTURE  9(5)  COMPUTATIONAL',  which  worked  O.K.
          then.   In  this  case,  the  item  was not an index-item, but an

          6.2  Manipulating Index

          Items could be proper indices, by having them declared  with  the
          clause  'INDEXED  BY  .....'  in  the  'OCCURS'  statement.  With
          respect to manipulation, the following should be regarded:

           =  TOPS COBOL allows to handle indices with normal 'MOVE', 'ADD'
              and  'SUBTRACT'.   VAX-11  COBOL  is  more strictly, only the
              'SET' instruction has to be used.
              Change these, when indices are involved, like:

                'MOVE x TO index'        into  'SET index TO x'
                'ADD x TO index'         into  'SET index UP BY x'
                'SUBTRACT x FROM index'  into  'SET index DOWN BY x'
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL             Page 10

           =  'MOVE 0 TO index' was allowed in TOPS COBOL, VAX  COBOL  does
              not  allow  to  set an index to '0', use 'SET index TO 1' and
              change the code to be able to use it this way.

           =  Using indices in  the  'DISPLAY'  statement,  to  show  their
              value,  is  not  allowed  in VAX COBOL, see remark concerning


          By displaying the error character, while running the  program  in
          BATCH  or  MIC under TOPS, an error condition could be signalled,
          causing the stream to be aborted.
          The command sequence in VAX-11 does not have a simular  facility,
          but VAX/VMS offers the possibility to pass codes through $STATUS,
          indicating normal end (value "1") or certain error-codes.
          Standard error-codes can be used, or own codes can be created  by
          the  user,  specifying  the  $STATUS  value,  these  codes can be
          passed, and examined in the COM sequence.

          7.1  Passing Value To $STATUS (Error Exit)

          When using 'STOP RUN', automatically $STATUS will get  the  value
          "1", indicating normal, successfull exit.
          In case an abnormal end, p.g because of a program detected error,
          has  to  be  passed  through  to  $STATUS,  the system subroutine
          'SYS$EXIT' can be used.  It is called by:


          'WK-ERROR' has to be defined as numeric/computational (it has  to
          be an integer), holding the appropiate error code value.
          No return to the program is made, the effect is the same as 'STOP
          RUN',  except  the  value  of  'WK-ERROR' is placed into $STATUS.
          Unfortunately in COBOL no hexa-decimal values for  constants  can
          be  used,  so  the  decimal  value  of  the  code has to be known
          (DCL-command:  $ SHOW SYMBOL).

          7.2  Creating Own Error Codes And Messages

          For information, how to  create  own  messages,  see  the  manual
          "VAX-11 Utilities Reference Manual", Chapter "Message Utility".
          In short the procedure is:

          1.  Create a message source file, using  a  text  editor,  called
              p.g.  'OWNMESS.MSG'.
          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL             Page 11

          2.  Compile   the   source   file   with   the   message-compiler
              (DCL-command:     $ MESSAGE),   creating   an   object   file
              'OWNMESS.OBJ'.  Also a listing with the codes, including  the
              hexa-decimal values, can be obtained.

          3.  Link the object  file  (DCL-command:   $ LINK),  creating  an
              non-executable message file 'OWNMESS.EXE'.

          4.  Tell DCL to look  into  this  message  file,  by  typing  the
              DCL-command $ SET MESSAGE OWNMESS

          5.  Use the DCL-command $ SHOW SYMBOL 'code' to  investigate  the
              value of the several codes.

          6.  Use these decimal values in the  program(s)  to  specify  the
              particular error-code.

          7.3  Remarks Concerning Message File

          Linking the message object file to the program is  possible  (see
          the   "Message   Utility"  manual),  but  implementation  can  be
          difficult, as seen  during  the  Utrecht  project.   To  make  it
          flexible,  the  following  could  be  a  good way (as done in the
          Utrecht project):

           =  Own message file was created, according the  above  mentioned

           =  The programs were updated, that in case of a detected  error,
              the  program  called  a  subroutine, passing through a normal
              numeric  value,  indicating  the  error,  but  according   an
              internal list.

           =  The called subroutine took care about the translation of this
              internal  code into the correct error message code, according
              the message file.  After  translation  this  subroutine  also
              performed the call to 'SYS$EXIT'.

          In case the message file has to be updated, very  likely  on  the
          long  run,  it  is  not  necessary  to  update  and recompile all
          programs, possibly updating and recompiling of the error handling
          subroutine is the only necessity.


          Conversion TOPS10/20 COBOL-74 to VAX-11 COBOL             Page 12

          8.1  'DIVISION BY 0' Error

          A 'DIVISION BY 0'  error  occurred  very  frequently  during  the
          Dublin  project.   Incorporated  therefore  an  appropriate  'IF'
          statement, which rectified the error.

          8.2  'INVALID DECIMAL DATA' Error Condition

          'INVALID DECIMAL DATA' error condition occurred  very  frequently
          also.   This  error  was  generated  because spaces were moved to
          numerics and zeroes to alphabetic fields.
          Also  moving  'LOW-VALUES'  to  group-items  caused  this   error
          condition, during the Utrecht project.