Page 1 of 1

Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 4:11 pm
by ravisankarc
Hi,

I coded a rexx program and it is working fine. But the problem is it is not updating the output dataset. Whenever, my rexx program runs it should give new values for every run. But in this case it is giving the same value. FYI, if I am manually deleting the data from output dataset then the new values are printed in output dataset, otherwise the old values are conitnuing for every run. Below is my sample code. I think I need to look at the ALLOC statements that's why I didn't pasted my whole logic.

/*REXX*/                                                         
"ALLOC FI(INDD) DA('ZADSTM.KK.ICF.DCOLLECT.VOLINFO') SHR REUSE" 
"ALLOC FI(INDD1) DA('ZADSTM.KK.ICF.DCOLLECT.DTYPREC') SHR REUSE"
"ALLOC FI(OUTDD) DA('ZADSTM.ICF.CATALOG.OUTPUT.KK') SHR REUSE   
VOLUME(SYSW01)"                                                 
"EXECIO * DISKR INDD(STEM LIN. FINIS"                           
"EXECIO * DISKR INDD1(STEM STEM4. FINIS"   

my logic

"EXECIO * DISKW OUTDD(STEM OUT. FINIS"
"FREE FI(OUTDD)"                       
"FREE FI(INDD)"                       
EXIT 0                                                     


Can somebody help me in this regard.

Thanks
Ravi Sankar

Code'd from Quote'd

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 6:41 pm
by NicC
And your trace showed? And your error checking showed? and where is your write statement?

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 6:53 pm
by NicC
Worked OK for me with the correct DISKW (and dropping off the VOLUME as my dataset was cataloged).

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 7:22 pm
by ravisankarc
I am sorry Nick, I didn't understand what do you mean. I have a correct write statement

Regards
Ravi

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 7:50 pm
by NicC
My name is Nic, no 'k', and I have no idea about your write statement because it is not shown. However, I created a simple Rexx program that allocated an input dataset, an output dataset, read the input into a stem and wrote the stem to the output dataset. I then changed the input dataset, repeated the read/write and the new input data was in the old output dataset. So, if you are not getting the results then there is something in your 'my logic' that is wrong or you are misreading something or whatever.

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 8:21 pm
by ravisankarc
I am really sorry Nic for typing your name wrongly. Actually, I wanted to delete the previous records from my output dataset, so that, once my main logic runs the output dataset will have the recent records. With the help of previous posts in this forum, now I am able to do what exactly I am looking for. Hence I am closing this topic.

Regards
Ravi

Re: Over write a dataset using REXX

PostPosted: Tue Apr 22, 2014 8:30 pm
by NicC
Apologies accepted. Glad you got your stuff sorted. For the record, this is my simple example:
/* rexx */
Trace '?I'
"ALLOC FI(INDD) DA('a.pds(pkg#)') SHR REUSE" /* first run used member foratst */
Say 'Alloc indd rc = 'rc
"ALLOC FI(OUTDD) DA('a.flatfile') SHR REUSE"
Say 'Alloc outdd rc = 'rc
"EXECIO * DISKR INDD(STEM LIN. FINIS)"
Say 'Read indd rc = 'rc
Say 'Lines read = 'lin.0
"EXECIO "lin.0" DISKw outdd(STEM lin. FINIS)"
Say 'Write outdd rc = 'rc
"free fi(indd)"
Say 'Free indd rc = 'rc
"Free fi(outdd)"
Say 'Free outdd rc = 'rc
Exit