MODULE getyear_after; ! This module defines the subroutine that peruses ! a text string to find a year followed by a right paren INCLUDE FILE 'getyear.scn_inc'; ! this string variable is defined at the module level ! so that it can be used by the macro and the procedure; ! also, it becomes automatically is declared static ! so that its storage is still available for the calling program DECLARE four_digit_year: FIXED STRING(4); SET digit ( '0' .. '9' ); SET year_ender ( ')' OR ']' ); TOKEN two_digit_year { { '19' | '18' | '17' | '/' | '-' } digit digit : year_ender }; MACRO return_year TRIGGER { y: two_digit_year }; IF y[ 1..1 ] <> '1' THEN y = '19' & y[ 2..3 ]; END IF; four_digit_year = y; STOP SCAN; END MACRO; /* return_year PROCEDURE getyear ( field_text: VARYING STRING( str_param_len ) ) OF FIXED STRING( year_len ); DECLARE who_cares: FIXED STRING(1); four_digit_year = ''; START SCAN INPUT STRING field_text OUTPUT STRING who_cares; RETURN( four_digit_year ); END PROCEDURE; /* getyear END MODULE; /* getyear_after