home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MISC / TNH_PC.ZIP / ROHDE.NL < prev    next >
Encoding:
Text File  |  1987-01-14  |  4.9 KB  |  173 lines

  1. COBOL Software Review
  2.  
  3.               Rich Rohde
  4.       Portland IBM PC Users Group
  5.  
  6. I have had an opportunity to evaluate
  7. COBOL for the IBM Personal Computer.
  8. This version of COBOL conforms to the
  9. "Low-Intermediate" level of the
  10. American National Standard
  11. X3.23-1974. There are several
  12. features of this COBOL version which
  13. I would like to review.
  14.  
  15. IBM COBOL performs processing and
  16. management of sequential, relative
  17. and indexed I/O (ISAM) files. The
  18. LINAGE clause for print files is also
  19. provided. Although not directly
  20. stated, some form of communication is
  21. provided by specifying COM1 in the
  22. VALUE OF FILE-ID clause in the file
  23. description.
  24.  
  25. Interprogram communications are
  26. handled by two methods. The first
  27. method is the use of the CALL
  28. statement passing parameters to the
  29. called program, where the called
  30. program must have a LINKAGE SECTION
  31. and a USING phrase on the PROCEDURE
  32. DIVISION statement. The program also
  33. must include an EXIT PROGRAM
  34. statement, as opposed to a STOP RUN,
  35. to return to the calling program. The
  36. second method is to use the CHAIN
  37. statement, where the called program
  38. is a link-edited executable program.
  39. When the CHAIN statement is used, the
  40. complete file name must be specified,
  41. including the file extension.
  42.  
  43. SORT/MERGE and REPORT WRITER are not
  44. supported.
  45.  
  46. Segmentation is supported so larger
  47. programs can be divided into
  48. overlays. Before you call an overlay
  49. (independent segments 50 to 99) all
  50. files must be closed and all I/O must
  51. be performed in the segment. In an
  52. attempt to use segmentation I found
  53. that the DISPLAY screen name and
  54. ACCEPT screen name did not work in
  55. the segment. To get around this
  56. undocumented situation, I used the
  57. DISPLAY and ACCEPT statement prior to
  58. segmentation.
  59.  
  60. The feature I found most attractive
  61. was the SCREEN SECTION. Within this
  62. section, you are able to totally
  63. define an output screen with row,
  64. column, underline, reverse video and
  65. high intensity. With a graphics
  66. display, colors may be used. The
  67. definition of data to be displayed
  68. from another data name is supported.
  69. To have a defined display appear on
  70. your screen, simply use the DISPLAY
  71. statement. Data names also may be
  72. included to tell COBOL where data
  73. being accepted from the screen is to
  74. go.
  75.  
  76. Programs written in IBM Personal
  77. Computer COBOL require the COBRUN.EXE
  78. runtime module. If you are writing
  79. applications to be distributed, a
  80. license agreement with IBM will be
  81. needed. IBM indicates the license
  82. agreement can be readily obtained.
  83.  
  84. In the FILE-CONTROL, you may specify
  85. in the SELECT clause a FILE STATUS
  86. data name phrase. The data name must
  87. be defined in the WORKING-STORAGE
  88. SECTION as a PIC X(2). I had defined
  89. the file status as a PIC 9(2) and
  90. received the compile error message
  91. "UNRECOGNIZABLE ELEMENT IS IGNORED".
  92. With the line number of the error was
  93. that of the PROCEDURE DIVISION.
  94.  
  95. One problem I am aware of in the
  96. COBOL compiler concerns with the
  97. order in which data is moved to a
  98. field in a record. This can be solved
  99. easily as the following example
  100. illustrates.
  101.  
  102. FILE-CONTROL.
  103.     SELECT PARAM-FILE ASSIGN TO DISK
  104.     FILE STATUS IS STATUS-FLAG
  105.     ACCESS MODE IS DYNAMIC
  106.     ORGANIZATION IS RELATIVE
  107.     RELATIVE KEY IS PARAM-RECORD-KEY.
  108.  
  109. FD  PARAM-FILE
  110.     VALUE OF FILE-ID 'PARAM.DAT'
  111.     LABEL RECORDS ARE STANDARD.
  112. 01  PARAM-RECORD.
  113.     05FIELD-1      PIC X.
  114.     05FIELD-2      PIC 9(4) COMP-3.
  115.  
  116. WORKING-STORAGE SECTON.
  117. 01  STATUS-FLAG      PIC X(2).
  118. 01  PARAM-RECORD-KEY PIC 9.
  119.  
  120. PROCEDURE DIVISION.
  121. DECLARATIVES.
  122. PARAM-FILE-ERROR SECTION.
  123.     USE AFTER EXCEPTION ON PARAM-FILE.
  124. DISPLAY-STATUS-FLAG.
  125.     IF STATUS-FLAG = '30'
  126. CLOSE PARAM-FILE
  127. OPEN OUTPUT PARAM-FILE
  128. MOVE SPACES TO FIELD-1
  129. MOVE ZEROS TO FIELD-2
  130. MOVE 1 TO PARAM-RECORD-KEY
  131. WRITE PARAM-RECORD
  132. CLOSE PARAM-FILE
  133. OPEN INPUT PARAM-FILE.
  134. END DECLARATIVES.
  135. MAIN-SECTION SECTION.
  136. MAIN-PROCEDURE.
  137.  
  138.     OPEN I-O PARAM-FILE.
  139.     MOVE 1 TO PARAM-RECORD-KEY.
  140.     READ PARAM-FILE RECORD.
  141.  
  142. In the example, if the file PARAM.DAT
  143. does not exist, an error will occur
  144. when opening the file as I-O and the
  145. DECLARATIVES will be performed.  As
  146. you can see, the file is closed and
  147. then reopened as OUTPUT, the data
  148. record initialized and the record
  149. number one written. Control is
  150. returned to the main line with the
  151. file as I-O and the record is read,
  152. but an error is encountered with the
  153. STATUS-FLAG containing a '23' (no
  154. record found).
  155.  
  156. After checking the actual contents of
  157. record number one by using DEBUG and
  158. finding that FIELD-1 was null, I
  159. reversed the order in which the
  160. record was initialized:
  161.  
  162.     MOVE ZEROS TO FIELD-2
  163.     MOVE SPACES TO FIELD-1
  164.  
  165. and reran the program with complete
  166. success.
  167.  
  168. This version is as powerful as the
  169. COBOL on larger systems and close to
  170. being 100 percent compatible. I would
  171. strongly recommend its purchase for
  172. business applications.
  173.