/* REXX - rexx exec to convert a command table to DTL */ /* Syntax: CMD2DTL applid */ /* where applidCMDS is in your table library. */ /* The default applid is ISP. */ /* This command is issued from any ISPF command line */ /* (c) Copyright IBM Corp., 1998, 2000 All rights reserved. */ /* Author Doug Nadel. Direct questions to nadel@us.ibm.com */ /* Version 1.01 June 20,2000 - fixed variable actions (ZCTACT=&X) */ /*--------------------------------------------------------------- */ Address ispexec Parse Upper Arg applid . Parse Value applid 'ISP' With applid . tablenam=applid'CMDS' /*--------------------- Start of sort ------------------------- */ 'CONTROL ERRORS RETURN' 'TBOPEN 'tablenam' NOWRITE' 'TBQUERY 'tablenam' NAMES(STRUCT)' 'TBCREATE ALIAS NAMES'struct' NOWRITE' 'TBTOP ' tablenam 'TBSKIP 'tablenam Do While rc = 0 If word(zctact,1)='ALIAS' Then /* Save away aliases */ Do 'TBADD ALIAS' 'TBDELETE 'tablenam /* Delete alias from table */ End 'TBSKIP 'tablenam End 'TBSORT 'tablenam' FIELDS(ZCTVERB,C,A)' /* Sort remaining entries */ 'TBTOP ALIAS' 'TBSORT ALIAS FIELDS(ZCTVERB,C,D)' /* Sort alias entries */ 'TBTOP ALIAS' 'TBSKIP ALIAS' Do While rc = 0 'TBTOP 'tablenam 'TBADD 'tablenam /* Add aliases back at top */ 'TBSKIP ALIAS' End xx= 'TBSAVE 'tablenam xx= 'TBEND 'tablenam 'TBEND ALIAS' /*--------------------- end of sort --------------------------- */ 'CONTROL ERRORS RETURN' 'FTOPEN TEMP' 'FTCLOSE' 'VGET (ZTEMPN ZTEMPF) ' 'TBOPEN 'tablenam 'TBTOP 'tablenam Call write '<:--------'||, left(' Source for ISPF command table 'tablenam' ',59,'-')'>' Queue '<:doctype dm system> ' Queue '' skiprc=0 Call write ' ' Call write ' <:'copies('-',66)'>' Parse Source . . me . Call write ' <:--'||, left(' Generated 'date('N')' by 'me' EXEC. ',62,' ')'-->' Call write ' <:'copies('-',66)'>' Call write ' <:--'||, center(' Alias entries must preceed other entries. ',62,' ')'-->' Call write ' <:'copies('-',66)'>' lasttype='' Do While skiprc=0 'TBSKIP 'tablenam skiprc=rc If skiprc=0 Then Do Parse Upper Var zctact type . if substr(zctact,1,1)='&' then zctact=overlay('%',zctact) If type \= 'ALIAS' & lasttype='ALIAS' Then Do Call write ' ' Call write ' <:'copies('-',66)'>' Call write ' <:--'center(' Start of non-ALIAS entries ',, 62,' ')'-->' Call write ' <:'copies('-',66)'>' End lasttype=type verb='' If zcttrunc\= 0 & zcttrunc 'delstr(zctverb,1,zcttrunc) Call write ' ' Call write ' <:'copies('-',50)' 'left(zctverb' ',14,'-')'>' Call write ' 'verb Call write ' ' End End 'TBEND ALIAS' Queue '' Address tso 'EXECIO 'queued() ' DISKW ' ztempn '(FINIS' 'LMINIT DATAID(CVT) DDNAME('ztempn')' 'EDIT DATAID(&CVT)' 'LMFREE DATAID(&CVT)' Exit write: Parse Arg original input='' Do a = 1 to length(original) Parse Var original char 2 original input=input||char If char='&' Then input=input'amp;' End If length(input)<72 Then Queue input Else Do Parse Var input line '=' input Queue line'=' If length(input)<72 Then If substr(input,1,1)='"' Then Do m=max(length(input),56) input=right(left(input,m),72) Queue input End Else Queue input Else Do Until strip(input)='' break=72-pos(' ',reverse(substr(input,1,72))) Queue substr(input,1,break) input =delstr(input,1,break) End End Return