Page 1 of 2

Write VSAM file thru rexx

PostPosted: Mon Oct 22, 2018 1:57 am
by arya_starc
I write a rexx, in which user enter the value in tso and I pull that value thru rexx.I need to write that particular value in VSAM file.
Code is working fine when I am using PS file for write but it is getting fails for VSAM file.

IRX0553E The input or output file OU2 must be allocated to a sequential data se
t, or single member of a partitioned data set.                                  
IRX0670E EXECIO error while trying to GET or PUT a record.
 


As per error, I need to used only sequential file is it?
If not,Please tell how can I write in vsam file thru rexx.

Re: Write VSAM file thru rexx

PostPosted: Mon Oct 22, 2018 3:43 am
by Robert Sample
REXX does not natively support VSAM access. You can install RXVSAM at your site to do this, but without installing the program (or writing a subprogram in the language of your choice to do the access) you will not be able to access VSAM data sets with your REXX code.

Re: Write VSAM file thru rexx

PostPosted: Mon Oct 22, 2018 11:37 am
by expat
The only way in which I have accessed VSAM within a REXX is by invoking IDCAMS.

It's O)K for a small number of records calls and updates, but most definitely not the way to go with many

Re: Write VSAM file thru rexx

PostPosted: Mon Oct 22, 2018 2:05 pm
by willy jensen
REXX has no native VSAM support, but www.cbttape.org has at least 2 free programs for accessing VSAM:
RXVSAM in file 268 for reading and writing record-by-record
RXVSAMBA in file 699 for reading and write blocks of records to/from stem.

Re: Write VSAM file thru rexx

PostPosted: Mon Oct 22, 2018 5:42 pm
by willy jensen
If you only want to write then you can write the records to a sequential dataset and use the REPRO command to update the VSAM cluster.

Re: Write VSAM file thru rexx

PostPosted: Tue Oct 23, 2018 5:12 pm
by arya_starc
I works in company as a mainframe engineer, installation of other utilities will cost to company.
that seems a complicated process.

Re: Write VSAM file thru rexx

PostPosted: Tue Oct 23, 2018 5:13 pm
by arya_starc
expat wrote:The only way in which I have accessed VSAM within a REXX is by invoking IDCAMS.

It's O)K for a small number of records calls and updates, but most definitely not the way to go with many



In my case there are only few records, so I am going with the approach as you suggested but I am getting below error.



IDC4999I UABORT CODE 36                    
IEC130I AMSDUMP  DD STATEMENT MISSING      
IKJ56247I FILE INDD1 NOT FREED, IS NOT ALLOCATED      
IKJ56247I FILE OUTDD1 NOT FREED, IS NOT ALLOCATED    
IKJ56247I FILE SYSOUT NOT FREED, IS NOT ALLOCATED    
IKJ56247I FILE SYSPRINT NOT FREED, IS NOT ALLOCATED  
0
 
 



Below is the idcams utility code that I added in my rexx code


STMTV = "MY.TEST1.KE"                        
STMTP = "MY.TEST1.SE"                        
ADDRESS TSO                                              
SORTQ.1  = "  REPRO INFILE(INDSN) OUTFILE(OUTDSN) REPLACE"
"ALLOC FI(INDSN)    DSN('"STMTP"') SHR"                  
"ALLOC FI(OUTDSN)   DSN('"STMTV"') SHR"                  
"ALLOC DD(SYSIN) NEW REU RECFM(F B) LRECL(80)"            
"EXECIO 2 DISKW SYSIN (STEM SORTQ. FINIS"                
"CALL *(IDCAMS)"                                          
"FREE FI(INDD1)"                                          
"FREE FI(OUTDD1)"                                        
"FREE FI(SYSOUT)"                                        
"FREE FI(SYSPRINT)"                                      
"FREE FI(SYSIN)"                                          
SRTRC = RC                                                
say srtrc  
 
 



Thanks in advance.
arya_starc

Re: Write VSAM file thru rexx

PostPosted: Tue Oct 23, 2018 6:07 pm
by willy jensen
I wrote 'use the REPRO command', not IDCAMS.
Here is how:
ADDRESS TSO                                              
"ALLOC FI(INDD)    DSN('"STMTP"') SHR REUSE"                  
"ALLOC FI(OUTDD)   DSN('"STMTV"') SHR REUSE"  
"REPRO INFILE(INDD) OUTFILE(OUTDD) REPLACE"
"FREE FI(INDD OUTDD)"

Note that records must be sorted.

Re: Write VSAM file thru rexx

PostPosted: Tue Oct 23, 2018 6:09 pm
by willy jensen
Your program fails because you haven't allocated SYSPRINT. The other error messages are because the ddnames in the FREE commands differ from the ones ALLOCATED.

Re: Write VSAM file thru rexx

PostPosted: Thu Oct 25, 2018 11:35 am
by arya_starc
Thanks Willy.
I got the expected result by using repro.