Over write a dataset using REXX



IBM's Command List programming language & Restructured Extended Executor

Over write a dataset using REXX

Postby ravisankarc » Tue Apr 22, 2014 4:11 pm

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
ravisankarc
 
Posts: 47
Joined: Thu Aug 27, 2009 2:18 am
Has thanked: 0 time
Been thanked: 0 time

Re: Over write a dataset using REXX

 

Re: Over write a dataset using REXX

Postby NicC » Tue Apr 22, 2014 6:41 pm

And your trace showed? And your error checking showed? and where is your write statement?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Over write a dataset using REXX

Postby NicC » Tue Apr 22, 2014 6:53 pm

Worked OK for me with the correct DISKW (and dropping off the VOLUME as my dataset was cataloged).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Over write a dataset using REXX

Postby ravisankarc » Tue Apr 22, 2014 7:22 pm

I am sorry Nick, I didn't understand what do you mean. I have a correct write statement

Regards
Ravi
ravisankarc
 
Posts: 47
Joined: Thu Aug 27, 2009 2:18 am
Has thanked: 0 time
Been thanked: 0 time

Re: Over write a dataset using REXX

Postby NicC » Tue Apr 22, 2014 7:50 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Over write a dataset using REXX

Postby ravisankarc » Tue Apr 22, 2014 8:21 pm

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
ravisankarc
 
Posts: 47
Joined: Thu Aug 27, 2009 2:18 am
Has thanked: 0 time
Been thanked: 0 time

Re: Over write a dataset using REXX

Postby NicC » Tue Apr 22, 2014 8:30 pm

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
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post