home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / bit / listserv / ibmmain / 2060 < prev    next >
Encoding:
Text File  |  1992-08-29  |  5.8 KB  |  93 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!UTMARTN.BITNET!##09
  3. Message-ID: <28AUG92.17748780.0009.MUSIC@UTMARTN>
  4. Newsgroups: bit.listserv.ibm-main
  5. Date:         Fri, 28 Aug 1992 16:26:02 EDT
  6. Sender:       IBM Mainframe Discussion list <IBM-MAIN@RICEVM1.BITNET>
  7. From:         Larry Holder <##09@UTMARTN.BITNET>
  8. Subject:      Sequention access of KSDS file
  9. In-Reply-To:  In reply to your message of FRI 28 AUG 1992 15:23:24 EDT
  10. Lines: 81
  11.  
  12. > It seems as if, when I try to do sequential processing on the file, the START
  13. > statement doesn't work.  In the program below, all that's  printed out by the
  14. > display statement is  a status field of  46. According to my  VSAM book, this
  15. > indicates a bad current record pointer, but I don't see how that could be the
  16. > case on the  simple program I included  below. If anyone has  any thoughts on
  17. > what I  am doing wrong, please  let me know. Your  responses are appreciated.
  18. > By the way, this is on a VM/CMS 5.5 system with VS Cobol II.
  19. >
  20. >        FILE-CONTROL.                                                    STA001
  21. >            SELECT VSAM-FILE ASSIGN TO INDATA                            STA001
  22. >               ORGANIZATION IS INDEXED                                   STA001
  23. >               ACCESS MODE IS DYNAMIC                                    STA001
  24. >               RECORD KEY IS CUST-NUMB                                   STA001
  25. >               FILE STATUS IS IN-STATUS.                                 STA001
  26. >                                                                         STA001
  27. >        DATA DIVISION.                                                   STA002
  28. >        FILE SECTION.                                                    STA002
  29. >                                                                         STA002
  30. >        FD  VSAM-FILE.                                                   STA002
  31. >                                                                         STA002
  32. >        01  VSAM-RECORD.                                                 STA002
  33. >            05  CUST-NUMB           PIC X(5).                            STA002
  34. >            05  CUST-NAME           PIC X(20).                           STA002
  35. >            05  CUST-STATE          PIC XX.                              STA002
  36. >            05  CUST-ZIP            PIC 9(5).                            STA002
  37. >                                                                         STA003
  38. >        WORKING-STORAGE SECTION.                                         STA003
  39. >        01  IN-STATUS               PIC XX.                              STA003
  40. >            88  IN-STAT                         VALUE "10".              STA003
  41. >                                                                         STA003
  42. >        PROCEDURE DIVISION.                                              STA003
  43. >        000-MAIN.                                                        STA003
  44. >            OPEN INPUT VSAM-FILE.                                        STA003
  45. >            DISPLAY "VSAM FILE OPENED WITH STATUS CODE " IN-STATUS.      STA003
  46. >            DISPLAY "STARTING VSAM FILE ACCESS WITH NO KEY.".            STA003
  47. >=======>    START VSAM-FILE.                                             STA004
  48. >            PERFORM UNTIL IN-STAT                                        STA004
  49. >               READ VSAM-FILE NEXT                                       STA004
  50. >               DISPLAY " " CUST-NUMB " " CUST-NAME " " CUST-STATE " "    STA004
  51. >                       CUST-ZIP " " IN-STATUS                            STA004
  52. >            END-PERFORM.                                                 STA004
  53. >            DISPLAY " ".                                                 STA004
  54. >            DISPLAY "STARTING VSAM ACCESS WITH KEY = 28976.".            STA004
  55. >            MOVE "28976" TO CUST-NUMB.                                   STA004
  56. >            START VSAM-FILE KEY IS EQUAL TO CUST-NUMB.                   STA004
  57. >            PERFORM UNTIL IN-STAT                                        STA005
  58. >               READ VSAM-FILE NEXT                                       STA005
  59. >               DISPLAY CUST-NUMB " " CUST-NAME " " CUST-STATE " "        STA005
  60. >                       CUST-ZIP " " IN-STATUS                            STA005
  61. >            END-PERFORM.                                                 STA005
  62. >            CLOSE VSAM-FILE.                                             STA005
  63. >            STOP RUN.                                                    STA005
  64. >
  65. Stan:                                                                   M
  66. In your first START, you have omitted the KEY phrase; according to my
  67. COBOL-II lang ref, "When the KEY phrase is not specified, KEY IS EQUAL
  68. (to the prime record key) is implied."  In other words, it is as if you
  69. had coded "START VSAM FILE KEY IS EQUAL TO CUST-NUMB" (as you did in
  70. the later START).
  71.  
  72. Since you did not put an initial value into CUST-NUMB, then the START
  73. failed because VSAM did not locate a record equal to the "garbage" in
  74. the record key field in working storage.
  75.  
  76. To compound the matter, after getting an (unchecked) non-zero status
  77. following the START, the READ...NEXT should not have been attempted
  78. (i.e., always check file status after any command). The "46" status was
  79. telling you that the READ...NEXT failed because no successful START had
  80. established a point to begin browsing from.
  81.  
  82. Hope this helps.  VSAM errors can seem a bit cryptic at times, but
  83. all in all it works tolerably well.   Happy coding...
  84.  
  85. Larry Holder
  86. Senior Programmer/Analyst
  87. The University of Tennessee at Martin Computer Center, Martin, TN 38237
  88. Bitnet: ##09@UTMARTN  Phone: (901) 587-7890  Fax: (901) 587-7841
  89.  
  90. Software: VSE/ESA 1.1.1, CICS/VSE 2.1.0, VM/ESA 1.0, COBOL-II 1.3.2
  91. Hardware: IBM 9221-150; 9336 FBA dasd; 9348 tape; 7171 protocol cvrt
  92. New PSW:  (Personal Status Words): Saved by grace (Romans 1:16 & 8:38)
  93.