pVal?1(4N,6N,8N)
indicates that pVal can either be YYYY, YYYYMM, or YYYYMMDD. Any of these formats should work.
That case statement determines how many days are in the given month (the month specified in pVal). So "4:30" indicates that there are 30 days in the month of April. This, combined with the "<=" operator located just before the case statement, is used to evaluate if the day of the month is valid within pVal. If it is not valid, the error "Invalid date value ..." is thrown. Because this is checking the day of the month, the case statement is found in both DT (date value) and DTM (date/time value).
All data structure formatting definitions can be found in the ValidateElementaryDT method of the EnsLib.HL7.Util.Validator class. Here you will see a case statement containing all of the possible data types and their respective formatting. The "?" syntax in ObjectScript performs pattern matching, and, in this case, works to ensure that the value in the field is of the correct format. Otherwise, an error is thrown and the message does not pass validation.