View previous topic :: View next topic
|
Author |
Message |
GaneshKarunyarajan
New User
Joined: 12 Apr 2005 Posts: 13
|
|
|
|
Hi,
I'm trying to read multiple members in the dataset and change values in it. I used LM, but the last few lines from first file is getting appended in the second file. I think the buffer is not getting reset. But not sure how to clear the buffer and then read the next file.
Any help on this will be really greatfull.
Regards,
Ganesh.K |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Show us the code. Especially the 'buffer' part. Please elaborate on 'LM'. |
|
Back to top |
|
|
GaneshKarunyarajan
New User
Joined: 12 Apr 2005 Posts: 13
|
|
|
|
Code: |
ADDRESS 'ISPEXEC'
"LMINIT DATAID(INPUTDD) DATASET('"DATASET"') ENQ(SHRW)"
"LMOPEN DATAID("INPUTDD") OPTION(INPUT)"
MBR = ' '
SAVERC = 0
DO WHILE (SAVERC = 0) & (ENDNOW \= 'Y')
"LMMLIST DATAID("INPUTDD") MEMBER(MBR) OPTION(LIST) STATS (NO)"
SAVERC = RC
"ISREDIT MACRO PROCESS"
ADDRESS ISREDIT "MACRO "
ADDRESS ISREDIT "(DS) = DATASET"
ADDRESS ISREDIT "(MEM) = MBR"
PDS_DSNAME = "'" || DATASET || "(" || MBR || ")'"
SRCFILE = PDS_DSNAME
SAY "DATASET:" SRCFILE
ADDRESS TSO "ALLOCATE DDNAME(SOURCE) DSN(" || SRCFILE || ") SHR"
ADDRESS TSO "EXECIO * DISKR SOURCE (STEM COUNT. FINIS"
DO J = 1 TO COUNT.0
LINE = COUNT.J
SELECT
WHEN THEN DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
END
OTHERWISE DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
SAY 'JOB2' DBCHG DBCHG1
END
ADDRESS TSO "EXECIO * DISKW SOURCE (STEM OUT. FINIS"
ADDRESS TSO "FREE F(SOURCE)"
ADDRESS ISREDIT "END"
END
"LMCLOSE DATAID("INPUTDD")"
"LMFREE DATAID("INPUTDD")"
|
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Quote: |
Your code is not what you use, there is no way in the world that the above junk will work. |
Must admit, I'm a bit confused as to what the OP hopes to achieve, because I can't find out from the code.
Maybe if the OP could tell us exactly what it is that needs to be achieved then we can at least suggest something practicle and readable.
If my first thoughts are correct and changes are required, surely an edit macro would be a zillion times faster than reading every member that needs change.
And ............................ Use the code tags !!! |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ GaneshKarunyarajan !
You can loop-up the memberlist of the PDS and edit every member with an edit-macro, where your changes are defined.
REXX-Proc:
"ISREDIT MACRO (editmac)"
"ISREDIT (openpds) = DATAID"
"ISREDIT (openmbr) = MEMBER"
address ispexec
"LMOPEN DATAID("openpds") OPTION(INPUT)"
mbr = ' '
listrc = 0
do while listrc = 0
"LMMLIST DATAID("openpds") MEMBER(mbr) OPTION(LIST) STATS(NO)"
listrc = rc
if listrc = 0 & mbr <> openmbr then do
"EDIT DATAID("openpds") MEMBER("mbr") MACRO("editmac")"
end
end
"LMMLIST DATAID("openpds") OPTION(FREE)"
"LMCLOSE DATAID("openpds")"
exit
Edit-Macro:
ISREDIT MACRO
ISREDIT C 'IE202' 'J150630' ALL
ISREDIT SAVE
ISREDIT END |
|
Back to top |
|
|
GaneshKarunyarajan
New User
Joined: 12 Apr 2005 Posts: 13
|
|
|
|
Thanks a lot for your reply...
Do I have to define the Edit Macro in a seperate file or in the same one |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Separate member.
O. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Use a separate member in the same PDS.
Quote: |
I'm trying to read multiple members in the dataset and change values in it. |
You describe the problem as two parts (separated by AND). My suggestion is, in these kinds of complicated situations, to break up your program into two parts, as UmeySan has shown. |
|
Back to top |
|
|
GaneshKarunyarajan
New User
Joined: 12 Apr 2005 Posts: 13
|
|
|
|
As you all suggested, I defined a seperate Macro and tried to read all the lines of the member and look for my check and changing it.
Now on the Edit Mac I have my coding. It is not able to recognizethe dataset. I think we have to pass the dataset value in the
"EDIT DATAID("openpds") MEMBER("mbr") MACRO("editmac")"
but I'm not sure how to pass
Editmac:
=======
"ISREDIT MACRO PROCESS"
ADDRESS ISREDIT "MACRO "
ADDRESS ISREDIT "(DS) = DATASET"
ADDRESS ISREDIT "(MEM) = MBR"
PDS_DSNAME = "'" || DATASET || "(" || MBR || ")'"
SRCFILE = PDS_DSNAME
SAY "DATASET:" SRCFILE
ADDRESS TSO "ALLOCATE DDNAME(SOURCE) DSN(" || SRCFILE || ") SHR"
ADDRESS TSO "EXECIO * DISKR SOURCE (STEM COUNT. FINIS"
DO J = 1 TO COUNT.0
LINE = COUNT.J
SELECT
WHEN ws-1 = "XXX" THEN DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
END
WHEN ws-2 = "XXX" THEN DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
END
WHEN ws-3 = "XXX" THEN DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
END
OTHERWISE DO
OUT.COUNTER = Line
COUNTER = COUNTER + 1
SAY 'JOB2' DBCHG DBCHG1
END
ADDRESS TSO "EXECIO * DISKW SOURCE (STEM OUT. FINIS"
ADDRESS TSO "FREE F(SOURCE)"
ADDRESS ISREDIT "END" |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Your original program mixed editor macro functions with execio functions, we all thought you wanted to used editor functions.
When you are using the editor macro, you do not need to use EXECIO to read the file. If I understand what you are trying to do, I suggest writing your editor macro to use FIND and FIND_COUNTS services. See the Editor manual for more information.
--OR-- you could do it with EXECIO instead of an editor macro. But you should not use EXECIO within the editor macro. |
|
Back to top |
|
|
|