Go to LeighWeb Home Page            

Back To LeighWeb Mainframe Utilities Page

View the documentation associated with this 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