1 SUB M11UPK (REC$) & 2 !******************************************************************** & ! & ! & ! M11UPK & ! & ! Unpacks the fields in an address record & ! & ! & !-------------------------------------------------------------------- & ! 3 ! Subprogram : M11UPK (REC$) & ! Version : 1 8-Jan-81 & ! Programmer : John Montrym & ! Releaser : Jean Fullerton & ! & ! & !-------------------------------------------------------------------- 11 ! & ! & ! & ! C O P Y R I G H T & ! & ! & ! & ! (C) Copyright 1982 & ! Digital Equipment Corporation, Maynard, Massachusetts & ! & ! This software is furnished under a license for use only & ! on a single computer system and may be copied only with & ! the inclusion of the above copyright notice. This & ! software, or any other copies thereof, may not be pro- & ! vided or otherwise made available to any other person & ! except for use of such system and to one who agrees to & ! these license terms. Title to and ownership of the & ! software shall at all times remain in DIGITAL. & ! & ! The information in this software is subject to change & ! without notice and should not be construed as a commit- & ! ment by Digital Equipment Corporation. & ! & ! DIGITAL assumes no responsibility for the use or relia- & ! bility of its software on equipment that is not sup- & ! plied by DIGITAL. & ! & !-------------------------------------------------------------------- 20 !********************************************************************* ! ! Modification History ! ! !********************************************************************* ! ! Ver Date By ! 1.1 14-Jun-84 Mike Brown ! Added line 1110 to allow fixed length records. ! !--------------------------------------------------------------------- 100 ! & ! & ! & ! Description & ! & ! This subprogram takes a packed record from a Mailing List & ! file in the argument REC$, unpacks it and returns it in the & ! map MAPADD. & ! & ! Calling modules: Any module which needs to read from an & ! address file. & ! & ! Assumptions: & ! & ! * The record to be unpacked is of the form: & ! fixed fields - Primary ID 16 bytes & ! Alternate ID 10 & ! counter 2 & ! variable length fields separated by delimiters - & ! zip code 10 bytes (maximum) & ! state 12 & ! categories 10 * 6 & ! name 30 & ! city 30 & ! address line 1 30 & ! address line 2 30 & ! address line 3 30 & ! (future) 10 & ! comments 65 & ! & ! & !-------------------------------------------------------------------- 200 ! & ! & ! Interfaces & ! & ! Common areas: & ! & ! COMERR - Error conditions variables & ! COMCON - General system constants & ! & ! MAPADD - Contents of the Address File & ! & ! & ! Arguments: & ! & ! REC$ - (input) packed address record & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output & ! & ! & ! none & ! 400 !-------------------------------------------------------------------- & ! & ! Variable and Array Definitions & ! & ! & ! & ! CAT% index variable into the category information & ! END% last character of current address field & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! FRONT% first character of current address field & ! & ! 600 !-------------------------------------------------------------------- & ! & ! & ! COMMON Declarations & ! & ! & !-------------------------------------------------------------------- 650 !-------------------------------------------------------------------- & ! & ! & ! MAP Statements & ! & ! & !--------------------------------------------------------------------- 700 !-------------------------------------------------------------------- & ! & ! Subprograms & ! & ! & ! none & ! & !-------------------------------------------------------------------- & ! 800 ! Subroutines & ! & ! none & ! & !-------------------------------------------------------------------- & ! & ! Functions & ! & ! FN.NEXT$ 17400 extracts the next field from the unpacked & ! address record & ! & 1000 !******************************************************************** & ! & ! & ! S T A R T P R O G R A M L O G I C & ! & ! & !******************************************************************** & 1010 ON ERROR GOTO 19000 ERR.SUBNAM$ = "M11UPK VER:01" C% = CTRLC ! Set up standard error trap. ! Set up common for error reporting. 1110 IF HDR.PACK.ADDRS$ = "N" THEN SELECT LEN(REC$) CASE 326 ADD.CVF.1$ = SEG$( REC$, 1%, 260% ) ADD.CVF.2$ = SEG$( REC$, 261%, 326% ) CASE ELSE ADD.ALL$ = REC$ END SELECT GOTO 9000 END IF ! Don't unpack if records have fixed length fields, but check length ! of input records. Records with fixed length fields are 326 bytes, ! rather than 336, because the ADD.FUTURE$ field is not written out. ! (Because of a better record/bucket fit, this reduces the size of ! 'fixed length' files by 50%) ! ! The check for record size is only required because field test ! versions of Smart Mailer V1.1 wrote 336 byte records (the entire ! ADD buffer). 1110 IF HDR.PACK.ADDRS$ = "N" THEN ADD.ALL$ = REC$ & \ GO TO 9000 & ! Don't unpack if file has fixed length records. & 1120 ADD.ALL$ = "" ! Clear out the return map. & \ ADD.PRIME.ID$ = MID (REC$, 1%,16%) & \ ADD.ALTERNATE.ID$ = MID (REC$,17%,10%) & \ ADD.COUNTER$ = MID (REC$,27%, 2%) ! The map converts $ to % & ! Load up the fixed fields. & 1140 DELIM$ = CHR$(31%) 1150 FRONT% = 29% & \ END% = POS (REC$, DELIM$, FRONT%) & & \ ADD.ZIP$ = SEG$ (REC$, FRONT%, END% - 1%) & & \ ADD.STATE$ = FN.NEXT$ & \ ADD.CATEGORIES$(CAT%-1%) = FN.NEXT$ FOR CAT% = 1% TO 6% & \ ADD.NAME$ = FN.NEXT$ & \ ADD.CITY$ = FN.NEXT$ & \ ADD.ADDR1$ = FN.NEXT$ & \ ADD.ADDR2$ = FN.NEXT$ & \ ADD.ADDR3$ = FN.NEXT$ & \ ADD.FUTURE$ = FN.NEXT$ & & \ FRONT% = END% + 1% & \ ADD.COMMENT$ = SEG$ (REC$, FRONT%, LEN(REC$)) & ! Unpack the variable length field portion of the record. & ! Load comment (there is no delimiter after the comment). & & & 9000 !*************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !*************************************************************** & 9900 ERR.SUBNAM$ = "" & \ GOTO 32767 & ! Go to the end of the subprogram. & & & 17400 !-------------------------------------------------------------------- & ! & ! & ! FN.NEXT$ & ! & !-------------------------------------------------------------------- & 17410 DEF FN.NEXT$ & & \ FRONT% = END% + 1% & \ END% = POS (REC$,DELIM$,FRONT%) & \ FN.NEXT$ = SEG$ (REC$, FRONT%, END% - 1%) & & \ FNEND & ! Load next field from address. & 19000 !*************************************************************** & ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !*************************************************************** & & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & \ ON ERROR GO BACK & ! On a fatal error, set up the error traceback variables, & ! then resume at the end of the program. & & 32766 !*************************************************************** & ! & ! E N D O F S U B - P R O G R A M & ! & !*************************************************************** & 32767 SUBEND