/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : COPYRITE */ /* */ /* Description : Add a copyright notice at the position of the */ /* cursor or where there is an "A" line command. */ /* If the member is detected to be a Rexx exec proper */ /* format comments are generated, otherwise asterisks */ /* are used to wrap the copyrite notice. */ /* */ /* Created on : 27 Jun 2021 */ /* Created by : Kevin Ferguson */ /* : Userid MIT001 */ /* : Using ABBYDALE.DEVL.REXX(COPYRIT) */ /* */ /* Called by : */ /* */ /* Calls : */ /* */ /* Panels Used : */ /* */ /* Change Activity : */ /* */ /* MM/DD/YYYY ID Comment */ /* --------------------------------------------------------------- */ /* 07/18/2021 DTE Changed date used from Normal to Standard to */ /* compensate for different regional settings */ /* */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse Arg Help /* Check for Help */ If SYSVAR("SYSISPF")<>"ACTIVE" then do Say "ISPF must be active to use "COPYRIT exit(16) end Address ISREDIT "MACRO (Help) NOPROCESS" If Help = "?" Then do Call Disp_Help exit(4) end signal on novalue /* un-initialized vars*/ signal on halt /* attention key */ Address ISPEXEC "CONTROL ERRORS RETURN" Address ISREDIT "(CR, CC) = CURSOR" Address ISREDIT "CAPS OFF" Address ISREDIT "PROCESS RANGE A" Address ISREDIT "(RC) = RANGE_CMD" kef = cr rexx = "N" pre = "**" suf = "**" Fill = "*" Address ISREDIT "(FIRST) = LINENUM .ZFRANGE" fndparm = """/*""" Address ISREDIT "(LEFTON,RIGHTON) = BOUNDS" Address ISREDIT "SCAN OFF" Address ISREDIT "SEEK" fndparm "FIRST" if rc = 0 then do Address ISREDIT "(NUM) = LINENUM .ZCSR" commentLine = num fndparm = """*/""" Address ISREDIT "SEEK" fndparm "FIRST" if rc = 0 then do Address ISREDIT "(NUM) = LINENUM .ZCSR" if num = commentLine then do rexx = "Y" pre = "/*" suf = "*/" Fill = "-" end end end /*-------------------------------------------------------------------*/ /* Change the values for Startyear and LLC to reflect the year to */ /* be used as the start year for the copyright and the name of the */ /* copyright holder. No other changes need be made as lengths are */ /* calculated from the variables, */ /*-------------------------------------------------------------------*/ StartYear = '2017' LLC = 'Copyright Abbydale Systems LLC.' /*-------------------------------------------------------------------*/ if length(llc) > 60 then do mess = 'LLC length is too long. Must be < 60. Length is currently' say mess length(LLC) exit 8 end say substr(date('s'),1,4,'0') /*DTE*/ if StartYear > substr(date('s'),1,4,'0') then do /*DTE*/ say 'StartYear cannot be higher than current year' exit 12 end if StartYear < 1961 then do say 'Oh come on get real! 1961 is the earliest start date allowed' exit 13 end LLC = LLC Startyear '-' substr(date('s'),1,4,'0') /*DTE*/ len1 = (71 - (length(LLC)+5))%2 len2 = 71 - (len1+(length(LLC)+5)) lineout =pre||copies(Fill,67)||suf cpy =pre||copies(' ',len1) cpy = cpy||'©'||LLC cpy = cpy||copies(' ',len2)||suf Address ISREDIT "LINE_AFTER" kef" ='"lineout"'" Address ISREDIT "LINE_AFTER" kef+1" ='"cpy"'" Address ISREDIT "LINE_AFTER" kef+2" ='"lineout"'" Address ISREDIT "RESET" address ISREDIT "DOWN" kef exit /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "COPYRITE - This edit macro will add a copyright notice to a file" say"" say" The macro will automatically detect whether the file" say" being processed is a rexx file of not and the comments" say" modified accordingly. To change the copyright owner and" say" start year change the values defined within the macro" say"" say "Usage: COPYRITE | ?" say"" say" ? - Generates this information." say"" say" Return Codes :" say" 4 - Help displayed" say" 8 - LLC length error" say" 12 - LLC length error" say" 13 - LLC length error" say" 16 - Not under ISPF" say"" Return /*-------------------------------------------------------------------*/ /* End of Disp_Help Procedure */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* Trap NOVALUE Condition */ /*-------------------------------------------------------------------*/ novalue: say "NOVALUE entered from line" sigl say condition("D") say "The instruction is suppressed" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* Trap HALT Condition */ /*-------------------------------------------------------------------*/ halt: say "HALT acknowledged in line" sigl say "Cleanup processing in progress" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* End of COPYRIT */ /*-------------------------------------------------------------------*/