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

Processing Multiple members


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GaneshKarunyarajan

New User


Joined: 12 Apr 2005
Posts: 13

PostPosted: Tue Sep 22, 2009 4:08 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Sep 22, 2009 4:27 am
Reply with quote

Show us the code. Especially the 'buffer' part. Please elaborate on 'LM'.
Back to top
View user's profile Send private message
GaneshKarunyarajan

New User


Joined: 12 Apr 2005
Posts: 13

PostPosted: Tue Sep 22, 2009 8:56 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Sep 22, 2009 11:30 am
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Sep 22, 2009 4:58 pm
Reply with quote

@ 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
View user's profile Send private message
GaneshKarunyarajan

New User


Joined: 12 Apr 2005
Posts: 13

PostPosted: Tue Sep 22, 2009 7:04 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Sep 22, 2009 7:21 pm
Reply with quote

Separate member.

O.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Sep 22, 2009 7:31 pm
Reply with quote

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
View user's profile Send private message
GaneshKarunyarajan

New User


Joined: 12 Apr 2005
Posts: 13

PostPosted: Tue Sep 22, 2009 8:43 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Sep 22, 2009 9:22 pm
Reply with quote

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
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top