View previous topic :: View next topic
|
Author |
Message |
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
Code: |
/* REXX */
"EXECIO 1 DISKRU ENTRIES 3 (STEM LIST."
LIST.1=55
"EXECIO * DISKW ENTRIES (STEM LIST. FINIS"
"EXECIO 1 DISKRU ENTRIES 4 (STEM LIST."
LIST.1=66
"EXECIO * DISKW ENTRIES (STEM LIST. FINIS"
"EXECIO 1 DISKRU ENTRIES 5 (STEM LIST."
LIST.1=77
"EXECIO * DISKW ENTRIES (STEM LIST. FINIS" |
above code updates file records one by one. I want to do the above task in minimum number of lines. Please suggest your ideas.
I have 2 options :
1. use loop
2. use "EXECIO N DISKRU ENTRIES 5(STEM LIST." & proceed --
where N stands for more than one record under Read with Update control. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Efficient use of DISKRU in REXX ! |
thats a nice IT oxymoron
You can do it in a loop only if also the data to be written can be made dependent on a loop variable!
but You have not given any hint taht it would be so.
anyway UPDATING a PS dataset, even if the language used allows it is a bad, very bad practice
the process might not be repeatable in case of failures |
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
i understand enrico, but still technically i want to know it.
this can work i think, take it in a sample example way :
Code: |
DO X=4 to 6
"EXECIO 1 DISKRU ENTRIES X(STEM LIST."
LIST.1=X
"EXECIO * DISKW ENTRIES (STEM LIST. FINIS"
END |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
it is alway a bad habit to issue a diskw without an explicit count
if the stem is not <clean> You might get unpleasant results
( a couple of flamig discussion on the subject in the forums ) |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
rohanthengal, your approach seems OK to me. I guess that a loop would work if you had a bunch of updates to make. Don't forget that you can only update the last record read. I guess it's ultimately up to you to decide if this approach is better, or does it make more sense to just read the entire dataset in stem variables, update the stem variables you need to, and then just re-write the entire dataset. |
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
thanks a lot enrico n superk, for providing the info.
i got the major breakthrough for which i was looking for.Thanks once again.
Quote: |
Don't forget that you can only update the last record read. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If this is an experiment or some one-time requirement, it may be ok to update the input file. If this is to be run "for real", you should copy the input to a new output rather than update in place for the sequential file.
During the promotion review, a well manage organization would not allow this to be promoted.
If someone is determined to overwrite the input, a copy needs to be made before possibly destroying the original. |
|
Back to top |
|
|
|