Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find updated members

Status
Not open for further replies.

rajesh082

Programmer
Dec 18, 2007
38
0
0
DK
Hi All,

I have a small requirement...
I am writing lot of Members in a PDS with some basic fields in Batch mode.

Now on a future run I want to check how many members of this PDS have been edited.

I tried using LISTDSI SYSUPDATED, but this is giving me Yes for all the members, even for the members which are totally empty.

X = listdsi(PDS"("Mem")")

Since the Members created in Batch mode have the Job name as their creator, another way of checking is if the Creator id is anything else than the Job name, How can I accomplish this.

Answers to any of the either of 2 queries will be appreciated.
 
There's no 100%-guaranteed way to do this other than by going to SMF (and even that has its limits), but you can get close.

You say that "Members created in Batch mode have the Job name as their creator" so I presume the batch process is using LMMSTATS to insert the 'last changed userid'. Any user who edits such a member must either blank that datapoint by turning STATS off or leave their own userid in its place.

LMMFIND ... STATS(YES) will bring back all the collected datapoints and you can verify that the userid is changed or not.

Beware: a sophisticated user can easily thwart that protocol.


Frank Clarke
Support the Troops:
-- Bring them home.
 
Hi Frank,

Thanks for your reply.

"There's no 100%-guaranteed way to do this other than by going to SMF (and even that has its limits), but you can get close."

I had already Got this when I was scanning previous posts on this, and saw the same reply by you on one of the posts.

My Question was Why is the SYSUPDATED giving me a YES for every member. Does SYSUPDATED variable give me the status for the PDS rather than the member?

Yeah, you are correct in assuming that I want to compare the USERIDS against the Member (as seen in ISPF 3.4 Panel). Which function can return me this user id in my Rexx Program.

Once again thanks. I dont need the code, I am just trying to learn use Rexx in sync with TSO/ISPF services. Any kind of pointers or help would actually get me going in the right direction.

Thanks.

 
Here is a routine that uses LMMLIST to get the mambers of a PDS.

/********************REXX***********************/
PDSname = 'AAAAAAAA.REXX.PDS'
MemList. = ''
/**********************************************************/
/* Get dataid for data set and issue LMOPEN */
/**********************************************************/
Address ISPEXEC
ISPEXEC "LMINIT DATAID(DatID) DATASET('"PDSname"') ENQ(SHR)"
IF rc <> 0 then
Call Exit8 'ERROR initializing PDS' PDSname 'rc='rc
ISPEXEC "LMOPEN DATAID("DatID") OPTION(INPUT)"
IF rc <> 0 then
Call Exit8 'ERROR Opening PDS' PDSname 'rc='rc
/**********************************************************/
/* Loop through all members in the PDS */
/**********************************************************/
Membr = ' '
Do i = 1 by 1
ISPEXEC "LMMLIST DATAID("DatID") OPTION(LIST) MEMBER(MEMBR) STATS(YES)"
If rc <> 0 Then leave
If ZLMTIME <> '' then Mtime = ZLMTIME":"ZLMSEC
else Mtime = copies(' ',8)
MemList.i = Membr ZLC4DATE ZLM4DATE Mtime ZLVERS ZLMOD ZLUSER
End
MemList.0 = i - 1
/**********************************************************/
/* Free the member list and close the dataid for the PDS. */
/**********************************************************/
ISPEXEC "LMMLIST DATAID("DatID") OPTION(FREE)"
ISPEXEC "LMCLOSE DATAID("DatID")"
/**********************************************************/
/* Display the member list */
/**********************************************************/
Do i = 1 to MemList.0 /* Do i = 1 to 10 to limit the display*/
Say MemList.i
End
Return

/* ********** Error Exit ********** */
Exit8:
Arg ErrMsg
Say Errmsg
Exit 08
/* */
 
RxUsr --

You should avoid doing
Code:
ISPEXEC "LMMLIST DATAID("DatID") OPTION(FREE)"

You're probably in address TSO when you do this, so this whole command gets handed to IKJEFT01 which dispatches a fresh copy of ISPEXEC to handle the quoted string.

Since you must already have started an ISPEXEC environment it is more efficient to
Code:
address ISPEXEC "LMMLIST DATAID("DatID") OPTION(FREE)"
which uses the currently-existing ISPEXEC to handle the service.

Frank Clarke
Support the Troops:
-- Bring them home.
 
My Question was Why is the SYSUPDATED giving me a YES for every member. Does SYSUPDATED variable give me the status for the PDS rather than the member?

Can somebody please address this Question?
 
rexxhead --

I thought line 7 (Address ISPEXEC) would keep me in the ISPEXEC environment until another Address instruction was issued. Is it a better parctice to use Address every time?
I omit it just to save space on the line and avoid continuations. I will add it in the future.

thanks,
RxUsr

The Ref. manual says SYSUPDATED:
YES - Data set has been updated
NO - Data set has not been updated

Data set would be the PDS not individual members.
 
Didn't see l.7, but that only makes it worse !

In that case, you're not in address TSO, you're in address ISPEXEC, so when you issue
Code:
ISPEXEC "LMMFIND ..."
that's passed to ISPEXEC which says "ISPEXEC? Don't know what that means. Hey, TSO, here's a command; handle it for me, OK?"

Now TSO gets it and starts a fresh ISPEXEC, etc., and when it's finished finally hands control back to the original ISPEXEC task.

Far better to lump all your <whatever> into a subroutine:
Code:
ISPF_STUFF:
   address ISPEXEC
   "LMINIT ..."
   ...
   "LMFREE ..."
return

An 'address' specification issued in a subroutine reverts when that subr returns, so if your main code runs in address TSO, you can set it and forget it.


Frank Clarke
Support the Troops:
-- Bring them home.
 
The LMFIND service resets the userid against the member. Is there any way to stop this?

Address ISPEXEC
"LMINIT DATAID(DatID) DATASET('"Var2"') ENQ(SHR)"
"LMOPEN DATAID("DatID") OPTION(INPUT)"
"LMMFIND DATAID("DatID") MEMBER("Mem") STATS(YES)"
MemStat = Mem ZLC4DATE ZLM4DATE Mtime ZLVERS ZLMOD ZLUSER

When the code has run the user name against the member is reset to my name. How can I avoid this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top