View previous topic :: View next topic
|
Author |
Message |
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Thanks !!! wat was my mistake ?? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
You should be able to tell me that |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Looks like i was trying to change the colour of a wall and was pointing the brush onto the Table |
|
Back to top |
|
|
sshakya2
New User
Joined: 23 Dec 2010 Posts: 17 Location: Mumbai, India
|
|
|
|
Achieved it by reading it into a STEM and changing the particular occurances of the Array. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You should note carefully the differences in the 2nd and 3rd lines between your code and Pandor-Box's code |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You should also reconsider your approach. . .
Well organized places do not let a process update the input sequential file. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
|