Return to Mainframe Utilities Page
Module
/* REXX ***************************************************************/ /* Utility: $RELGEN */ /* Author: David Leigh */ /* Function: Using GDGGEN (in reverse) return the relative GDG gen */ /* of a dataset when it's passed the full dataset name */ /* with the G0000V00 as the last node. */ /**********************************************************************/ parse upper arg INDSN /**********************************************************************/ /* get the g0000v00 and the base that was passed in */ /**********************************************************************/ indsn = strip(indsn,b,"'") gv = substr(INDSN,length(INDSN)-7) xcmd = parse var 'indsn' 'indsn' "'."gv"'" . interpret xcmd /**********************************************************************/ /* call gdggen to get the "minus" information */ /**********************************************************************/ address tso '%gdggen dsn('indsn')' address ispexec 'vget gen shared' /**********************************************************************/ /* loop through the results until you find the one you're looking for */ /**********************************************************************/ if gen > 0 then do i = 0 to gen - 1 'vget minus'i 'shared' xcmd = 'xv = substr(minus'i',length(minus'i')-7)' interpret xcmd if xv = gv then do if i = 0 then zdlmsg = i else zdlmsg = '-'i leave end end /**********************************************************************/ /* put the results in the dslist short message variable. */ /**********************************************************************/ address ispexec 'vput zdlmsg' EXIT
Documentation
$RELGEN and its alias $RG take an argument of a GDG dataset including the g0000v00 number at the end. It then calls GDGGEN to determine what are all the existing generations. It returns the relative GDG generation number by vputting it into the ZDLMSG pool variable. If called from a 3.4 list screen, this will place the value in the short message area. Alternatively one could call $RELGEN from another process and retrieve the value (vget ZDLMSG) and do with it whatever they needed.