Mainframe上面工作经常需要临时查看Production代码库当中的代码,又不希望输入长长的库名称。可以用REXX写一个Retrieve功能的脚本,放在
USERID.REXX.EXEC
这个pds下面。运行的时候TSO RET your_program_name
即可随时查看。这里是这个RET程序的实现方法,原本是公司内部用的,由前辈们积累下来的财产,我见它有通用性和扩展性,故稍作修改简化后贴这里:
EDIT IBMUSER.REXX.EXEC(RET) - 01.02 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /* rexx */
000002 /*********** ret - retrieve specific member from multiple libs*********/
000003 arg member
000004 dummy = outtrap("dummy2",0) /*suppress tso messages from screen *
000005 holdrc = 1;found_num=0;mem_arr.=""; /* init vars*/
000006 call readlibs
000007 if found_num > 0 then
000008 do i=1 to found_num
000009 address ispexec "VIEW DATASET('"mem_arr.i"')"
000010 end
000011 else say "Can't find requested module --> "member
000012 exit
000013 /**readlibs: Here you can add any libs you want to search**************/
000014 readlibs:
000015 call search_one_lib "IBMUSER.SOURCE.LIB1"
/*if holdrc = 1 then call your_added_lib1 add your extra lib here*/
/*if holdrc = 1 then call your_added_lib2 want to add another one?*/
...
000016 return
000017 /**search_one_lib: Browse and Find member from a designated lib**********/
000018 search_one_lib:
000019 parse upper arg dsname
000020 dspds ="'"!!dsname!!"'"
000021 "ispexec lminit dataid(handle)",
000022 " dataset(" dspds ")"
000023 "ispexec lmopen dataid(" handle ") option(input)"
000024 "ispexec lmmfind dataid(" handle ") member(" !! member !! ")",
000025 "stats(yes)";
000026 if rc = 0 then do
000027 dspds = dsname !! "(" !! member !! ")"
000028 found_num = found_num + 1
000029 mem_arr.found_num = dspds
000030 end
000031 "ispexec lmclose dataid(" handle ")"
000032 "ispexec lmfree dataid(" handle ")"
000033 return
例如,你突然想看程序PRODPGM1,只需执行:
TSO RET PRODPGM1
REXX程序就会去函数readlibs里面您事先指定好的libs里面查找PRODPGM1,然后以VIEW的方式逐个打开PRODPGM1供您查看。
File Edit Edit_Settings Menu Utilities Compilers Test Help
```````````````````````````````````````````````````````````````````````````````
VIEW IBMUSER.SOURCE.LIB1(PRODPGM1) - 03. Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 PRODPGM1: PROC(PARMS) OPTIONS(MAIN);
000002 /*********************************************************************/
000003 /* PROGRAM-ID: PRODPGM1 */
000004 /* DESCRIPTION: PRODUCE DAILY SUMMARY RPT */
000005 /* AUTHOR: IBMUSER JOHN */
000006 /* DATE: JUNE 2009 */
000007 /*********************************************************************/
如果PRODPGM1还存在于除了IBMUSER.SOURCE.LIB1
之外的lib中,那么按PF3即可接着查看下一个结果。
Comments !