IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Unable to update PS using following REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sshakya2

New User


Joined: 23 Dec 2010
Posts: 17
Location: Mumbai, India

PostPosted: Mon Jun 25, 2012 2:41 pm
Reply with quote

Hi,
I am a newbie to REXX, trying to update 8th Row of a flat file using following REXX.


"ALLOC DA('MY.DDNAME.FILE') F(UPDATEDD) MOD"
"EXECIO 1 DISKRU UPDATEDD 2 (LIFO"
PULL 8
PUSH '// SET PACKN='INPUTVAR
"EXECIO 1 DISKW UPDATEDD (FINIS"
"FREE F(UPDATEDD)"

What is wrong with this piece of code. I am unable to findout any error. It is running without any errors but not updating my flat file. Please help !
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jun 25, 2012 3:56 pm
Reply with quote

Try this

Code:
"ALLOC DA('MY.DDNAME.FILE') F(UPDATEDD) OLD"
"EXECIO 8 DISKRU UPDATEDD(LIFO"
PULL LINE
PUSH '// SET PACKN='INPUTVAR
"EXECIO 1 DISKW UPDATEDD (FINIS"
"FREE F(UPDATEDD)"
Back to top
View user's profile Send private message
sshakya2

New User


Joined: 23 Dec 2010
Posts: 17
Location: Mumbai, India

PostPosted: Mon Jun 25, 2012 4:15 pm
Reply with quote

Thanks !!! wat was my mistake ??
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jun 25, 2012 4:21 pm
Reply with quote

You should be able to tell me that icon_wink.gif
Back to top
View user's profile Send private message
sshakya2

New User


Joined: 23 Dec 2010
Posts: 17
Location: Mumbai, India

PostPosted: Mon Jun 25, 2012 4:27 pm
Reply with quote

Looks like i was trying to change the colour of a wall and was pointing the brush onto the Table icon_smile.gif icon_smile.gif
Back to top
View user's profile Send private message
sshakya2

New User


Joined: 23 Dec 2010
Posts: 17
Location: Mumbai, India

PostPosted: Mon Jul 02, 2012 10:51 am
Reply with quote

Achieved it by reading it into a STEM and changing the particular occurances of the Array.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jul 02, 2012 2:27 pm
Reply with quote

You should note carefully the differences in the 2nd and 3rd lines between your code and Pandor-Box's code
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 02, 2012 6:41 pm
Reply with quote

Hello,

You should also reconsider your approach. . .

Well organized places do not let a process update the input sequential file.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jul 03, 2012 1:43 am
Reply with quote

If all you wanted to do was update the 8th record of a dataset, this is all the code that you would've needed:

Code:

/* REXX */
"EXECIO 1 DISKRU updatedd 8"                     
Parse Pull inrec                                 
inrec = Strip(inrec)" ** Updated **"             
Push inrec                                       
"EXECIO 1 DISKW updatedd (FINIS"                 
Exit 0


Results:

Before:

Code:

This is test record 1 of 9.
This is test record 2 of 9.
This is test record 3 of 9.
This is test record 4 of 9.
This is test record 5 of 9.
This is test record 6 of 9.
This is test record 7 of 9.
This is test record 8 of 9.
This is test record 9 of 9.


After:

Code:

This is test record 1 of 9.                             
This is test record 2 of 9.                             
This is test record 3 of 9.                             
This is test record 4 of 9.                             
This is test record 5 of 9.                             
This is test record 6 of 9.                             
This is test record 7 of 9.                             
This is test record 8 of 9. ** Updated **               
This is test record 9 of 9.                             
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top