gdgDsn = RxGdgDsn( {gdgName | gdgStem} ) [;]
Sourcecode
/* REXX *****************************************************************/
/* */
/* Program name: RXGDGDSN */
/* Program type: REXX function */
/* Function....: Checks where the entered Dataset is a GDG-Base or a */
/* GDG datasetname and give back the entered dataset name */
/* if it is not, or the GDG dataset if it is. */
/* */
/* Using.......: gdgds = RxGdgDsn( {gdgBase | gdgDsn} ) */
/* Where: */
/* gdgBase = Name of GDG base */
/* gdgDsn = Name of GDG Dataset with generation number */
/* i.e. MY.GDG.DSN(-3) */
/* */
/* Notes: 1. generation number must be 0 or lower: */
/* 0, -1, -2, ... */
/* 2. Default generation number = 0 */
/* 3. GDG Name have to be fully qualified dataset */
/* name without apostrophes */
/* */
/* Author......: Janosch R(exx) Kowalczyk */
/* Create date.: 11 Dec 2007, Tue / 345 */
/* Version.....: 0.1 */
/* Changes.....: No */
/* */
/* Copyright © Janosch R(exx) Kowalczyk. 2007, 2008. */
/* All rights reserved. */
/************************************************************************/
/* trace r */
Parse Source envir callType procName .
Arg dsn
/*--------------(Exception handling)----------------*/
Signal On Failure Name CLEANUP
Signal On Halt Name CLEANUP
Signal On Syntax Name CLEANUP
dsn = Strip( dsn,, "'" )
Parse Var dsn gdg "(" gen ")" .
x = OutTrap('stem.')
Address TSO "LISTCAT ENT('"gdg"') GDG NVSAM"
x = OutTrap(OFF)
If Pos( "GDG BASE", stem.1 ) > 0 Then Do
If Datatype( gen ) <> "NUM" Then gen = 0
k = 0
Do i = 2 To stem.0
Parse Value Translate( stem.i, " ", "-" ) With . gdg .
If Pos( ".", gdg ) > 0 Then Do
k = k + 1
gdg.k = gdg
End
End
gdg.0 = k
/* Not older as current LIMIT, no new GDG dataset */
gen = Min( Max( gen + k, 1 ), k )
dsn = gdg.gen
End
Return dsn
/**************(End Main Routine)****************/
/*========( Signal cleaning procedure )=========*/
CLEANUP:
Say "Break, Failure or Syntax Error running" procName". rc="rc
Say "Sourceline" sigl ">>>" SourceLine( sigl )
Say "Restart please. If the error recurs, notify the author."
If rc = 0 Then rc = 3
Exit rc
Beispiel 1
dsn = RxGdgDsn( "MY.GDG.STAM(-1)" ) Say dsn
Ergebnis 1
MY.GDG.STAM.G0010V00 /* mögliches Beispiel */