Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing indexed VSAM dataset from TSO/REXX

152 views
Skip to first unread message

Bruce Goodman

unread,
Oct 8, 1996, 3:00:00 AM10/8/96
to

I am trying to find a way to read records from a indexed VSAM file through a
REXX routine. I know that I can probably open the dataset and process the
records sequentially, however, I would much rather process the information
randomly via the KEY.

Any suggestions would be greatly appreciated!

Bruce Goodman......BGOODMAN@PROBE.NET


Gilbert Saint-flour

unread,
Oct 10, 1996, 3:00:00 AM10/10/96
to

In <334.6855...@probe.net>, bgoo...@probe.net (Bruce Goodman) writes:
>I am trying to find a way to read records from a indexed VSAM file through a
>REXX routine. I know that I can probably open the dataset and process the
>records sequentially, however, I would much rather process the information
>randomly via the KEY.

Use OUTTRAP to trap the output of a PRINT command.
It's crude, but it works.

Or use the RXVSAM routine written by Mark Winges.

Or buy REXXTOOLS.

Kevin McGrath

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

A quick-enough and not-TOO-dirty solution for keyed-VSAM access is below.
Sorry the code is so ugly - I did this once, but couldn't find the original,
so I flung this together and tested it.
* Not real efficient, so stick to low-volume applications.
* You can also do this in REXX batch if you need to, but you'll have to
recode it.
* You can also update the record and rewite it with REPRO REPLACE!
* I picked a VSAM file with large records and non-printable characters
in the key. Works just fine.

As Gilbert said, the best approach is a proper VSAM interface.....

Kevin

/* Rexx */
trace ?r; nop
Address TSO
/* Max LRECL = 8800, avg = 6600, key len = 45, key offset +4 */
VSAM = 'QA10.TEST.BOM'
VSAM_key = '10'x||'BBA-P' /* key = 10x + partial char key */
SEQ = 'BESKLM.TEST.VSAMTEMP'
"ALLOC DA('"VSAM"') FILE(VSAM) SHR"
"DEL '"SEQ"'"
"ALLOC DA('"SEQ"') FILE(FLATFILE) NEW",
"SPACE(10 10) TRACK UNIT(BABDA)", /* Pick size and unit */
"RECFM(V B) LRECL(8804) BLKSIZE(0)" /* MAX VSAM LRECL + 4 */
"VERIFY FILE(VSAM)"
X = OUTTRAP('VSAMmsg.')
"REPRO INFILE(VSAM) OFILE(FLATFILE) FROMKEY('"VSAM_key"') COUNT(1)"
X = OUTTRAP('off')
"ALLOC DA('"SEQ"') FILE(FLATFILE) SHR REUSE"
Do i = 1 to VSAMmsg.0
Say VSAMmsg.i
/* Deal with errors here. */
End
"EXECIO * DISKR FLATFILE(STEM RECORD. OPEN FINIS)"
Do i = 1 to record.0
Say record.i
/* Parse out your record here. */
End
"FREE FI(VSAM FLATFILE)"

0 new messages