Hi,
I have to search a vsam file. Could be a partial or full key. Problem is I have 16 million input records and currently 10 vsam records to search. Customer wants vsam for added flexibility as search records grow. Ugh. This search is part of a much bigger cobol module that already takes 5 hours to run and must remain as part of the module.
There are 12 fields to the key but many times all it will take are 2 fields as a partial key to get a hit. Occasionally, all fields will be required for a hit.
I figure I have 2 options (that I can think of):
1. Prime the key and search the vsam file for every record.
2. At startup, load the high qualifiers of the vsam keys into a ws-table and then do a binary search on that partial key against the ws-table (for many records, thats all it will take to get a hit). If I get a hit THEN prime the key and search the vsam. Seems like double work, but with 16 million records to process and currently only 10 possible hits, I'm trying to minimize processing time.
So question: Is it faster to do a binary search against the working storage table or just do a search all on the vsam every time?
Thanks for any advice.
Fastest VSAM Logic
Moderator: Moderator Group
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
are you asking which process has the least amount of CPU usage:
been sitting here thinking:
use DFSORT JOINKEYS (syncsort also has JOINKEYS)
never have to worry about efficiency - a sort can read a qsam file (60,000,000 requests?) much faster that a COBOL program.
If you are not allowed to right a JOINKEYs application
I would BUFNO the DD Statements for the two QSAM files
- bouncing a register up and down local COBOL memory
- Suspending your program multiple times while requesting the API/I-O service routine
- yet another task is started within the system
- cpu resources are expended starting and maintaining the new task
- the new task also requires services
- that require new services
- ...
been sitting here thinking:
use DFSORT JOINKEYS (syncsort also has JOINKEYS)
- repro the vsam file to qsam
- use JOINKEYS to reformat for ouptut
never have to worry about efficiency - a sort can read a qsam file (60,000,000 requests?) much faster that a COBOL program.
If you are not allowed to right a JOINKEYs application
- repro the vsam to qsam
- your cobol program
- reads the sorted 60,000,000 requests
- reads the the qsam version of the vsam file
I would BUFNO the DD Statements for the two QSAM files
Last edited by dbzTHEdinosauer on Sat Apr 23, 2011 12:56 am, edited 2 times in total.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page