MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CLIST:Extract matched members from 2 lists & put in a ta

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
nguyenh
Beginner


Joined: 09 Mar 2004
Posts: 52
Topics: 6

PostPosted: Fri Jul 01, 2005 4:54 pm    Post subject: CLIST:Extract matched members from 2 lists & put in a ta Reply with quote

Hi expert,
CLIST question: Could someone please show me how to extract matched members(OMEM & NMEM) from OLDLIST and NEWLIST and put them in MTABLE, assume I have MTABLE created, OLDLIST and NEWLIST opened

Thank you very very much!
nguyenh

Code:


DO WHILE (&NOTEMPTY = 0)
  ISPEXEC LMMLIST DATAID(&OLDLIST) OPTION(LIST) MEMBER(OMEM)
  IF (&LASTCC > 8) THEN +
   DO
      ISPEXEC SETMSG MSG(MS1)
      ISPEXEC LMCLOSE DATAID(&OLDLIST)
      LMFREE DATAID(&OLDLIST)
      SET NOTEMPTY  = 1
    END

  ISPEXEC LMMLIST DATAID(&NEWLIST) OPTION(LIST) MEMBER(NMEM)
  IF (&LASTCC > 8) THEN +
    DO
      ISPEXEC SETMSG MSG(MS2)
      ISPEXEC LMCLOSE DATAID(&NEWLIST)
      LMFREE DATAID(&NEWLIST)
      SET NOTEMPTY = 1
    END
END
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Fri Jul 01, 2005 9:08 pm    Post subject: Reply with quote

If you are doing anything with string processing I would absolutely avoid CLIST and use Rexx instead. CLIST is absolutely AWFUL at string parsing. Rexx is extremely easy to use and has a built in Parse instruction along with many, many useful string processing builtin functions.

As for the problem at hand, with Rexx, use EXECIO to read the file, Parse to extract the data from the listing, and ISPF's TBCREATE, TBADD, etc to handle the table. Search the 'net for examples. There should be many out there.

I know you asked about CLIST, but I can't bring myself to encourage anyone to do anything but the most trivial list of commands with CLIST.
Back to top
View user's profile Send private message Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Fri Jul 01, 2005 9:12 pm    Post subject: Reply with quote

Ooops... I assumed you were parsing a SuperC listing which can list matching members. Still, Rexx is the answer because you can call ISPF services and create lists of items like member names and then programatically compare them. The easiest way is to use Rexx "stem" variables, but you can just make 2 variables containing member names and loop through those variables (hint: wordpos())
Back to top
View user's profile Send private message Visit poster's website
nguyenh
Beginner


Joined: 09 Mar 2004
Posts: 52
Topics: 6

PostPosted: Tue Jul 05, 2005 4:10 pm    Post subject: Reply with quote

Hi Experts,
I Thank you for all replies. For my first question I figured out the following code would give me the result that I want.

[code:1:f7484ef247]/*****************************************************************/
/* WRITE MEMBER NAMES THAT EXIST IN BOTH OLDLIST & NEWLIST */
/* INTO DIFFER TABLE */
/*****************************************************************/
SET RC = 0
DO WHILE (&RC = 0)
ISPEXEC LMMFIND DATAID(&NEWLIST) MEMBER(&OMEM) STATS(YES)
SET RC = &LASTCC
IF (&RC > 8) THEN +
DO
ISPEXEC SETMSG MSG(PD011N) /* LMMFIND ERROR */
GOTO CLEANUP
END
ELSE
IF (&RC = 0 ) THEN +
DO
SET TTLEN = &OMEM
ISPEXEC TBADD DIFFER
SET RC = &LASTCC
IF (&RC
Back to top
View user's profile Send private message
nguyenh
Beginner


Joined: 09 Mar 2004
Posts: 52
Topics: 6

PostPosted: Tue Jul 05, 2005 4:45 pm    Post subject: Reply with quote

Just to be more clear,
I only want to process those members that have the following names: FILExx, FMT2, SM2, SM4, etc., where xx is 00-99
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Tue Jul 05, 2005 4:47 pm    Post subject: Reply with quote

Nguyenh,

You should use the &SUBSTR builtin function:

Code:

IF &SUBSTR(1:4,&OMEM) = FILE THEN +
   do this



Here's the manual link:


http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4B820/6.7?DT=20020717155508


Cheers,
Merv
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
nguyenh
Beginner


Joined: 09 Mar 2004
Posts: 52
Topics: 6

PostPosted: Wed Jul 06, 2005 9:37 am    Post subject: Reply with quote

Mervyn,

Thank you for your help. That is exactly what I am looking for.
You guys are great!

Thanks!
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Wed Jul 06, 2005 9:41 am    Post subject: Reply with quote

So are the manuals!

Wink
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group