/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : LEVELS */ /* */ /* Description : Returns a count of the number of levels in a */ /* dataset name. Using a second parameter will break */ /* down and display the levels in the dataset name */ /* */ /* Created on : 21 May 2022 */ /* Created by : Kevin Ferguson */ /* : Userid MIT001 */ /* : Using ABBYDALE.PROD.REXX(LEVELS) */ /* */ /* Called by : Anything */ /* */ /* Calls : Nothing */ /* */ /* Panels Used : None */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse arg dsn list If dsn = "?" Then do Call Disp_Help exit(99) end signal on novalue /* un-initialized vars*/ signal on halt /* attention key */ qualifiers = TRANSLATE(dsn,' ','.') if list <> "" then do x = 1 do until x = words(qualifiers) + 1 say word(qualifiers,x) x = x + 1 end end return words(qualifiers) /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say"" say "LEVELS - Counts the levels of a passed dataset name" say"" say "Usage: LEVELS dsn (list) | ?" say"" say" ? - Generates this information." say" dsn - (Required) is the dataset name whose levels are" say" to be counted" say" list - (Optional) if specified will display the levels" say" within the dataset" say"" say" Return Codes :" say" 99 - Help displayed" say" Otherwise - A count of the number of levels" say"" Return /*-------------------------------------------------------------------*/ /* End of Disp_Help Procedure */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* Trap NOVALUE Condition */ /*-------------------------------------------------------------------*/ novalue: say "NOVALUE entered from line" sigl say condition("D") say "The instruction is suppressed" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* Trap HALT Condition */ /*-------------------------------------------------------------------*/ halt: say "HALT acknowledged in line" sigl say "Cleanup processing in progress" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* End of LEVELS */ /*-------------------------------------------------------------------*/