Reading VSAM in Rexx.

Virtual Storage Access method - ESDS, KSDS, RRDS & LDS. Basic direct access method, Basic sequential -, Queued sequential -, Basic partitioned -, Indexed sequential -, Object - access method.
Post Reply
cobollearn
Registered Member
Posts: 25
Joined: Tue Jul 09, 2013 6:31 pm

Reading VSAM in Rexx.

Post by cobollearn »

[font=Arial]Hi, [/font]

[font=Arial]I searched for it but i came to know that we can not access VSAM using REXX? Is it so? Is not it possible to read a KSDS VSAM in REXX? [/font]

[font=Arial]Thanks in advance for any help.[/font]
[font=Arial] [/font]
User avatar
Akatsukami
Global Moderator
Global Moderator
Posts: 122
Joined: Tue Oct 20, 2015 3:20 am
Location: Bloomington, IL
Contact:

Re: Reading VSAM in Rexx.

Post by Akatsukami »

The EXECIO command will not work with VSAM. However, there are third party extensions that will, or you can write a programette to do the I/OO and place the result into a Rexx variable.
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 825
Joined: Wed Sep 11, 2013 3:57 pm

Re: Reading VSAM in Rexx.

Post by enrico-sorichetti »

Yes , it is possible out of the box,  if Your installation has IBM file manager

http://www.ibm.com/support/knowledgecen ... /vxfun.htm

http://www.ibm.com/support/knowledgecen ... /xvfun.htm

or see file 268 of the CBT tape
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
cobollearn
Registered Member
Posts: 25
Joined: Tue Jul 09, 2013 6:31 pm

Re: Reading VSAM in Rexx.

Post by cobollearn »

Thanks enrico-sorichetti. But we don't have File-Manager.

I have searched more on it and have below examples with me now.

Using the REPRO command and a temporary non-VSAM data set, a REXX exec can use EXECIO to retrieve and update VSAM data, as shown in this example:

Code: Select all

"ALLOCATE DD(TEMPDD) NEW SPACE(1) TRACKS DSORG(PS) LRECL(4095) RECFM(V B)"
"REPRO IDS(TESTKSDS) OFILE(TEMPDD) FROMKEY('98040') COUNT(1)"
"EXECIO 1 DISKR TEMPDD"
PULL Record
"EXECIO 0 DISKR (FINIS"
"FREE DD(TEMPDD)"
 <process data in "record" variable> 

By combining the PRINT command and the OUTTRAP function, a REXX exec can retrieve VSAM records into a stem variable, as shown in the following example:

Code: Select all

x=OUTTRAP('rec.')
"PRINT IDS(TESTKSDS) FROMKEY('98040') COUNT(5) CHAR"
x=OUTTRAP('off')
DO i=1 to rec.0
 IF LEFT(rec.i,13) \= 'KEY OF RECORD' THEN
   SAY rec.i
END 

If REPRO and PRINT do not satisfy your VSAM access needs, you may use RXVSAM, a REXX function package that provides VSAM record-level functions. Here is a REXX code fragment that invokes RXVSAM to write a single record into an ESDS:

Code: Select all

"ALLOCATE FILE(VSAMDD) DSNAME('"dsn"') SHR"
rc = RXVSAM('OPENOUTPUT','VSAMDD','ESDS')
record = 'Record 1'
rc = RXVSAM('WRITE','VSAMDD',,'record')
rxvsam_result = RXVSAM('CLOSE','VSAMDD')
Last edited by Anuj Dhawan on Wed Mar 16, 2016 1:34 pm, edited 1 time in total.
Reason: Added code tags.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Reading VSAM in Rexx.

Post by nicc »

However, RXVSAM is a non-standard add-on which many (most?) sites do not have.
Regards
Nic
cobollearn
Registered Member
Posts: 25
Joined: Tue Jul 09, 2013 6:31 pm

Re: Reading VSAM in Rexx.

Post by cobollearn »

nicc wrote:However, RXVSAM is a non-standard add-on which many (most?) sites do not have.
oh...thanks for that information.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SMS & VSAM and BDAM, BSAM, QSAM, BPAM, ISAM, OAM.”