Skip to content

Instantly share code, notes, and snippets.

View lbdyck's full-sized avatar

Lionel B. Dyck lbdyck

View GitHub Profile
@lbdyck
lbdyck / sleep.rex
Created May 25, 2023 16:41
How to Sleep in REXX
/* rexx */
/* call USS sleep routine */
parse arg sleep_sec .
say time()
address 'SYSCALL' 'SLEEP ('sleep_sec')'
say time()
return 0
@lbdyck
lbdyck / fileExist.rex
Last active May 27, 2023 17:58
REXX to test the existence of a OMVS File
/* --------------------- REXX ---------------------- *
| This is a sample routine using REXX to deternmine |
| if a file exists within OMVS. |
* ------------------------------------------------- */
file = '~/.profile'
rc = exist(file)
if rc > 0 then say 'File exists'
else say 'File does not exist'
file = 'bad.file'
rc = exist(file)
@lbdyck
lbdyck / swapeq.rex
Last active June 9, 2023 19:05
SWAPEQ - ISPF Edit Macro to swap sides on an = statement
/* --------------- REXX ------------------ *
| SwapEQ - Swap the sides of an = setting |
| a = b |
| becomes |
| b = a |
* --------------------------------------- */
Address ISREdit
"Macro (range) NOPROCESS"
"PROCESS RANGE S"
"(start) = linenum .zfrange"
@lbdyck
lbdyck / addcomma.rex
Created December 4, 2023 18:48
Add Comma to any Number
AddComma: Procedure /* Code provided by Doug Nadel back before the turn of the century */
arg bignum
cbignum = strip(translate('0,123,456,789,abc,def,ghi,jkl,mno,pqr,stu,vwx', ,
right(bignum,34,','), ,
'0123456789abcdefghijklmnopqrstuvwx'),'L',',')
return cbignum
@lbdyck
lbdyck / tsocmds
Last active April 5, 2024 15:40
Show how to use a STEPLIB for the USS tsocmd
#!/bin/sh
# this short shell script will allow the shell user to invoke
# any TSO command that resides in a load library that is not
# in the STEPLIB or Link List.
#
# Change the hlq.load.library to your load library and enjoy
#
# Copy into a directory in your PATH to use as a shell command
# and issue chmod +x xxxxx (where xxxxx is the name you gave to
@lbdyck
lbdyck / tso_mount_zfs
Last active June 4, 2024 13:35
Mount ZFS During TSO Logon
/* ----------------------------------------------------- *
| Small routine to put into a rexx exec invoked during |
| TSO Logon, or manually after, to test for a zfs being |
| mounted and if not then to mount it. |
* ----------------------------------------------------- */
if listdsi("'userid.zopen.zfs'") = 4 then do
x = syscalls('ON')
path = '/u/userid/zopen/etc/'
address syscall ,
'lstat (path) st.'