1 !******************************************************************** & ! & ! & ! M11FIX & ! & ! Fix up a Mail File after changing the structure of the & ! header. & ! & ! & !******************************************************************** & ! 3 ! Program : M11FIX & ! Version : 0 29-OCT-82 & ! Programmer : Don Gohn & ! Releaser : & ! & ! 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. & ! 100 !-------------------------------------------------------------------- & ! & ! Summary & ! & ! & ! This program writes the header record to a new Mailing List file & ! which was created by RMSDEF as a result of the M11CUS program. & ! & ! 200 !-------------------------------------------------------------------- & ! & ! Interfaces & ! & ! COMERR - Common Error buffer & ! MAPMLF - Address record buffer & ! MAPHDR - Mail file header buffer & ! & ! 300 !-------------------------------------------------------------------- & ! & ! Input / Output & ! & ! & ! & ! Channel File Name MAP Name Status at entry/exit & ! ------- --------- -------- -------------------- & ! CH.ADD% FILE.NAME$ MAPMLF CLOSED/CLOSED & ! CH.KB% "KB:" CLOSED/CLOSED & ! CH.HDR% HDR.FILE$ BUF CLOSED/CLOSED & ! 400 !-------------------------------------------------------------------- & ! & ! & ! Variable and Array Definitions & ! & ! C Used to set CNTRL C trapping & ! CH.ADD% Mailing list file channel & ! CH.HDR% Temporary header file channel & ! CH.KB% Keyboard channel & ! CNTRL.C% System error code for Control C & ! ERL Line in which error occurred & ! ERR Set to error after error & ! FATAL.ERROR% Mail11 error code for fatal error & ! FILE.NAME$ Name of Mail file & ! HDR.FILE$ Name of temporary header file & ! 600 !-------------------------------------------------------------------- & ! & ! & ! C O M M O N D E C L A R A T I O N S & ! & ! & !******************************************************************** & & 650 !-------------------------------------------------------------------- & ! & ! & ! M A P S T A T E M E N T S & ! & ! & !******************************************************************** & 650 & MAP (OLDHDR) & & OHDR.KEY0$ = 16% & ,OHDR.KEY1$ = 10% & ,OHDR.SYS.DEF.PRIME.ID$ = 1% & ,OHDR.SYS.DEF.ALT.ID$ = 1% & ,OHDR.LAST.ADDR.DEF$ = 1% & ,OHDR.DATE.FORMAT$ = 1% & ,OHDR.NEXT.PRIME.ID$ = 16% & ,OHDR.LAST.NAME.MIX% & ,OHDR.FIRST.NAME.MIX% & ,OHDR.PACK.ADDRS$ = 1% & ,OHDR.COUNTRY$ = 1% & ,OHDR.FIELD.LEN%(20%) & ,OHDR.CAT.PROMPT$(10%) = 10% & ,OHDR.CAT.TYPE$(10%) = 1% & ,FILL$ = 10% & & \ MAP (OLDHDR) & & OHDR.ALL$ = 225% & & 455 ! & ! & ! MAPHDR - Mailing List File header parameters & ! & ! & ! HDR.KEY0$ Header primary key & ! HDR.KEY1$ Header alternate key & ! HDR.SYS.DEF.PRIME.ID$ Y/N flag for system defined primary ID's & ! HDR.SYS.DEF.ALT.ID$ Y/N flag for system defined alternate ID's & ! HDR.LAST.ADDR.DEF$ Y/N flag for system using last address as def & ! HDR.DATE.FORMAT$ Code for date format & ! 1 = DEC standard date & ! HDR.NEXT.PRIME.ID$ Next system-generated primary ID & ! HDR.LAST.NAME.MIX% Number of last name characters used in ID & ! HDR.FIRST.NAME.MIX% Number of first name characters used in ID & ! HDR.PACK.ADDRS$ Y/N flag for packing addresses & ! HDR.COUNTRY$ Country code & ! A = US & ! HDR.PUBLIC.MAIL.LIST$ Will non-priviveged users be allowed to & ! access this file from other accounts? & ! HDR.FUTURE$ Space for future fields & ! HDR.FIELD.LEN%(20%) length of address fields & ! HDR.CAT.PROMPT$(10%) Category names (with spare room) & ! HDR.CAT.TYPE$(10%) Category types (with spare room) & ! A = Alphanumeric & ! D = Date & ! N = Numeric & ! & ! HDR.ALL$ Entire header record & ! & !-------------------------------------------------------------------- 655 & MAP (MAPHDR) & & HDR.KEY0$ = 16% & ,HDR.KEY1$ = 10% & ,HDR.SYS.DEF.PRIME.ID$ = 1% & ,HDR.SYS.DEF.ALT.ID$ = 1% & ,HDR.LAST.ADDR.DEF$ = 1% & ,HDR.DATE.FORMAT$ = 1% & ,HDR.NEXT.PRIME.ID$ = 16% & ,HDR.LAST.NAME.MIX% & ,HDR.FIRST.NAME.MIX% & ,HDR.PACK.ADDRS$ = 1% & ,HDR.COUNTRY$ = 1% & ,HDR.PUBLIC.MAIL.LIST$ = 1% & ,HDR.FUTURE$ = 9% & ,HDR.FIELD.LEN%(20%) & ,HDR.CAT.PROMPT$(10%) = 10% & ,HDR.CAT.TYPE$(10%) = 1% & & \ MAP (MAPHDR) & & HDR.ALL$ = 225% & 454 ! & ! & ! MAPMLF - Mailing List File contents & ! & ! & ! MLF.KEY0$ primary key = 000000000000001 for header record & ! subname 0000n for sublist records & ! primary ID for address records & ! & ! MLF.KEY1$ alternate key = nulls for header record & ! nulls for sublist records & ! alternate ID for address records & ! & ! MLF.REST$ everything else in the record & ! MLF parameters for header record & ! up to 7 sub lines for sublist records & ! address and categ for address records & ! & ! & ! MLF.KEY0.TAG$ the first character in the record & ! & ! MLF.SUBLIST.NAM$ the name of the sublist & ! & ! MLF.ALL$ an entire Mailing List File record & ! & !-------------------------------------------------------------------- 654 & MAP (MAPMLF) & & MLF.KEY0$ = 16% & ,MLF.KEY1$ = 10% & ,MLF.REST$ = 324% & & \ MAP (MAPMLF) & & MLF.KEY0.TAG$ = 1% & ,MLF.SUBLIST.NAM$ = 10% & ,FILL$ = 339% & & \ MAP (MAPMLF) & & MLF.ALL$ = 350% & & 700 !-------------------------------------------------------------------- & ! & ! Subprograms & ! & ! & !-------------------------------------------------------------------- & ! & ! Subroutines & ! & ! & !-------------------------------------------------------------------- & ! & ! Functions & ! & ! & !-------------------------------------------------------------------- & 1000 !******************************************************************** & ! & ! & ! S T A R T P R O G R A M L O G I C & ! & ! & !******************************************************************** & 1020 ON ERROR GOTO 19000 & \ C = CTRLC & \ WAIT 0% & \ CH.KB% = 1% & \ CH.ADD% = 2% ! Mailing list file & \ CNTRL.C% = 28% ! ASCII value for control C & \ HDR.CHR$ = CHR$ (29%) ! first header record char. & \ FATAL.ERROR% = -1% ! Code for a fatal error & \ OPEN "KB:" AS FILE #CH.KB% ! Open keyboard & ! Set standard error trap. Set up common for error reporting. & ! Set constants. Open keyboard. & 1040 INPUT LINE #CH.KB%, "Enter file to update: "; FILE.NAME$ & \ FILE.NAME$ = EDIT$(FILE.NAME$,6%) & \ CLOSE #CH.KB% & 1060 OPEN FILE.NAME$ FOR INPUT AS FILE #CH.ADD% & ,ORGANIZATION INDEXED VARIABLE & ,ACCESS MODIFY & ,ALLOW NONE & ,BUCKETSIZE 2% & ,RECORDSIZE 350% & ,MAP MAPMLF & ,PRIMARY KEY MLF.KEY0$ NODUPLICATES & ,ALTERNATE KEY MLF.KEY1$ DUPLICATES CHANGES & 4190 GET #CH.ADD%, KEY #0% EQ HDR.CHR$ + "000000000000001" & \ MOVE FROM #CH.ADD%, OHDR.ALL$ = RECOUNT & \ HDR.ALL$ = OHDR.ALL$ & \ HDR.PUBLIC.MAIL.LIST$ = "Y" & \ HDR.FUTURE$ = "" & \ HDR.FIELD.LEN%(I%) = OHDR.FIELD.LEN%(I%) FOR I% = 0% TO 20% & \ HDR.CAT.PROMPT$(I%) = OHDR.CAT.PROMPT$(I%) FOR I% = 0% TO 10% & \ HDR.CAT.TYPE$(I%) = OHDR.CAT.TYPE$(I%) FOR I% = 0% TO 10% & \ MOVE TO #CH.ADD%, HDR.ALL$ & \ UPDATE #CH.ADD% & \ CLOSE #CH.ADD% & & 9000 !*************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !*************************************************************** & 9990 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 & ! & ! & !*************************************************************** & & 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 & ! & ! & !*************************************************************** & 19000 !*************************************************************** & ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !*************************************************************** & 19020 RESUME 9000 IF ERR = CNTRL.C% ! CNTRL C trap & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & \ ERR.MSG$ = "Unexpected fatal error" & \ PRINT ERR.MSG$;CR;LF;ERT$(ERR); " at line ";ERL;" of ";ERN$ & \ RESUME 32767 & ! Print error message and quit. & 32767 END