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

REXX identify the last/latest created member


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 191
Location: hyderabad

PostPosted: Thu Jan 24, 2019 12:15 pm
Reply with quote

Hi,

I have a PDS and new pds members would be created by users when ever the users needed. I want to know the the recent (latest) created pds member.

Could any help me how to identify the latest created pds member using rexx or any other functionality


Thanks
Siva Nalluri
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Jan 24, 2019 1:12 pm
Reply with quote

REXX can interface with ISPF, although you will need to check that the ISPF statistics are switched on, if you see the date of last upodate under a member listing from 3.whatever - they are on

DSINFO may be one source, LISTDSI another.

You will need to check these out YOURSELF
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Thu Jan 24, 2019 3:22 pm
Reply with quote

If you really mean '(latest) created pds member' then it is not possible by looking at the library itself, even ISPF only keeps the date of the creation, not the time. So within one day you can't tell which members was the last added. And as noted above the information is not neccessarily true.
You could look at SMF type 42 subtype 24 'Member add/replace' records as that will give you that information.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Jan 24, 2019 10:00 pm
Reply with quote

Every member has a TTR associated with it. The TTR is unrelated to ISPF statistics, so it is valid even when there are no ISPF statitics. For example -
Code:
-MEMBER- --TTRC-- --USER DATA (TTRC AND USER DATA ARE HEX)               
ADDASM6  0006270F 0100002701 18297F0118 297F183500 0400040000 C2C3E3F1F8
                  F840404040
ADDTSO   0002010F 0100004201 12273F0112 273F082000 0400040000 C2C3E3F1F8
                  F840404040
ADDTSOR  0002250F 0100003301 13233F0113 233F083100 0400040000 C2C3E3F1F8
                  F840404040
In the ADDASM6 member the TTR is 000627 and is the highest of the three members (yes, Virginia, there are more) I formatted, so it is the most recently added member of the 3 members I formatted. Obviously (well maybe not that obviously) this will not work for "library" (PDSE) data sets.

I then ran a utility to find data areas in a PDS occupied by members that have been deleted and got this result (at least in part).
Code:

ADDASM6  000627 00 00A4000627 000628 00A4000628             
RAUNAKP  000629 00 00A4000629 00062A 00A400062A             
**GAS    00062B 00 00A400062B 00062C 00A400062C             
BILLGAL  00062D 00 00A400062D 00062E 00A400062E             
JEAVILA  00062F 00 00A400062F 000630 00A4000630             
RIHARD   000631 00 00A4000631 000632 00A4000632             
LICX     000633 00 00A4000633 000634 00A4000634             
**GAS    000635 00 00A4000635 000636 00A4000636             
NOPRT    000637 00 00A4000637 000638 00A4000638             
**GAS    000639 00 00A4000639 00063A 00A400063A             
THUZOS   00063B 00 00A400063B 00063C 00A400063C             
MAKEPC   000701 00 00A4000701 000702 00A4000702             
$$000639 000639 00 00A4000639 000000 0000000000             
$$000635 000635 00 00A4000635 000000 0000000000             
$$00062B 00062B 00 00A400062B 000000 0000000000             
$$000601 000601 00 00A4000601 000000 0000000000             
4 'GAS' EXTENTS FOUND, 0 'GAS' MEMBERS ADDED TO THE DIRECTORY
The $$xxx "members" at the end represent space occupied by members that were deleted or replaced by a member with the same name.

A Rexx EXEC can (with difficulty) read through a PDS directory and obtain the TTRs - an exercise I leave to the topic starter - and deuce the most recently added member.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1315
Location: Vilnius, Lithuania

PostPosted: Fri Jan 25, 2019 12:59 am
Reply with quote

Compress a PDS and it's goodbye to any indication as to which member was added as the latest.

And this one-liner in the edit memberlist:

s existing;move existing;;;repl .zf .zl existing;;;cancel;;;

will recreate "existing" with totally new statistics and TTR (even if it was originally the oldest member)

Topic is a waste of precious electrons, and a typical PHB requirement or, more likely, something made up by the TS...
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Jan 25, 2019 4:57 am
Reply with quote

prino wrote:
Compress a PDS and it's goodbye to any indication as to which member was added as the latest. ...

No.

"Compressing" a PDS does not alter the order of the members; it just removes "gas" space. The exact same logic as discussed earlier will work and produce the same result after the data set has been "compressed."
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Jan 25, 2019 5:55 am
Reply with quote

here is a snippet to read a pds directory using rexx

Code:
****** ***************************** Top of Data ******************************
000001 /*rexx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 parse upper arg ds
000006 if listdsi(ds) \= 0 then do
000007     say "dataset '"ds"' not found"
000008     return 16
000009 end
000010 if substr(sysdsorg,1,2) \= "PO" then do
000011     say "dataset '"ds"' is not PO"
000012     return 16
000013 end
000014 Address TSO
000015 "ALLOC FI(DD) DA("DS") SHR REUS DSORG(PS) RECFM (F B) LRECL(256)"
000016 "EXECIO * DISKR DD ( STEM DIR. FINIS"
000017 "FREE FI(DD)"
000018 do idir = 1 to dir.0
000019    blk = substr(dir.idir,3,c2d(left(dir.idir,2))-2)
000020    do while blk \= ""
000021       parse var blk mbr 9 ttr 12 usr 13 .
000022       if mbr = 'ffffffffffffffff'x then ,
000023          leave idir
000024       say "==> " mbr
000025       blk = delstr(blk,1,c2d(bitand(usr,'1f'x))*2+12)
000026    end
000027 end
****** **************************** Bottom of Data ****************************


it processes only the member names, but it is anyway a starting point
Back to top
View user's profile Send private message
JPVRoff

New User


Joined: 06 Oct 2009
Posts: 45
Location: Melbourne, Australia

PostPosted: Fri Aug 02, 2019 4:49 am
Reply with quote

I was browsing the forum after doing a post and saw this. I purloined a gem from Doug Nadel (a long time ago), called PDSREAD. This shows the date and time without using ISPF (only if there are stats to begin with, of course). You'll have to forgive the compression used...habits die hard!
Code:
/*Rexx routine to read a pds directory and show the ispf stats     */           
/*     non load module only.                                       */           
/* Author: Doug Nadel - 3/31/2001 */                                           
Parse Upper Arg ds .                                                           
If 0<>listdsi(ds) Then Do;Say 'Data set 'ds' not allocated';Exit;End           
If 'PO'<>substr(sysdsorg,1,2) Then Do;Say 'DSN 'ds' is not a pds';Exit;End     
PDSE=sysused="N/A";Address "TSO"                                               
'ALLOC F(AREAD) DS('ds') SHR REUSE DSORG(PS) LRECL(512) RECFM(F B) BLKSIZE(512)'
'EXECIO * DISKR AREAD ( FINIS STEM DIRS.';'FREE F(AREAD)'                       
Do block#=1 to dirs.0;call saystuff;block=dirs.block#                           
 Parse Var dirs.block# bl 3 block;block=substr(block,1,c2d(bl)-2)               
 Do While block<>'';Parse Var block name 9 ttr 12 c 13 block                   
  c2=c2d(bitand(c,'1f'x));If name='FFFFFFFFFFFFFFFF'x Then Leave block#         
  stats='';If c2=15 then stats=decodestats(substr(block,1,30))                 
  else if pdse then say name "C="c2x(c) "PDSE TTR="c2x(ttr)                     
  else say name "C="c2x(c) "PDS TT="c2x(left(ttr,2))"R="c2x(right(ttr,1))       
  block=delstr(block,1,c2*2);End;End;Exit                                       
saystuff:;trc=dirs.block#;tr=c2x(trc);tr1=;tr2=                                 
do until length(tr)=0;tr1=tr1||substr(tr,1,1);tr2=tr2||substr(tr,2,1)           
 tr=substr(tr,3);end;return                                                     
decodestats:  Procedure expose ttr c name PDSE;direntry=Arg(1)                 
  Parse Var direntry,                                                           
    vv 2 mm 3 flags 4 ss 5 crecc 6 crdate 9 modcc 10 moddate 13 hh,             
    14 tm 15 lines 17 init 19 mod 21 userid 28 .                               
  xc=c2x(c);xttr=c2x(ttr);xtt=left(xttr,4);xr=right(xttr,2);xvv=c2x(vv)         
  xmm=c2x(mm);xflags=x2b(c2x(flags));xcrecc=c2x(crecc)                         
  xcrdate=c2x(crdate);xmoddate=c2x(moddate);xhhmmss=c2x(hh||tm||ss)             
  xlines=c2x(lines);xinit=c2x(init);xmod=c2x(mod);line1=name                   
  if pdse then line1=line1 "PDSE TTR="xttr                                     
  else line1=line1 "PDS TT="xtt "R="xr                                         
  say line1 "C="xc "VVMM="xvv||xmm"LINES="xlines "INIT="xinit "MOD="xmod       
  say "        " "FLAGS="xflags "CC="xcrecc,                                   
        "CRDATE="xcrdate "MODDATE="xmoddate "HHMMSS="xhhmmss;Return 1           

And the output looks like this:
Code:
 ALTER1   PDSE TTR=000057 C=0F VVMM=0116LINES=001F INIT=003A MOD=0000       
          FLAGS=00000000 CC=01 CRDATE=09015F MODDATE=18219F HHMMSS=202049   
 ALTER2   PDSE TTR=000058 C=0F VVMM=0115LINES=0023 INIT=003A MOD=0000       
          FLAGS=00000000 CC=01 CRDATE=09015F MODDATE=18219F HHMMSS=202052   
 DEV#     PDSE TTR=00004A C=0F VVMM=0101LINES=0020 INIT=0020 MOD=0000       
          FLAGS=00000000 CC=01 CRDATE=18218F MODDATE=18218F HHMMSS=170620   
 DEV@     PDSE TTR=000048 C=0F VVMM=0101LINES=0148 INIT=0148 MOD=0000       
          FLAGS=00000000 CC=01 CRDATE=18217F MODDATE=18217F HHMMSS=202642   
 PDSREAD  C=00 PDSE TTR=000059                                               
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top