Skip to content

Instantly share code, notes, and snippets.

@lbdyck
Created December 15, 2022 13:47
Show Gist options
  • Save lbdyck/0a7e4bf87db904a4a3f35c6ce42f8549 to your computer and use it in GitHub Desktop.
Save lbdyck/0a7e4bf87db904a4a3f35c6ce42f8549 to your computer and use it in GitHub Desktop.
Display All Datasets allocated to a specific DD
/* ------------------------- REXX ---------------------------- *
| Display all of the datasets allocated to a specific DDName. |
| |
| Syntax: %LISTDDS ddname |
* ----------------------------------------------------------- */
arg cdd
if strip(cdd) = '' then exit 16
call outtrap 'trap.'
"lista sta"
call outtrap 'off'
dsns = ''
do i = 2 to trap.0
if word(trap.i,1) = 'TERMFILE' then iterate
if left(trap.i,1) /= ' ' then do /* have dataset name */
j = i + 1
if words(trap.j) = 2 then
parse value trap.j with dd state
if dd /= cdd then iterate
dsns = dsns word(trap.i,1)
i = i + 1
end
end
/* -------------- *
| Now report out |
* -------------- */
say words(dsns) 'Datasets found for DD' cdd
do i = 1 to words(dsns)
say right(i,2) word(dsns,i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment