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

add dummy record to VSAM (MVS) files

1,553 views
Skip to first unread message

A Farzanegan

unread,
Jan 12, 2002, 4:08:26 PM1/12/02
to
Dear All

I need to open 600 empty VSAM files (MVS mainframe) and add a dummy record
to all 600. I am fairly experienced in REXX, but have not done any VSAM work
in REXX. Can anybody help? Any example would be much appreciated.

Thanx & a belated happy new year to all

Amy


Larry Kahm

unread,
Jan 12, 2002, 4:31:12 PM1/12/02
to
I know this isn't a REXX solution, but...

If you have IBM's File Manager for z/OS and OS/390, you could use the
following sample proc and JCL. This takes an existing VSAM file and
initializes it with one record of binary zeros. You can modify it as
needed...

//DSGPROC PROC
//FILEMAN EXEC PGM=FILEMGR
//SYSPRINT DD SYSOUT=*
//FMNTSPRT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//SYSIN DD *
$$FILEM DSG OUTPUT=DDOUT,FILLCHAR=x'00',DISP=OLD,NLRECS=1
/*

In your JCL, all you would need would be

//VSAMINIT EXEC DSGPROC
//DSGPROC.DDOUT DD DISP=OLD,DSN=any.vsam.file.to.initialize

Simply repeat the DDOUTstatement for each data set that you need.

I guess you could use a REXX routine to supply all of the data set names to
the JCL.

Larry Kahm

unread,
Jan 12, 2002, 4:43:34 PM1/12/02
to
I am really sorry! I >forgot< that there was a direct REXX interface in
File Manager - here's all you would need:

/* REXX */
/* Invoke File Manager to initialize a VSAM file (low value records) */
FILEMGR "$DSG
DDOUT='any.vsam.file.to.initialize',FILLCHAR=x'00',DISP=OLD,NLRECS=1"
intRCode = RC
If intRCode > 0 Then
Say 'File Manager DSG function ended RC='intRCode

Depending on the data set names you are going to need, you could use some of
File Manager's other built-in functions to build the list and loop through
each of the names.

Joel C. Ewing

unread,
Jan 12, 2002, 5:35:39 PM1/12/02
to
Unless you have a 3rd-party vendor add-on product (e.g., OpenSoft
REXXTOOLS), I don't believe you can access VSAM files directly from
REXX; but your REXX EXEC can invoke other utility programs or TSO
Commands that can write to VSAM. Lacking direct VSAM support I would be
tempted to try something like

Allocate a file to DD(DUMYREC) (on VIO for efficiency) with LRECL
appropriate for your dummy record.
Write your dummy record to DUMYREC, closing the file.
Invoke TSO REPRO: REPRO IFILE(DUMYREC) ODS('VSAM-dsname') .

For each VSAM file needing the same dummy record, invoke REPRO with
appropriate ODS. For each file with different dummy record
requirements, FREE DD(DUMYREC) and repeat the above process creating a
new DUMYREC and dummy record with appropriate attributes. Not
particularly elegant, but should work.

Since VSAM considers all records in a KSDS to be variable length, VSAM
only requires your dummy record to be large enough to contain the key
field(s), but your applications that access the files might impose
additional requirements.

--
Joel C. Ewing, Fort Smith, AR jce...@acm.org

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Sam Knutson

unread,
Jan 13, 2002, 11:28:03 AM1/13/02
to
>Unless you have a 3rd-party vendor add-on product (e.g., OpenSoft
>REXXTOOLS), I don't believe you can access VSAM files directly from
>REXX

RXVSAM written by Mark Winges and enhanced by
Rob Van Riel is an excellent open source freeware
function package for REXX to provide access to VSAM files.

http://www.cbttape.org/ftp/cbt/CBT268.zip

http://www.cbttape.org


We use it at Landmark pretty extensively in a large home grown REXX application
that packages SYSMODs and it has proved very reliable overy the past several
years of heavy use.

Best Regards,

Sam Knutson

Fred M.

unread,
Jan 16, 2002, 11:39:11 AM1/16/02
to
All you have to do is allocate both the vsam file and a flat file that
contains the fill record then issue the following command.

"ALLOC F(indd) DA("infile") SHR"
"ALLOC F(otdd) DA("outfile") SHR"
"REPRO INFILE(indd) OUTFILE(outdd)"
"Free f(indd)"
"Free f(outdd)"

That's it, no third party software is needed. Idcams commands work
from within REXX.

Fred Maestas
My opinions are my own....


"A Farzanegan" <ahmad.fa...@virgin.net> wrote in message news:<1tW%7.22205$ru2.290734@NewsReader>...

Larry Kahm

unread,
Jan 16, 2002, 3:17:59 PM1/16/02
to
Caution: when using REPRO in your example, you need to specify a
one-for-one match of input record to each unique record length.


Fred M.

unread,
Jan 17, 2002, 3:07:32 PM1/17/02
to
You are correct. It would be simple though, to do a listcat on the
vsam file, get the maxlrecl, create a string and write it to a VIO
file, then allocat the files and do the repro.

Fred M....

"Larry Kahm" <lk...@bellatlantic.net> wrote in message news:<Xdl18.2749$pQ5...@nwrddc01.gnilink.net>...

0 new messages