/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : INDEXIT */ /* */ /* Description : Builds an Index Member in current Dataset */ /* */ /* Created on : 07 Aug 2007 */ /* Created by : KEVIN FERGUSON */ /* : Userid(MIT001) */ /* : using ABBYDALE.PROD.EMACS(INDEXIT) */ /* */ /* Called by : */ /* */ /* Calls : CHECKDSN, LM Utilities */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ parse upper ARG test dx fred Address ISREDIT "MACRO (test do) PROCESS" Address ISREDIT "(mac) = MACRO_LEVEL" if mac = "MAC" then do dsname = test dsname = strip(dsname,b,"'") test = dx dx = fred lastline = 9 if dsname = "" then do say 'Invalid call for INDEXXIT' say ZEDSMSG = 'Invalid call' ZEDLMSG = 'INDEXIT called incorrectly' ZDLMSG = 'Help displayed' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" Call disp_help exit(12) end end else do Address ISREDIT "(DSNAME) = DATASET" Address ISREDIT '(LASTLINE) = LINENUM .ZLAST' end mem = "$$$INDEX" if test = "?" then do Call disp_help ZEDSMSG = 'Help displayed' ZEDLMSG = 'Help information was displayed' ZDLMSG = 'Help displayed' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" exit(4) end if test <> "" then do if length(test) < 9 then do mem = test end else do ZEDSMSG = "Cancelled" ZEDLMSG = "Passed index name too long" ZDLMSG = "Action Cancelled" Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" exit 8 end end upper mem fulldsn = dsname||"("||mem||")" checkdsn fulldsn if rc = 0 then do ZEDSMSG = "Cancelled" ZEDLMSG = "Index name already exists" ZDLMSG = "Action Cancelled" Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" exit 8 end newstack row = 1 if lastline > 0 then fill = '-' tline = '-' call putline fill = ' ' tline = 'Directory list of 'dsname call putline fill = '-' tline = '-' call putline fill = ' ' tline = ' Member | Description' call putleft fill = '-' tline = '-' call putline fill = ' ' tline = ' '||left(mem,8,' ')' | This member.' call putleft fill = '-' tline = '-' call putline if dx <> "NOMEM" then do Address ISPEXEC "LMINIT DATAID(RES) DATASET('"dsname"') ENQ(SHR)" Address ISPEXEC "LMOPEN DATAID("RES") OPTION(INPUT)" do while rc = 0 Address ISPEXEC "LMMLIST DATAID("RES") MEMBER(lst) OPTION(LIST), STATS(NO)" if rc = 0 then do fill = ' ' tline = ' '||left(lst,8,' ')' | ' call putleft fill = '-' tline = '-' call putline end end Address ISPEXEC "LMCLOSE DATAID("RES")" Address ISPEXEC "LMFREE DATAID("RES")" end else do fill = ' ' tline = ' | ' call putleft fill = '-' tline = '-' call putline end fill = ' ' tline = '©Copyright of Abbydale Systems LLC.' call putline fill = '-' tline = '-' call putline row = row - 1 "ALLOC F(ASLOUT01) DA('"fulldsn"') SHR REUS" "EXECIO * DISKW ASLOUT01 (STEM Line. FINIS" "FREE F(ASLOUT01)" ZEDSMSG = 'Index created' ZEDLMSG = 'Index member' mem 'successfully created' ZDLMSG = 'Index created' ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" exit putline: if substr(tline,1,1) = "©" then do mline = '|'CENTER(tline,69,fill)'|' end else do mline = '*'CENTER(tline,69,fill)'*' end Line.row = mline row = row + 1 return putleft: mline = '|'LEFT(tline,69,fill)'|' Line.row = mline row = row + 1 return /*-------------------------------------------------------------------*/ /* disp_help procedure */ /*-------------------------------------------------------------------*/ disp_help: procedure say "INDEXIT - can be called as an edit macro or as a Rexx command" say " It will build an index member of all the members in the" say " dataset. By default the index member will be named" say " $$$INDEX" say "" say "Usage: INDEXIT indmemb NOMEM | ? " say "" say " indmemb - (optional) The name to be used for the index member." say " If omitted the name $$$INDEX will be used." say " NOMEM - (optional). If NOMEM is passed as a second" say " parameter then the index will NOT written the member" say " list to the indmemb member." say " ? - generates this information." say "" say " Return Codes : 0 - Dataset name is valid" say " 4 - Help displayed" say " 12 - Invalid call" return /*-------------------------------------------------------------------*/ /* End of INDEXIT */ /*-------------------------------------------------------------------*/