/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : VALIDIP */ /* */ /* Description : Validates that the passed IP address is in the */ /* correct format as a dotted IP address. */ /* */ /* Created on : 18 Jun 2015 */ /* Created by : Kevin Ferguson */ /* : Userid MIT001 */ /* : Using ABBYDALE.PROD.REXX(VALIDIP) */ /* */ /* Called by : */ /* */ /* Calls : Nothing */ /* */ /* Panels Used : None */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse Arg Help /* Check for Help */ If SYSVAR("SYSISPF")<>"ACTIVE" then do Say "ISPF must be active to use "VALIDIP exit(16) end If Help = "?" Then do Call Disp_Help exit(4) end signal on novalue /* un-initialized vars*/ signal on halt /* attention key */ say help Validip = 8 /* set default of not valid */ Looper = 1 /* Number of dots to find */ Count = 0 do while looper < 4 if pos('.',help) > 0 then do count = count + 1 con = SUBSTR(help,1,POS('.',help)-1) if con > 255 then signal LeaveIt if looper = 1 then do If con = 0 then signal LeaveIt end If verify(con,'1234567890') > 0 then signal LeaveIt help = SUBSTR(help,Pos('.',help)+1,LENGTH(HELP)-POS('.',help)) end looper = looper + 1 end if Count = 3 then do ValidIp = 0 end LeaveIt: exit(Validip) /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "VALIDIP - Checks to see if the passed IP address format is valid" say"" say "Usage: VALIDIP IPAddr | ?" say"" say" IPAddr - Specifies the dotted IP address to be checked" say" ? - Generates this information." say"" say" Return Codes :" say" 0 - Passed IP address is ina valid format" say" 4 - Help displayed" say" 8 - Passed IP address is not a valid format" 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 VALIDIP */ /*-------------------------------------------------------------------*/