Organization: Temple University -- Academic Computer Services
X-Acknowledge-To: <STAN@vm.temple.edu>
Newsgroups: bit.listserv.ibm-main
Date:         Fri, 28 Aug 1992 15:23:24 EDT
From:         Stan Horwitz <STAN@VM.TEMPLE.EDU>
Subject:      Sequention access of KSDS file

I am teaching  myself VSAM and came  upon what appears to  be an inexplicable
problem. I am trying  to access a KSDS file that  was successfully created by
another program. This  is a tiny file  with only six records that  I am using
for learning purposes only.

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.

Here is the Rexx exec used to start this program:

/* */
DLBL INDATA B DSN LAB4.HOMEWORK '('CAT IJSYSUC VSAM PERM
COBOL2 START
GLOBAL TXTLIB VSC2LTXT
GLOBAL LOADLIB VSC2LOAD
LOAD START
START '*'

Here is the program:

       IDENTIFICATION DIVISION.                                         STA00010
       PROGRAM-ID.         LAB5.                                        STA00020
                                                                        STA00030
       ENVIRONMENT DIVISION.                                            STA00040
                                                                        STA00050
       CONFIGURATION SECTION.                                           STA00060
                                                                        STA00070
       SOURCE-COMPUTER.    IBM.                                         STA00080
       OBJECT-COMPUTER.    IBM.                                         STA00090
                                                                        STA00100
       INPUT-OUTPUT SECTION.                                            STA00110
                                                                        STA00120
       FILE-CONTROL.                                                    STA00130
           SELECT VSAM-FILE ASSIGN TO INDATA                            STA00140
              ORGANIZATION IS INDEXED                                   STA00150
              ACCESS MODE IS DYNAMIC                                    STA00160
              RECORD KEY IS CUST-NUMB                                   STA00170
              FILE STATUS IS IN-STATUS.                                 STA00180
                                                                        STA00190
       DATA DIVISION.                                                   STA00200
       FILE SECTION.                                                    STA00210
                                                                        STA00220
       FD  VSAM-FILE.                                                   STA00230
                                                                        STA00240
       01  VSAM-RECORD.                                                 STA00250
           05  CUST-NUMB           PIC X(5).                            STA00260
           05  CUST-NAME           PIC X(20).                           STA00270
           05  CUST-STATE          PIC XX.                              STA00280
           05  CUST-ZIP            PIC 9(5).                            STA00290
                                                                        STA00300
       WORKING-STORAGE SECTION.                                         STA00310
       01  IN-STATUS               PIC XX.                              STA00320
           88  IN-STAT                         VALUE "10".              STA00330
                                                                        STA00340
       PROCEDURE DIVISION.                                              STA00350
       000-MAIN.                                                        STA00360
           OPEN INPUT VSAM-FILE.                                        STA00370
           DISPLAY "VSAM FILE OPENED WITH STATUS CODE " IN-STATUS.      STA00380
           DISPLAY "STARTING VSAM FILE ACCESS WITH NO KEY.".            STA00390
           START VSAM-FILE.                                             STA00400
           PERFORM UNTIL IN-STAT                                        STA00410
              READ VSAM-FILE NEXT                                       STA00420
              DISPLAY " " CUST-NUMB " " CUST-NAME " " CUST-STATE " "    STA00430
                      CUST-ZIP " " IN-STATUS                            STA00440
           END-PERFORM.                                                 STA00450
           DISPLAY " ".                                                 STA00460
           DISPLAY "STARTING VSAM ACCESS WITH KEY = 28976.".            STA00470
           MOVE "28976" TO CUST-NUMB.                                   STA00480
           START VSAM-FILE KEY IS EQUAL TO CUST-NUMB.                   STA00490
           PERFORM UNTIL IN-STAT                                        STA00500
              READ VSAM-FILE NEXT                                       STA00510
              DISPLAY CUST-NUMB " " CUST-NAME " " CUST-STATE " "        STA00520
                      CUST-ZIP " " IN-STATUS                            STA00530
           END-PERFORM.                                                 STA00540
           CLOSE VSAM-FILE.                                             STA00550
           STOP RUN.                                                    STA00560

 Stan Horwitz   Internet: STAN @ VM.TEMPLE.EDU  Bitnet: STAN @ TEMPLEVM

 Temple University's Sr. Mainframe Consultant; Manager of the Help-Net
 and Suggest lists; Listserv Postmaster; and in need of a vacation!

 Standard disclaimers apply. One of these days I will make this sig file
 look much nicer.
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU