VSAM Problems 
Author Message
 VSAM Problems

I wrote a binary search program (which worked fine) on Micro Focus Personal
COBOL.
It then has to uploaded and run on the mainframe. One of the files is a vsam
file. We were provided with a
substitute file for Micro Focus .
I can't get a match in the search using the VSAM but it works with the
substitute.

Here's the Jcl

//* RUN PROGRAM 5B
000037 //*****************************************************************
000038 //PROG5B EXEC PROC=COB2J,PDS='CCPM21.CSC.COBOL',MEMBER=CBL5B
000039 //GO.INFOIN DD DSN=CCPM21.CSC.OUT5A,DISP=SHR
000040 //GO.INSTUFF DD DSN=CSCJEB.CSC.CUST5D.VS,DISP=SHR
000041 //GO.OUTSTUFF DD SYSOUT=*

Then I set up instuff.

  000015                     SELECT HUNT-FILE ASSIGN TO INFOIN.
  000016                     SELECT INFILE ASSIGN TO INSTUFF
  000017                           ORGANIZATION IS INDEXED
  000018                           ACCESS IS RANDOM
  000019                           RECORD KEY IS CUST-NUM
  000020                           FILE STATUS IS VSAM-CODE.

define infile

000052                  FD INFILE
  000053               *     BLOCK CONTAINS 0 RECORDS
  000054               *     RECORD CONTAINS 80 CHARACTERS
  000055               *     RECORDING MODE IS F
  000056               *     LABEL RECORDS ARE STANDARD
  000057                     RECORD CONTAINS 24 CHARACTERS
  000058                     DATA RECORD IS INREC.
  000059                  01 INREC.
  000060                     05 CUST-NUM            PIC X(4).
  000061               *     05                              PIC X(1).
  000062                     05 CUST-NAME          PIC X(20).

VSAM SAMPLE DATA

       CHARACTER
IDCAMS  SYSTEM SERVICES
LISTING OF DATA SET -CSCJEB.CSC.CUST5D.VS
KEY OF RECORD - 0263
0263DONNA BEHRENS
KEY OF RECORD - 0471
0471DAVID BUTTNER
KEY OF RECORD - 0784
0784NANCY CASTLE
KEY OF RECORD - 1195
1195SUSAN DOMBEK
KEY OF RECORD - 1234
1234STEVE SAMUELS
KEY OF RECORD - 1584
1584JOEL BERNSTEIN
KEY OF RECORD - 1873
1873MARGARET KNIGHT
KEY OF RECORD - 1962
1962JOSEPH GLIDDEN
KEY OF RECORD - 2306
2306JAY FOX

VSAM SUBSTITUTE SAMPLE DATA

0263DONNA BEHRENS
0471DAVID BUTTNER
0784NANCY CASTLE
1195SUSAN DOMBEK
1234STEVE SAMUELS
1584JOEL BERNSTEIN
1873MARGARET KNIGHT
1962JOSEPH GLIDDEN
2306JAY FOX
2351WILLIAM PAINTER

DEFINE INFOIN

                          FD HUNT-FILE
  000037                     BLOCK CONTAINS 0 RECORDS
  000038                     RECORD CONTAINS 80 CHARACTERS
  000039                     RECORDING MODE IS F
  000040                     LABEL RECORDS ARE STANDARD
  000041                     DATA RECORD IS INV-REC.
  000042             01 INV-REC.
  000043                     05                                        PIC
X(2).
  000044                     05 CUSTOMER-NUMBER      PIC X(4).
  000045                     05                                        PIC
X(2).
  000046                     05 MOVIE-NUMBER              PIC X(3).
  000047                     05                                        PIC
X(2).
  000048                     05 MOVIE-NAME                  PIC X(26).
  000049                     05                                        PIC
X(1).
  000050                     05 STORE-NUMBER              PIC X(1).

Sample HUNT-FILE data:

1234  145  THE GOOD, BAD AND UGLY       1
1234  820  DR. STRANGELOVE                    2
1234  371  FRIDAY THE 13TH                       4
1234  921  THE BLUES BROTHERS              2
1584  921  THE BLUES BROTHERS              4
1584  755  LAVENDER HILL MOB                 2
7240  157  STREETCAR NAMED DESIRE     3
7240  401  IS PARIS BURNING                     5

Set up the table

                 01 MOVIE-TABLE.
  000104        05 INFO OCCURS 0 TO 50 TIMES DEPENDING ON COUNTX
  000105             ASCENDING KEY IS TAB-CUST-NUM
  000106               INDEXED BY MOVIE-IND.
  000107       10 TAB-CUST-NUM     PIC X(4).
  000108       10 TAB-CUST-NAME    PIC X(20).
  000109       01 COUNTX                 PIC 99 COMP VALUE 0.
  000110       01 SUBX                   PIC 99 COMP.

set up the data to search for a match

 000122     100-BEGIN.
  000123           OPEN INPUT INFILE.
  000124           OPEN OUTPUT REPORT-OUT.
  000125           READ INFILE.
  000126           IF VSAM-CODE = '00'
  000127                ADD 1 TO COUNTX
  000128          ELSE
  000129               MOVE 'YES' TO SWITCH.
  000130
  000131      200-LOADER.
  000133             MOVE CUST-NUM TO TAB-CUST-NUM(COUNTX).
  000134             MOVE CUST-NAME TO TAB-CUST-NAME(COUNTX).
  000135            READ INFILE.
  000136            IF VSAM-CODE = '00'
  000137                 ADD 1 TO COUNTX
  000138           ELSE
  000139             MOVE 'YES' TO SWITCH.

do the search

                           500-SEARCH-ROUTINE.
  000163                     SEARCH ALL INFO AT END PERFORM
550-NOT-THERE-ROUTIN
  000164                        WHEN TAB-CUST-NUM (MOVIE-IND) =
CUSTOMER-NUMBER
  000165                           PERFORM 560-FOUND-IT-ROUTINE.
  000166
  000167                     READ HUNT-FILE
  000168                       AT END MOVE 'YES' TO SWITCH
   000169                     END-READ.

This is the output.

1234 NOT IN TABLE
1234 NOT IN TABLE
1234 NOT IN TABLE
 1234 NOT IN TABLE
1584 NOT IN TABLE
1584 NOT IN TABLE
7240 NOT IN TABLE
7240 NOT IN TABLE
7240 NOT IN TABLE
7240 NOT IN TABLE
7240 NOT IN TABLE
7240 NOT IN TABLE

etc through the entire HUNTFILE table.
I have done with both 9's and X's in TAB-CUST-NUM and CUSTOMER NUMBER.

Any suggestions?

Thanks

Craig



Tue, 26 Sep 2000 03:00:00 GMT  
 VSAM Problems

Quote:

> I wrote a binary search program (which worked fine) on Micro Focus Personal
> COBOL.
> It then has to uploaded and run on the mainframe. One of the files is a vsam
> file. We were provided with a
> substitute file for Micro Focus .
> I can't get a match in the search using the VSAM but it works with the
> substitute.

> Then I set up instuff.

>   000015                     SELECT HUNT-FILE ASSIGN TO INFOIN.
>   000016                     SELECT INFILE ASSIGN TO INSTUFF
>   000017                           ORGANIZATION IS INDEXED
>   000018                           ACCESS IS RANDOM

Based on your table loading logic, I believe you should have used the
'ACCESS IS SEQUENTIAL' clause instead.

Quote:
>   000019                           RECORD KEY IS CUST-NUM
>   000020                           FILE STATUS IS VSAM-CODE.

>  000122     100-BEGIN.
>   000123           OPEN INPUT INFILE.
>   000124           OPEN OUTPUT REPORT-OUT.
>   000125           READ INFILE.

If you are truly going to access the file randomly, you ought to specify
the key of the record you plan to read.  I think you really want to
access the file sequentially.

Quote:
>   000126           IF VSAM-CODE = '00'
>   000127                ADD 1 TO COUNTX
>   000128          ELSE
>   000129               MOVE 'YES' TO SWITCH.
>   000130
>   000131      200-LOADER.
>   000133             MOVE CUST-NUM TO TAB-CUST-NUM(COUNTX).
>   000134             MOVE CUST-NAME TO TAB-CUST-NAME(COUNTX).
>   000135            READ INFILE.
>   000136            IF VSAM-CODE = '00'
>   000137                 ADD 1 TO COUNTX
>   000138           ELSE
>   000139             MOVE 'YES' TO SWITCH.

I hope that helps!

Arnold Trembley
Software Engineer I (just a job title, still a programmer)
MasterCard International
"Y2K?  Because Centuries Happen!"
Time Machine reports at  http://home.att.net/~arnold.trembley



Wed, 27 Sep 2000 03:00:00 GMT  
 VSAM Problems

Quote:

>   000015                     SELECT HUNT-FILE ASSIGN TO INFOIN.
>   000016                     SELECT INFILE ASSIGN TO INSTUFF
>   000017                           ORGANIZATION IS INDEXED
>   000018                           ACCESS IS RANDOM
>   000019                           RECORD KEY IS CUST-NUM
>   000020                           FILE STATUS IS VSAM-CODE.

> Any suggestions?

The search reports correctly.  The entry is not in the table.  You need
to change the access is RANDOM to ACCESS IS DYNAMIC in order to read all
the records in the file.


Fri, 29 Sep 2000 03:00:00 GMT  
 VSAM Problems

 000018                           ACCESS IS RANDOM

Quote:

> Based on your table loading logic, I believe you should have used the
> 'ACCESS IS SEQUENTIAL' clause instead.

I said "Dynamic" because I "assumed" the same program was loading the
VSAM file from the raw data - that might not be in sorted sequence.


Fri, 29 Sep 2000 03:00:00 GMT  
 VSAM Problems

Quote:


>  000018                           ACCESS IS RANDOM

> > Based on your table loading logic, I believe you should have used the
> > 'ACCESS IS SEQUENTIAL' clause instead.

> I said "Dynamic" because I "assumed" the same program was loading the
> VSAM file from the raw data - that might not be in sorted sequence.

I got a reply from the original author saying that ACCESS SEQUENTIAL
solved the problem.  The big clue for me was that the program worked on
the PC with a flat file, and failed with the VSAM file.  Of course,
maybe I just got lucky.  I didn't look at it in too much detail.

Regards,

Arnold Trembley
Software Engineer I (just a job title, still a programmer)
MasterCard International
"Y2K?  Because Centuries Happen!"



Sun, 01 Oct 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VSAM problems re; cobol/os vs cobol/mvs

2. VSAM VM/CMS problem

3. VSAM Knowledge Base (Was Help with VVDS problem)

4. vsam algorithms?

5. VSAM size limits?

6. VSAM Buffers in a SYSUDUMP

7. Record Count On VSAM File Under CICS

8. How to alter DDNAME in a VSAM ACB?

9. VSAM & Storage Protection

10. Rexx interface to VSAM

11. VSAM question

12. VSAM: SHOWCAT macro

 

 
Powered by phpBB® Forum Software