home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / source / ch14 / CHAPT14A.COB < prev    next >
Text File  |  1998-09-14  |  4KB  |  91 lines

  1. 000010 @OPTIONS MAIN,TEST
  2. 000020 Identification Division.
  3. 000030 Program-Id.  Chapt14a.
  4. 000031* Dealer File Creation
  5. 000041 Environment Division.
  6. 000050 Configuration Section.
  7. 000051 Source-Computer.  IBM-PC.
  8. 000055 Object-Computer.  IBM-PC.
  9. 000056 Input-Output Section.
  10. 000057 File-Control.
  11. 000058     Select Dealer-File Assign To "Dealer.Dat"
  12. 000059            Organization Indexed
  13. 000060            Access Sequential
  14. 000061            Record Key Dealer-Number Of Dealer-Record
  15. 000062            Alternate Record Key Dealer-Name Of Dealer-Record
  16. 000063            File Status Dealer-Status.
  17. 000064     Select Dealer-Text Assign To "Dealer.TXT"
  18. 000065            Organization Is Line Sequential
  19. 000066            File Status Dealer-Text-Status.
  20. 000070
  21. 000071 Data Division.
  22. 000072 File Section.
  23. 000073 Fd  Dealer-File.
  24. 000074 01  Dealer-Record.
  25. 000075     03  Dealer-Number         Pic X(8).
  26. 000076     03  Dealer-Name.
  27. 000077         05  Last-Name   Pic X(25).
  28. 000078         05  First-Name  Pic X(15).
  29. 000079         05  Middle-Name Pic X(10).
  30. 000083     03  Address-Line-1      Pic X(50).
  31. 000085     03  Address-Line-2      Pic X(50).
  32. 000086     03  City                Pic X(40).
  33. 000087     03  State-Or-Country    Pic X(20).
  34. 000088     03  Postal-Code         Pic X(15).
  35. 000089     03  Home-Phone          Pic X(20).
  36. 000090     03  Work-Phone          Pic X(20).
  37. 000091     03  Other-Phone         Pic X(20).
  38. 000092     03  Start-Date          Pic 9(8).
  39. 000093     03  Last-Rent-Paid-Date Pic 9(8).
  40. 000094     03  Next-Rent-Due-Date  Pic 9(8).
  41. 000095     03  Rent-Amount         Pic 9(4)v99.
  42. 000096     03  Consignment-Percent Pic 9(3).
  43. 000097     03  Filler              Pic X(50).
  44. 000098 Fd  Dealer-Text.
  45. 000099 01  Text-Record.
  46. 000100     03  Dealer-Number         Pic X(8).
  47. 000101     03  Dealer-Name.
  48. 000102         05  Last-Name   Pic X(25).
  49. 000103         05  First-Name  Pic X(15).
  50. 000104         05  Middle-Name Pic X(10).
  51. 000105     03  Address-Line-1      Pic X(50).
  52. 000106     03  Address-Line-2      Pic X(50).
  53. 000107     03  City                Pic X(40).
  54. 000108     03  State-Or-Country    Pic X(20).
  55. 000109     03  Postal-Code         Pic X(15).
  56. 000110     03  Home-Phone          Pic X(20).
  57. 000111     03  Work-Phone          Pic X(20).
  58. 000112     03  Other-Phone         Pic X(20).
  59. 000113     03  Start-Date          Pic 9(8).
  60. 000114     03  Last-Rent-Paid-Date Pic 9(8).
  61. 000115     03  Next-Rent-Due-Date  Pic 9(8).
  62. 000116     03  Rent-Amount         Pic 9(4)v99.
  63. 000117     03  Consignment-Percent Pic 9(3).
  64. 000118     03  Filler              Pic X(50).
  65. 000119
  66. 000120 Working-Storage Section.
  67. 000121 01  Dealer-Status      Pic XX Value Spaces.
  68. 000122 01  Dealer-Text-Status Pic XX Value Spaces.
  69. 000132 01  Record-Counter     Pic 9(5) Value Zeros.
  70. 000372 Procedure Division.
  71. 000373 Chapt14a-Start.
  72. 000374     Open Input Dealer-Text
  73. 000384     Open Output Dealer-File
  74. 000394     Perform Until Dealer-Status Not = "00" Or
  75. 000395                   Dealer-Text-Status Not = "00"
  76. 000404         Read Dealer-Text
  77. 000405         If Dealer-Text-Status = "00"
  78. 000414            Write Dealer-Record From Text-Record
  79. 000415            If Dealer-Status Not = "00"
  80. 000416               Display
  81. 000417               "Write Error Dealer-Record " Dealer-Status
  82. 000418            Else
  83. 000419               Add 1 To Record-Counter
  84. 000420            End-If
  85. 000421         End-If
  86. 000424     End-Perform
  87. 000434     Close Dealer-Text Dealer-File
  88. 000435     Display
  89. 000436     "File Processed with " Record-Counter " Records Written"
  90. 000437     Stop Run
  91. 000444     .