1 SUB M11RCV & 2 !******************************************************************** & ! & ! & ! M11RCV & ! & ! Reconvert the Numeric and Date fields in the Sublist Definition & ! & ! & !******************************************************************** & ! 3 ! Program : M11RCV & ! Version : 01 31-Mar-83 & ! Programmer : Don Gohn & ! & !--------------------------------------------------------------------- 11 ! & ! & ! & ! C O P Y R I G H T & ! & ! & ! & !--------------------------------------------------------------------- 20 ! ! MODIFICATION HISTORY ! ! Ver Date By ! 1.1 20-Jul-84 Mike Brown ! Changed line 12240 statement 5. Sublists using fields ! 15 and 16 caused a "?Subscript out of range" error in V1.0. ! !--------------------------------------------------------------------- 100 ! & ! & ! Description: & ! & ! This subprogram reconverts numeric and date fields from the & ! form used in sorting and comparing to the form used in & ! displaying and printing (by calling SUBCNV) & ! & !--------------------------------------------------------------------- 200 ! & ! & ! Interfaces: & ! & ! COMERR - Common Error buffer & ! COMCON - Common Constant buffer & ! COMVAR - Common Variable buffer & ! & ! MAPHDR - Mail file header buffer & ! MAPSEL - Sublist definition array buffer & ! & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output: & ! & ! & ! Channel Filename Map name Status at entry/exit & ! ------- --------- -------- -------------------- & ! & !--------------------------------------------------------------------- 400 ! & ! & ! Variable and Array Definitions: & ! & ! & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! & !--------------------------------------------------------------------- 600 ! & ! COMMON Statements & ! & !--------------------------------------------------------------------- 650 !-------------------------------------------------------------------- & ! & ! MAP Statements & ! & !--------------------------------------------------------------------- 700 !-------------------------------------------------------------------- & ! & ! & ! Subprograms: & ! & ! Name Description & ! ---- ----------- & ! & !-------------------------------------------------------------------- & ! 800 ! Subroutines: & ! & ! Line Number Description & ! ---- ------ ----------- & ! & ! 12200 (SUBRCV) Reconvert sublist definition numeric and & ! date fields & ! & !-------------------------------------------------------------------- & ! & ! Functions: & ! & ! Name Description & ! ---- ----------- & ! & ! FN.DATE.RECNV$ Convert a date from YYMMDD to DD-MMM-YY & ! FN.LJ$ Left justify space fill a numeric string & ! & !-------------------------------------------------------------------- & 1000 !******************************************************************** & ! & ! & ! S T A R T P R O G R A M L O G I C & ! & ! & !******************************************************************** & 1010 ON ERROR GOTO 19000 & \ ERR.PROGNAM$ = "M11RCV VER:01" & \ ERR.SUBNAM$ = "" & \ ERR.MSG$ = "Unexpected fatal error" & ! Set standard error trap. Set up common for error reporting. & 1020 GOSUB 12200 & ! Call the subroutine that does the reconversion. & 9000 !******************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !******************************************************************** & 9990 \ ERR.PROGNAM$ = ERR.CALLNAM$ & \ GO TO 32767 & ! Jump around the junk and leave. & 10000 !*************************************************************** & ! & ! & ! S U B R O U T I N E S L O C A L T O & ! & ! T H I S P R O G R A M & ! & ! & !*************************************************************** & 12200 !-------------------------------------------------------------------- & ! & ! Reconvert Sublist Definition Dates and Numeric Fields & ! & !-------------------------------------------------------------------- & ! & ! input: SEL.- sublist selection criteria & ! HDR.CAT.TYPE$(10%) array which indicates type & ! (A, D, Y, N) of each category & ! HDR.SYS.DEF.PRIME.ID$ Is the Primary ID system & ! defined? & ! HDR.FIELD.LEN%(20%) array which contains the & ! length of all address fields & ! M11.LAST.LINE% number of sublist definition & ! lines & ! & ! output: SEL.- reconverted sublist selection criteria & ! M11.FIELD.WAS.CNVTD% flag says sublist reconverted & ! & ! & ! Assumptions: & ! & ! - Sublist definition is already in memory (MAPSEL) & ! - Primary ID length = 16 bytes & ! - Alternate ID lenght = 10 bytes & ! - Category length = 10 bytes & ! - Counter length = 4 bytes & ! - Order of sublist fields: Primary ID, Alt. ID, Counter, ZIP, & ! categories & ! - Order of address fields (see M11INT line 4800) & ! - (Not) between = op code 4 & ! & ! Variables Local to this Subroutine & ! & ! F.LEN% Length of the current sublist def field value & ! FIELD.NUM% Integer between 1-10 to indicate which field & ! is specified in the current sublist def line & ! FIELD.TYPE$ A = Alphanumeric, D = Date, N = Numeric & ! Y = Yes or No & ! LINE% Line number of sublist def line currently & ! being processed & ! & ! NOTE: The following constants must be initialized by the & ! calling module (or by M11INT): & ! & ! TRUE% Constant value for logical TRUE & ! FALSE% Constant value for logical FALSE & ! & ! NOTE: This subroutine also uses the following functions & ! which must be appended into the calling module: & ! & ! FN.DATE.RECNV$ converts a date from YYMMDD to DD-MMM-YY & ! FN.LJ$ converts a right justified, zero filled & ! numeric string to a left justified string & ! & !-------------------------------------------------------------------- & 12220 LINE% = 1% & ! Initialize sublist definition line counter. & 12240 FIELD.NUM% = VAL(SEL.FIELD.NUM$(LINE%)) & \ FIELD.TYPE$ = "A" & \ FIELD.TYPE$ = "N" & IF FIELD.NUM% = 1% AND HDR.SYS.DEF.PRIME.ID$ = "Y" & \ FIELD.TYPE$ = "N" & IF FIELD.NUM% = 1% AND HDR.SYS.DEF.PRIME.ID$ = "1" & \ FIELD.TYPE$ = "N" IF FIELD.NUM% = 3% ! Counter & \ FIELD.TYPE$ = HDR.CAT.TYPE$(FIELD.NUM% - 4%) & IF FIELD.NUM% > 4% AND FIELD.NUM% < 11% & \ GO TO 12280 IF FIELD.TYPE$ = "A" OR FIELD.TYPE$ = "Y" & \ GO TO 12260 IF FIELD.TYPE$ = "D" & \ F.LEN% = HDR.FIELD.LEN%(FIELD.NUM%) & \ F.LEN% = HDR.FIELD.LEN%(FIELD.NUM% + 6%) IF FIELD.NUM% > 3% & \ SEL.VALUE.1$(LINE%) = & FN.LJ$(SEL.VALUE.1$(LINE%),F.LEN%) & \ SEL.VALUE.2$(LINE%) = & FN.LJ$(SEL.VALUE.2$(LINE%),F.LEN%) & IF SEL.OP.CODE$(LINE%) = "4" & \ GO TO 12280 & ! Get field number and determine field type. If field type is "A/Y" & ! then no reconversion is necessary. Go to 12260 if date reconversion & ! is required. Otherwise, perform numeric reconversion (convert both & ! value fields if this is a "between" condition test). & 12260 SEL.VALUE.1$(LINE%) = FN.DATE.RECNV$(SEL.VALUE.1$(LINE%)) & \ SEL.VALUE.2$(LINE%) = FN.DATE.RECNV$(SEL.VALUE.2$(LINE%)) & IF SEL.OP.CODE$(LINE%) = "4" & ! Perform date reconversion (re convert both value fields if this is & ! a "between" condition test). & 12280 LINE% = LINE% + 1% & \ GO TO 12240 IF LINE% <= M11.LAST.LINE% & ! Increment the sublist definition line counter. If it's greater than & ! the total number of sublist def lines, then we're done. & 12290 M11.FIELD.WAS.CNVTD% = FALSE% & \ RETURN & 15000 !*************************************************************** & ! & ! & ! F U N C T I O N S L O C A L T O & ! & ! T H I S P R O G R A M & ! & ! & !*************************************************************** & 15700 !-------------------------------------------------------------------- & ! & ! FNDRCV - Date Re-conversion & ! & !-------------------------------------------------------------------- & ! & ! FN.DATE.RECNV$ (INP.DATE$) & ! & ! Converts a valid date from YYMMDD format to DD-MMM-YY & ! format & ! & ! & ! INP.DATE$ Input date & ! MMM$ Month abbreviation & ! MM% Integer month (1-12) & ! & !**************************************************************** & 15720 DEF FN.DATE.RECNV$ (INP.DATE$) & \ MM% = VAL(SEG$(INP.DATE$,3%,4%)) & \ MM% = ((MM% - 1%) * 3%) + 1% & \ MMM$ = SEG$("JanFebMarAprMayJunJulAugSepOctNovDec", MM%, (MM%+2%)) & \ FN.DATE.RECNV$ = SEG$ (INP.DATE$,5%,6%) + "-" + MMM$ + "-" & + SEG$ (INP.DATE$,1%,2%) & \ FNEND & ! Convert YYMMDD to DD-MMM-YY. Isolate month integer and convert to & ! 3 character abbreviation. Then build DD-MMM-YY string. & 16100 !-------------------------------------------------------------------- & ! & ! FNLJ - Left justify a numeric string & ! & !-------------------------------------------------------------------- & ! & ! & ! FN.LJ$ (N$,L%) & ! & ! Converts a right justified, zero filled numeric string to & ! a left justified string of the specified length. & ! & ! Local variables: & ! N$ Input string & ! L% Length of output string & ! NZ% First non-zero character & ! WORK% Integer work variable & ! & !**************************************************************** & & 16120 DEF FN.LJ$ (N$, L%) & \ WORK% = LEN(N$) & \ WORK% = L% IF L% > WORK% & \ FOR NZ% = 1% TO (WORK% + 1%) & \ GO TO 16140 IF SEG$ (N$,NZ%,NZ%) <> "0" & \ NEXT NZ% & ! Find the first non-zero character in the input string. & 16140 N$ = SEG$ (N$,NZ%,LEN(N$)) & \ FN.LJ$ = N$ + SPACE$ (L% - LEN(N$)) & \ FNEND & ! Eliminate leading zeroes. Add trailing spaces. That's all. & 19000 !*************************************************************** & ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !*************************************************************** & 19010 GO TO 19990 IF ERN$ <> SEG$ (ERR.PROGNAM$,1%,6%) & ! Only tracing back an error from another subprogram. & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & ! On fatal error, set the error code. & 19990 ON ERROR GO BACK & ! Return to calling program for fatal error processing. & 32767 SUBEND