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