View previous topic :: View next topic
|
Author |
Message |
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
I have put together a REXX exec that uses library services to get a list of member information using the LMMLIST command with SAVE option so that the result is into a group dataset ( userid.groupid.MEMBERS ). This was done for one input PDS. I would like to get something together where I can take in up to 300 input datasets and run each one through the LM commands, putting the output into the same output dataset. So, for each dataset input, I would want the output information MOD'ed onto or added onto the end as each one is processed.
Another bit of info here is that the differentiating factor in each of the 300 datasets would be the high level which is the userid.
Any ideas on how best to concatenate this long list as input would be appreciated.
Thanks,
Dave |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
I would want the output information MOD'ed onto or added onto the end as each one is processed. |
And
Quote: |
Any ideas on how best to concatenate this long list as input would be appreciated.
|
I think process each dataset one at a time. And use the same rexx to open the output dataset. Keep writing until you are done all datasets.
You need to append a sequence number on line so you know what dataset it came from. |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
Actually, I am looking to not have to run a REXX job 300 times. I am really looking for something where someone has already done the inside loop of LMINIT, LMOPEN, LMMLIST, LMFREE and LMCOPY where the LMMLIST is going to create a new list which would become the input to the LMCOPY command to copy DATA1 from the LMMLIST command to a new DATA2 dataid used as output in the LMCOPY command. The outer loop logic would have to somehow bring in each dataset which would become input to the LMMLIST command. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
well good look
this is a help forum not a do it for me...
did You care to search the forums, I just checked and there are lots of code snippets
search for LMMLIST and start clicking on the results |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
I don't need good luck. I need to find out how to handle 300 datasets which would be input to a LMMLIST and LMCOPY set of instructions. The fact is that I just found that if you specify ENQ(MOD) on the output dataid, you will not get a dataid defined for the output of the LMCOPY. Has to be ENQ(SHR). Back to the drawing board for how to store and mod onto the output dataset within LM. How do you think I found that out ? By looking around on the IBM LM pages, so please, if you can't offer suggestion that is constructive, please do not respond. On the other hand, if someone has constructive suggestion, please feel free. You might help more than just me.
Thanks. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Coxdavi,
Here is some constructive advise
1) Don't mess with enrico
2) Don't tell someone with over 6000 posts not to respond. They have earned the right to say anything they want. He has helped many, many people.
3) Enrico did give you three pieces on constructive advice
A) do not wait for someone to give you code
B) search the forum
C) search for LMMLIST
4) You already have the logic worked out in you original post. Continue on with that.
5) Don't mess with Enrico |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
for today anybody can mess with me
just for today because I am in a very good mood, tomorrow I do not know
really the requirement is not so clear
I would split the process into 2 parts ...
1) get the dataset list and store it into a stem
2) process the stem
the advantage is that the dataset list can be provided in this way
1) by reading a unpatterned dataset list
2) building a dataset list with a pattern using the LMD**** stuff
or build the same using the IGGCSI interface
at this point once the dataset list is available
all depends on what process has to be done on each member
and I am desolated to say that it has not been explained too well
anyway
for the output I would not bother to use the LM*** services
if it is a PS dataset just ALLOCATE and write record by record using EXECIO
the only thing that is not clear is the output record content
once that the content is clear also the suggestions might be more useful |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
for example getting a dataset list is not that difficult
Code: |
000001 /*REXX*/
000002 Address ISPEXEC
000003 dslev="USER.*"
000004 dslst.0 = 0
000005 dsorg.0 = 0
000006 dsnlnen = 0
000007 "LMDINIT LISTID(LISTID) LEVEL("DSLEV") "
000008 /*build the dataset list and save for each the DSORG */
000009 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000010 do while ( rc = 0)
000011 i = dslst.0 + 1
000012 dslst.i = strip(dsvar)
000013 dsorg.i = strip(zdldsorg)
000014 dslst.0 = i
000015 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000016 end
000017 "LMDFREE LISTID("LISTID") "
000018 /* we have built the list */
000019 do i = 1 to dslst.0
000020 say right(i,3) dsorg.i dslst.i
000021 end
000022 exit
|
it just took me a few of minutes... PC power on, mvs IPL included
check the post timestamps
Quote: |
so please, if you can't offer suggestion that is constructive, please do not respond. |
but naturally I cannot expect the TS to appreciate the code snippet |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
and here another working sample up to the member list for a dataset list
Code: |
000001 /*REXX*/
000002 Address ISPEXEC
000003 dslev="USER.*"
000004 dslst.0 = 0
000005 dsorg.0 = 0
000006 dsnlnen = 0
000007 "LMDINIT LISTID(LISTID) LEVEL("DSLEV") "
000008 /*build the dataset list and save for each the DSORG */
000009 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000010 do while ( rc = 0)
000011 i = dslst.0 + 1
000012 dslst.i = strip(dsvar)
000013 dsorg.i = strip(zdldsorg)
000014 dslst.0 = i
000015 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000016 end
000017 "LMDFREE LISTID("LISTID") "
000018 /* we have built the list */
000019 do i = 1 to dslst.0
000020 if dsorg.i <> "PO" then ,
000021 iterate
000022 dsvar = dslst.i
000023 "LMINIT DATAID(LISTID) DATASET("dsvar") ENQ(SHR)"
000024 "LMOPEN DATAID("LISTID") OPTION(INPUT)"
000025 membr=" "
000026 "LMMLIST DATAID("LISTID") MEMBER(MEMBR) STATS(YES)"
000027 if rc = 4 then ,
000028 say dsvar "has no members"
000029 do while ( rc = 0 )
000030 say dsvar membr
000031 "LMMLIST DATAID("LISTID") MEMBER(MEMBR) STATS(YES)"
000032 end
000033 "LMCLOSE DATAID("LISTID")"
000034 "LMFREE DATAID("LISTID")"
000035 end
000036 exit |
I think I am even too helpful after the ts remarks : |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
Thanks Enrico for the example. I already have the 300 datasets from LISTCAT and reduction manually. Not a big deal. The problem is introducing each dataset into the LM processing and being able to MOD onto the output. LMCOPY is out as the MOD doesn't work.
What is TS ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Topic Starter
d |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
as I said already use my snippet wher istead of using the LMD**** services to fill the DSLST. stem
is enough to use
Code: |
Address TSO "ALLOCATE ....." the dataset with the dataset list
Address TSO "EXECIO * DISKR theddname ( stem DSLST. FINIS" |
the only difference is ...
at
Quote: |
ISPEXEC LMOPEN DATAID(data-id)
[OPTION(INPUT|OUTPUT)]
[LRECL(lrecl-var)]
[RECFM(recfm-var)]
[ORG(org-var)]
|
and check the dsorg aftwer the open
here is the same snippet where the dsorg check has been m,oved after the open
Code: |
000001 /*REXX*/
000002 Address ISPEXEC
000003 dslev="USER.*"
000004 dslst.0 = 0
000005 dsnlnen = 0
000006 "LMDINIT LISTID(LISTID) LEVEL("DSLEV") "
000007 /*build the dataset list and save for each the DSORG */
000008 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000009 do while ( rc = 0)
000010 i = dslst.0 + 1
000011 dslst.i = strip(dsvar)
000012 dslst.0 = i
000013 "LMDLIST LISTID("LISTID") OPTION(LIST) STATS(YES) DATASET(DSVAR)"
000014 end
000015 "LMDFREE LISTID("LISTID") "
000016 /* we have built the list */
000017 do i = 1 to dslst.0
000018 dsvar = dslst.i
000019 "LMINIT DATAID(LISTID) DATASET("dsvar") ENQ(SHR)"
000020 "LMOPEN DATAID("LISTID") OPTION(INPUT) ORG(DSORG) "
000021 if dsorg <> "PO" then do
000022 "LMCLOSE DATAID("LISTID")"
000023 "LMFREE DATAID("LISTID")"
000024 end
000025 membr=" "
000026 "LMMLIST DATAID("LISTID") MEMBER(MEMBR) STATS(YES)"
000027 if rc = 4 then ,
000027 if rc = 4 then ,
000028 say dsvar "has no members"
000029 do while ( rc = 0 )
000030 say dsvar membr
000031 "LMMLIST DATAID("LISTID") MEMBER(MEMBR) STATS(YES)"
000032 end
000033 "LMCLOSE DATAID("LISTID")"
000034 "LMFREE DATAID("LISTID")"
000035 end
000036 exit
|
if You tell exactly what has to be written into the output dataset You might get better suggestions |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
The output dataset should contain the list of members with stats for each dataset's members. I am trying to take in the first dataset input, get the list created, write it to the output, go back and get the next input dataset and repeat, only mod onto the output dataset. That was going to be the simple idea using the LMCOPY with LMINIT of ENQ(MOD) on the output dataset.
Thanks Dick. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
LMCOPY does not write single lines, it copies the content...
as i already said a few times the best approach is to write each line using
after the LMMLIST stats(YES)
just use
Code: |
recd.1 = <member> Z*** Z**** Z**** Z****
Address TSO "EXECIO 1 DISKW outddname ( STEM recd. |
at the end of the whole shebang
Address TSO"EXECIO 0 DISKW outddname (FINIS" |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
Enrico, Thanks for your help today. Yes, I know that LMCOPY writes the whole shebang. I was hoping to add on to the first set of members with the next and so on. Thanks again.
Dave |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
coxdavi,
Have you noticed that Enrico has provided code on several occasions?
Have you also noticed, you have yet to show anything?
Very important piece of advice:
1) Show the code you are running, and how you invoke it (batch jcl for example).
2) Show the output it is currently producing (partial output is fine)
3) Show how you want the output to look.
This would make things easier for everyone.
If you would have done this from the get go, you would be done by now. |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
I am done for now. We were able to get the MOD operation completed. This task will go on the shelf until I get some time to get back to it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Someone will be here when you get back to it. . .
d |
|
Back to top |
|
|
coxdavi
New User
Joined: 12 Mar 2009 Posts: 30 Location: usa
|
|
|
|
Thanks Dick. Much appreciated. |
|
Back to top |
|
|
|