[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference cookie::notes$archive:cd_v1

Title:Welcome to the CD Notes Conference
Notice:Welcome to COOKIE
Moderator:COOKIE::ROLLOW
Created:Mon Feb 17 1986
Last Modified:Fri Mar 03 1989
Last Successful Update:Fri Jun 06 1997
Number of topics:1517
Total number of notes:13349

886.0. "Cataloging system" by RDGENG::LESLIE (Andy, CSSE OSI Products & CS Program) Fri Aug 28 1987 23:48

    Well now, your CD collection has grown. Now to catalogue it.
    
    That's what I hit on Thursday. So I wrote the dcl procedure in .1
    as an example for anyone wanting to write simple database handling
    routines in dcl.
    
    Andy
    
    PS Don't forget to print the output in 132 chars mode.
T.RTitleUserPersonal
Name
DateLines
886.2Tool existsEXIT26::STRATTONWalk like Annie gypped IanSat Aug 29 1987 18:023
        Gee, I've always used Datatrieve to list albums, tapes,
        and now CDs.
        
886.3LESLIE::LESLIEAndy Leslie, OSI CSSEMon Aug 31 1987 17:523
    Yeah well, my VAXstation doesn't have Datatrieve.
    
    Care to post the procedure?
886.4Too simple to postEXIT26::STRATTONWalk like Annie gypped IanMon Aug 31 1987 22:5110
        Hmmm, well, I never really wrote a procedure.  The only
        fields I have are "category" (e.g., "popular", "classical"),
        artist, title, and media (e.g., tape, record, CD).  The
        data lives in a sequential file and I just READY the domain
        and do things like
        
        DTR> FIND domain WITH MEDIA CONTAINING "C"
        
        which tells me I have 44 CDs.
        
886.5CSCMA::PLAISTEDGrahame Plaisted <RPG Expertise Ctr> DTN 275-6300Tue Sep 01 1987 10:335
    You need to take out the OWNER reference in the FDL that you use
    in the command procedure.
    
    It can cause problems for users that are using and need to delete
    the file and don't have priv's.
886.6FINRLESLIE::LESLIEAndy Leslie, OSI CSSETue Sep 01 1987 11:511
    Good point. Thanks. FINR.
886.7 If no DCL, try basic...MQFSV2::LEDOUXThis Space Intentionally left BlankTue Sep 01 1987 14:08464
$ SET TERM/WIDTH=132

	 The program is in basic (Vax basic) and works fine.
	 It can do search in any field, create printable file according to Indexes you 
	 type.   The only problem is that it's in French.   It can easily be translated
	 in english, since it does not use complex words.
	 Also make sure you patch the "OPEN [...]" since your account will not
	 match mine. (LINE 120)

	 Have fun.     

	 Vince.





10 REM ********************************Programme de Compact Disc*********
11 REM ************** Definition et declaration de variables ************
20 DEF STRING CONCAT(STRING Indexe, Partiel)				!Cette definition permet de
 	 Trouve = 0							!trouver dans un index quelconque
	 EXIT DEF IF LEN(Partiel) > LEN(Indexe)				!une chaine partielle
         FOR I = -1 TO (LEN(Indexe)-LEN(Partiel))			! i.e.: "tre" est inclu dans "Montreal"
                 C$ = EDIT$(MID$(Indexe, I,LEN(Partiel)),2 + 4 + 32)	!       donc trouve = 1
     		 IF C$ = EDIT$(Partiel,2 + 4 + 32) THEN Trouve = 1	! note: Ne tient pas compte d'espace, de tab
     			              EXIT DEF				!	ni de majuscules ou minuscules
                 END IF							! Appele plusieurs fois de la ligne 5082
     		 NEXT I 						!
    END DEF								
100 MAP (CD)     STRING Auteur = 18,				&
	 	        STRING Espace = 1,			&
	 	 STRING Interprete = 36, 			&
              	 	STRING Espace1 = 1,			&
	 	 STRING Titre = 23,				&
	 	        STRING Espace2 = 1,			&
	 	 STRING Remarque = 20,				&
	 	        STRING Espace3 = 1,			&
	 	 STRING Etiquette = 10,				&
	 	        STRING Espace4 = 1,			&
	 	 STRING annee = 5,				&
	 	        STRING Espace5 = 1,			&
	 	 STRING Numerique = 6,				&
	 	        STRING Espace6 = 1,			&
	 	 STRING Proprietaire = 7				! Format d'un record
120 OPEN "[LEDOUX.VINCE]CD.IDX" AS FILE #1,			     	! On ouvre le Fichier ma�tre &
         ORGANIZATION INDEXED, PRIMARY KEY Auteur DUPLICATES,   &
	 ALTERNATE KEY Interprete DUPLICATES CHANGES,		&
	 ALTERNATE KEY Titre DUPLICATES CHANGES,		&
	 ALTERNATE KEY Remarque DUPLICATES CHANGES,		&
	 ALTERNATE KEY Etiquette DUPLICATES CHANGES,		&
	 ALTERNATE KEY Annee DUPLICATES CHANGES	,		&
	 ALTERNATE KEY Numerique DUPLICATES CHANGES,		&
	 ALTERNATE KEY Proprietaire DUPLICATES CHANGES,		&
	 MAP CD
121 DECLARE STRING Auteur1, 				        	! Declaration de variables   &
	 	   Interprete1,						! utilisees pour garder      &
	 	   titre1 ,						! le data des champs origi-  &
	 	   Remarque1 ,						! naux 			     &
	 	   Etiquette1 ,						!			     &
	 	   Annee1 ,						!			     &
	 	   Numerique1 ,						!			     &
	 	   Proprietaire1					!
    Espace  = " "							! Initialisation Constante
    Espace1 = " "							! Constante 
    Espace2 = " "							! 	"
    Espace3 = " "							!	"
    Espace4 = " "							!	"
    Espace5 = " "							!	"
    Espace6 = " "							!	"
    Liste = 0								! Variable numerique de 0 a 18
    Impression = 0							! Variable Booleen
    Trouve = 0								!	"     "
    Choix$ = " "							! Variable pour input de 1 � 6 dans menu
    Question$ = " "							!   "       "     "   O = oui, ou N = non
    a$ = " "								! Variable bidon, pour appeler la DEF Concat
    Cls$ = CHR$(27%)+"[2J"						! Clear Screen
    Clb$ = CHR$(27%)+"[19;0H"+CHR$(27%)+"[0J"				! Clear bas de l'�cran


	 								! PAGE 1


    Pos1_0$   = CHR$(27%)+"[1;0H"					! Position 1 0
    Pos5_10$  = CHR$(27%)+"[5;10H"					! Position 5 10
    Pos5_20$  = CHR$(27%)+"[5;20H"					! Position 5 20
    Pos6_8$   = CHR$(27%)+"[6;8H"					! Position 6 8
    Pos6_10$  = CHR$(27%)+"[6;10H"					! Position 6 10
    Pos6_31$  = CHR$(27%)+"[6;31H"					! Position 6 31
    Pos6_33$  = CHR$(27%)+"[6;33H"					! Position 6 33
    Pos8_20$  = CHR$(27%)+"[8;20H"					! Position 8 20
    Pos9_10$  = CHR$(27%)+"[9;10H"					! Position 9 10
    Pos10_8$  = CHR$(27%)+"[10;8H"					! Position 10 8
    Pos10_10$ = CHR$(27%)+"[10;10H"					! Position 10 10
    Pos10_47$ = CHR$(27%)+"[10;47H"					! Position 10 47
    Pos10_49$ = CHR$(27%)+"[10;49H"					! Position 10 49
    Pos11_20$ = CHR$(27%)+"[11;20H"					! Position 11 20
    Pos13_10$ = CHR$(27%)+"[13;10H"					! Position 13 10
    Pos14_8$  = CHR$(27%)+"[14;8H"					! Position 14 8
    Pos14_10$ = CHR$(27%)+"[14;10H"					! Position 14 10
    Pos14_20$ = CHR$(27%)+"[14;20H"					! Position 14 20
    Pos14_31$ = CHR$(27%)+"[14;31H"					! Position 14 31
    Pos14_33$ = CHR$(27%)+"[14;33H"					! Position 14 33
    Pos14_47$ = CHR$(27%)+"[14;47H"					! Position 14 47
    Pos14_49$ = CHR$(27%)+"[14;49H"					! Position 14 49
    Pos17_10$ = CHR$(27%)+"[17;10H"					! Position 17 10
    Pos17_20$ = CHR$(27%)+"[17;20H"					! Position 17 20
    Pos18_8$  = CHR$(27%)+"[18;8H"					! Position 18 8
    Pos18_10$ = CHR$(27%)+"[18;10H"					! Position 18 10
    Pos19_10$ = CHR$(27%)+"[19;10H"					! Position 19 10
    Pos20_10$ = CHR$(27%)+"[20;10H"					! Position 20 10
    Pos20_20$ = CHR$(27%)+"[20;20H"					! Position 20 20
    Pos23_20$ = CHR$(27%)+"[23;20H"					! Position 23 20
    Pos24_10$ = CHR$(27%)+"[24;10H"					! Position 24 10

141 REM ***************************Programme Principal ******************
142 GOSUB 500								! Imprime Menu Principal
143 GOSUB 192								! R-A-Z des variables temporaires
144 IF Choix$ = "1" THEN GOSUB 1000					! Routine Write New CD
150 IF Choix$ = "2" THEN GOSUB 2000					! Cherche un disque
160 IF Choix$ = "3" OR Choix$ = "5" THEN GOSUB 3000			! Modifier ou enlever un disque
170 IF Choix$ = "4" THEN GOSUB 4000					! Impression d'un rapport
180 IF Choix$ = "6" THEN GOTO 10000					! GOTO END
190 GOTO 142								! Loop Choix invalide

192 REM ******************** R-A-Z des variables temporaires xx1 ********
193 Auteur1 = ""							! Routine de mise a blanc
    Interprete1 = ""							! des variables temporaires
    Titre1 = ""								! 
    Remarque1 = ""							! Routine appelee des lignes:
    Etiquette1 = ""							!	143  et  810
    Annee = ""								!
    Numerique1 = ""							! 
    Proprietaire1 = ""							!
194 RETURN								!

200 REM ********************* Copie des variables************************
210 Auteur1 = Auteur						        ! Cette sousroutine copie les
    Interprete1 = Interprete						! variables d'un record dans
    Titre1 = Titre						   	! les variables temporaires 1$
    Remarque1 = Remarque						!	
    Etiquette1 = Etiquette						! Utilises a deux endroits du
    Annee1 = Annee							! programme : lignes 1190 et 3010
    Numerique1 = Numerique						! 
    Proprietaire1 = Proprietaire					
220 RETURN								
	 								! PAGE 2









400 REM ********************Petite routine de recherche partielle********
410 Auteur = ""								! Ce petit bout de routine est
    Interprete = ""					                ! utilis� a 2 endroits dans le
    Titre = ""                                			        ! programme
    Remarque = ""							! (lignes 2020 et 4020)
    Etiquette = ""							! 
    Annee = ""								! ici on clear le record
    Numerique = ""							!
    Proprietaire = ""							!
420 GOSUB 600								! format d'un record sur l'�cran
430 PRINT Pos19_10$+" Veuillez taper un index";				!
440 GOSUB 800								! Input des champs
450 PRINT Clb$;								! Clear Bas de l'�cran
470 RESET #1								! Remet CD.lis au d�but
480 RETURN

500 REM *******************Imprime menu Principal************************
510 PRINT Cls$+Pos1_0$ 							! Position 1_0
520 PRINT CHR$(27%)+"#6         Compact disc Menu";			! Titre
530 PRINT Pos5_20$+" 1) Ajouter un nouveau Disque";			! Menu
540 PRINT Pos8_20$+" 2) Chercher un disque";				!
550 PRINT Pos11_20$+" 3) Modifier un Disque existant";			! Routine appelee une seule fois a la ligne 142.
560 PRINT Pos14_20$+" 4) Creer une liste pour impression"		!
564 PRINT Pos17_20$+" 5) Enlever un disque de la liste"; 		!
565 PRINT Pos20_20$+" 6) Sortie";					!
570 IF Impression = 1 THEN						!
    Print Pos24_10$+CHR$(27%)+"[5mLe Fichier CD.PRI est cree avec votre liste "+CHR$(27%)+"[0m";
575 PRINT Pos23_20$+"   Votre Choix (1 a 6) <6> : ";			!
580 INPUT Choix$							! Choix
585 IF Choix$ = "" THEN Choix$ = "6"					! Par d�faut
590 RETURN								! Retour a 143

600 REM  ***********************Format d'un record sur l'�cran*********** Imprime les titres des champs
610 PRINT CHR$(27%)+"[1;7m";						! Bold et inverse Vid�o
620 PRINT Pos5_10$+"Auteur            	Interprete                          ";
630 PRINT Pos9_10$+"Titre                  		Remarque            ";
640 PRINT Pos13_10$+"Etiquette 		Annee		Numerique";	! Routine appelee ds lignes 420 et 1030
645 PRINT Pos17_10$+"Proprietaire";					! 
650 PRINT CHR$(27%)+"[0m"						! Curseur mode normal
660 RETURN












	 								! PAGE 3










700 REM **************************INPUT des champs sur l'ecran***********
710 PRINT Pos6_8$;							! Sous routine permettant
     INPUT Auteur							! d'entrer soit un nouveau
     IF Auteur = "" THEN Auteur = Auteur1				! CD ou permettre une modification
720 PRINT Pos6_31$;							! via l'index specifi�
     INPUT Interprete							! d'un CD particulier.
     IF Interprete = "" THEN Interprete = Interprete1			! Utilis� aux lignes 1040 et 
730 PRINT Pos10_8$;							! 3010.
     INPUT Titre							!
     IF Titre = "" THEN Titre = Titre1					! Cette routine ne fait que s'assurer que
740 PRINT Pos10_47$;							! si le champs n'a pas desoin d'�tre modifi�,
     INPUT Remarque							! il est restaur� a sa valeur originale.
     IF Remarque = "" THEN Remarque = Remarque1				!
750 PRINT Pos14_8$;							!
     INPUT Etiquette							!
     IF Etiquette = "" THEN Etiquette = Etiquette1			!
760 PRINT Pos14_31$;							!
     INPUT Annee							!
     IF Annee = "" THEN Annee = Annee1					!
770 PRINT Pos14_47$;							!
     INPUT Numerique							!
     IF Numerique = "" THEN Numerique = Numerique1			!
771 PRINT Pos18_8$;							!
     INPUT Proprietaire							!
     IF Proprietaire = "" THEN Proprietaire = Proprietaire1		!
780 RETURN								!

800 REM **********************input des champs sur l'ecran simple *******
810 GOSUB 192								! Clear xx1 = ""
    PRINT Pos6_8$;							!
     INPUT Auteur1							! Routine appelee seulement de la ligne
     IF Auteur1 = "" THEN 						! 440, (recherche partielle), donc
         PRINT Pos6_31$;						! change de champs jusqu'a ce que un
 	 INPUT Interprete1						! index a ete "punch�".
         IF Interprete1 = "" THEN PRINT Pos10_8$;			!
	     INPUT Titre1						! Note: celui-ci n'est utilise que dans les
	     IF Titre1 = "" THEN  PRINT Pos10_47$;			!       routines de Impression d'un rapport
	 	 INPUT Remarque1					! 	et de recherche simple (sans modifi-
	 	 IF Remarque1 = "" THEN  PRINT Pos14_8$;		!	cation, ni addition).
	 	     INPUT Etiquette1					!       Puisque cet index peut etre un
	 	     IF Etiquette1 = "" THEN PRINT Pos14_31$;		!	champ partiel, ("tre" inclu dans Montreal.)
	 		 INPUT Annee1					!
	 		 IF Annee1 = "" THEN PRINT Pos14_47$;		!
	 		     INPUT Numerique1				!
	 		     IF Numerique1 = "" THEN PRINT Pos18_8$;	!
	 			 INPUT Proprietaire1			!
880 RETURN								!







	 								! PAGE 4


900 REM ********************Imprime data sur l'ecran*********************  Routine appelee de la ligne 2100
910 PRINT Pos6_10$;							! (Recherche d'un disque)
     PRINT Auteur							!
920 PRINT Pos6_33$;							!
     PRINT Interprete							!
930 PRINT Pos10_10$;							!
     PRINT Titre							!
940 PRINT Pos10_49$;							!
     PRINT Remarque							!
950 PRINT Pos14_10$;							!
     PRINT Etiquette							!
960 PRINT Pos14_33$;							!
     PRINT Annee							!
970 PRINT Pos14_49$;							!
     PRINT Numerique							!
971 PRINT Pos18_10$;							!
     PRINT Proprietaire							!
980 RETURN								!
									
1000 REM ***********************ROUTINE WRITE NEW CD*********************
1010 PRINT Cls$+Pos1_0$							!
1020 PRINT CHR$(27%)+"#6         Ajoute un nouveau Disque";		!
1021 PRINT Pos20_10$+"N.B.: N'utilisez pas de Virgules (,) dans aucun des champs" ! Message
1030 GOSUB 600								! Format d'un record sur l'�cran
1040 GOSUB 700								! INPUT des champs
1170 PRINT Clb$+Pos20_10$;						!
1180 INPUT "Voulez-vous corriger : (O/N) <N> ";Question$		!
     IF Question$ = "" THEN Question$ = "N"				!
1185 PRINT Clb$;							!
1190 IF Question$ = "o" OR Question$ = "O" THEN GOSUB 200		! Sauve Ancien record
	 					GOTO 1040		! Via input des champs
1195 PRINT Pos20_10$;							!
1240 INPUT "Avez-vous Fini (O/N) <O> ";Question$			!
     IF Question$ = "" THEN Question$ = "O"				!
     PRINT Clb$;							!
1250 PUT #1								! Ecrit le nouveau record
     IF (Question$ = "N") OR (Question$ = "n") THEN GOTO 1010		!
     ELSE RETURN							!

2000 REM **********************Chercher un disque ***********************
2010 PRINT Cls$+Pos1_0$;						!
     PRINT CHR$(27%)+"#6           Cherche  un  Disque"			!
2011 IF Choix$ = "3" THEN PRINT CHR$(27%)+"#6            Pour Modifications";   !
2012 IF Choix$ = "5" THEN PRINT CHR$(27%)+"#6            Pour Annulation ";     !
2020 GOSUB 400								! Routine de recherche index
2030 RESET #1
2082 GOSUB 5000								! Recherche
2100 IF Trouve = 1 THEN	GOSUB 900					! Imprime data sur ecran
	 		PRINT Pos20_10$+"Un autre du meme index (O/N) <O> : ";   !
	 	        INPUT Question$					!
	 	        PRINT Clb$;					!
	 	        IF Question$ = "" THEN Question$ = "O"		!
	 	        END IF						!
                        IF Question$ = "o" OR Question$ = "O" THEN GOTO 2082     !
	 		END IF						!
     ELSE 								!
      PRINT Pos20_10$+"Pas trouve ce disque: Un autre (O/N) <N> : ";	!
      INPUT Question$							!
      PRINT Clb$;							!
      IF Question$ = "" THEN Question$ = "N"				!
2110 IF Question$ = "N" OR Question$ = "n" THEN RETURN			!
     ELSE GOTO 2010							
	 								! PAGE 5


3000 REM ****************Modifier un disque existant (ou l'enlever)****** Routile appelee de la ligne 160
3010 GOSUB 2000								! Chercher un disque    
     IF Choix$ = "3" AND Trouve = 1 THEN GOSUB 200			! Sauve les champs pour restauration future
	                  		 GOSUB 700			! Input des Champs
3020 PRINT Pos20_10$;							!  						
3021 IF Trouve = 1 THEN							! Si non trouve, RETURN
            IF Choix$ = "5" THEN INPUT "On enleve ce Disque (O/N) <O> : ";Question$   	!
	 	          IF Question$ = "" THEN Question$ = "O"			!
        		                         PRINT Clb$;				!
                          END IF							!
	 	          IF Question$ = "N" OR Question$ = "n" THEN RETURN           	!
                          END IF							! 
            ELSE INPUT "Avez-vous d'autres Disques a corriger (O/N) <N> ";Question$   	!
                        IF Question$ = "" THEN Question$ = "N"				!
                                               PRINT Clb$;				!
                        END IF								!
            END IF									!
     ELSE RETURN									!
     END IF										!
3032 DELETE #1								! Eleve le Record du fichier
3040 IF Choix$ = "3" THEN PUT #1					! Remplace avec nouveau si "Correction"
3091 IF ((Question$ = "O") OR (Question$ = "o")) AND Choix$ <> "5" THEN GOTO 3010   	!
3092 RETURN										!

4000 REM ****************************Impression d'un Rapport************* Routine appelee de la ligne 170
4010 Impression = 1							! Met le booleen vrai
     Liste = 0								! 
     ON ERROR GOTO 4011							!
     X=Y/Z								! Error catcher
4011 IF ERR = 5 THEN RESUME 4014					!
     ELSE RESUME 4012							!
4012 KILL "CD.PRI"							! $ DEL CD.PRI;*
4014 OPEN "CD.PRI" AS FILE #2, RECORDSIZE 132				! Cree le nouveau fichier
     GOSUB 4500								! Print entete
4015 PRINT Cls$+Pos1_0$;						!
     PRINT CHR$(27%)+"#6           Cherche  un  Disque"			!
     PRINT CHR$(27%)+"#6           Pour Impression ";			!
4020 GOSUB 400								! Recherche index
4090 GOSUB 5000								! Recherche
4091 IF  ERR <>  11 THEN 						! Si pas a la fin du fichier...
       PRINT #2, Auteur+"	         "+Interprete+" "+Etiquette+"	       "+Annee
       PRINT #2, "          "+Titre+" 	       "+Remarque+"		  "+Numerique+"	     "+Proprietaire
       PRINT #2,
       Liste = Liste + 1						! Pour marquer le
       IF Liste >= 18 THEN GOSUB 4500					!  debut d'une autre page.
       END IF								!
       GOTO 4090							! Va � la fin du fichier
4100 PRINT #2,CHR$(12%)							! Form Feed
     CLOSE #2								! Ferme CD.PRI;1
     RESET #1								! Remet CD.IDX au d�but
     RETURN								! Retour

4500 REM ******************Sousroutine imprime entete dans CD.PRI******** Routine appelee des lignes 4014 et 4091
4501 Liste = 0								!
4510 PRINT #2,CHR$(12%)							! Form Feed
     PRINT #2,"	    			        Liste de Disque Compact"!  Titre du Fichier a impression
     PRINT #2
     PRINT #2
     PRINT #2,"Auteur                           Interprete                           Etiquette                Annee"
     PRINT #2,"          Titre                                Remarque                           Numerique          Proprietaire"
     PRINT #2,"________________________________________________________________________________________________________________"
4511 RETURN




	 								! PAGE 6





5000 ! **********************Routine de recherche************************ Routine appelee des lignes 2082 et 4090
5080 ON ERROR GOTO 5081							! 
     Trouve = 0 							!
     X=Y/Z								! Error Catcher
5081 IF ERR = 11 THEN RESUME 5084					! Si fin de fichier: return
     ELSE RESUME 5082							! 
5082 GET #1								! Va chercher un record
     IF (Auteur1 <> "") AND (Auteur1 <> "*") THEN a$ = Concat(Auteur,Auteur1)   	! Concat est a la ligne 20
     	ELSE IF Interprete1 <> "" THEN a$ = Concat(Interprete,Interprete1)
	        ELSE IF Titre1 <> "" THEN a$ = Concat(Titre,Titre1)
	 	        ELSE IF Remarque1 <> "" THEN a$ = Concat(Remarque,Remarque1)
	 		        ELSE IF Etiquette1 <> "" THEN a$ = Concat(Etiquette,Etiquette1)
	        			ELSE IF Annee1 <> "" THEN a$ = Concat(Annee,Annee1)
	 				        ELSE IF Numerique1 <> "" THEN a$ = Concat(Numerique,Numerique1)
	 					        ELSE IF Proprietaire1 <> "" THEN a$ = Concat(Proprietaire,Proprietaire1)
	 						        ELSE IF Auteur1 = "*" THEN Trouve = 1
5083 IF Trouve = 0 THEN GOTO 5082					! Si pas trouve essaye encore, jusqu'a EOF
5084 ON ERROR  GOTO 0
     RETURN								!

10000 REM ****************************** END ****************************
10001 PRINT Cls$							! Clear Screen
      CLOSE #1								! Ferme le fichier CD.IDX
      END								!























	 								
	 								! PAGE 7



886.8V1.5RDGENG::LESLIEAndy `{o}^{o}&#039; Leslie, OSI CSSEWed Sep 09 1987 17:05564
V1.5 fixes a number of bugs and features enhancements bu Thomas Siebold.
    
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ ! This procedure has been written purely as an example of uses of dcl        !
$ !                                                                            !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ !                           Recordings.Com                                   !
$ !                                                                            !
$ ! The purpose of this procedure is to maintain a database of                 !
$ ! Recordings: VTs/CDs/LPs etc, enabling updates, additions, deletions        !
$ ! and reports to a user-specified file.                                      !
$ !                                                                            !
$ ! Bugfixes, Suggestions, etc welcomed.                                       !
$ !                                                                            !
$ ! -- Andy Leslie 26/Aug/87                                                   !
$ !                                                                            !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ ! Change History:                                                            !
$ !                                                                            !
$ !  V1.1  Change "Media" to Medium"  28-8-87                                AL!
$ !  V1.2  Change "INQUIRE" to READ/PROMPT                                   AL!
$ !        Allow Duplicate Catalog Numbers (for blanks)                        !
$ !        Reporting via new 4th key (Artist AND Title)                        !
$ !        Allow repeat Artist /  Medium                                       !
$ !  V1.3  Change Record Length to 132, extend artist and title fields to 50 AL!
$ !  V1.4  Change UPDATE section to use other keys                           TS!
$ !  V1.5  Take out OWNER field from FDL to not upset unprivved users        AL!
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ 	Control_Proc = f$environment("CONTROL")
$ 	If "''control_proc'" .nes. "" then -
		Set NOCONTROL=('control_proc') ! Restore at end of procedure
$	set control=y
$	on control_y then GoTo last_section
$
$ 	Verify_Proc = f$environment("VERIFY_PROCEDURE")
$ 	Set NOVERIFY ! restore at end of procedure
$ !
$	on error then continue
$	on warning then continue
$ !
$Set_Ups:
$ !
$	Oput:== write sys$output 
$	esc[0,8]   = 27
$	CSI = "''esc'" + "["
$	cr[0,8]    = 13
$	lf[0,8]    = 10
$	Bell[0,8]  = 7
$	Quote[0,8] = 34
$	Artist=""
$       Title=""
$       Catalogue_Number=""
$       Medium=""
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$ 	DEBUG= 0 ! Set to 1 for debugging
$ !                 
$  	IF DEBUG THEN SET VERIFY
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$First_Section:
$
$ Announce:
$
$	Oput " "
$	Oput "LP/CD/Tape Recordings Database DCL Program V1.5"
$	Oput " "           
$            
$ 	Read/prompt="Input file? <Recordings.Indexed_Data> " -
		sys$command Recordings_file 
$ 	If Recordings_file .eqs. "" then -
		recordings_file="Recordings.Indexed_Data"
$                             
$ !    	 If need be create the file
$	IF "" .nes. f$SEARCH("''Recordings_File'") then GoTo file_exists
$ 
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !		Create The File
$ Oput " "                     
$ Oput "Creating ''Recordings_File' ( 1 time operation )"
$ Oput " "
$ create/fdl=sys$input 'Recordings_File
IDENT	"29-AUG-1987 03:08:56	VAX/VMS ANALYZE/RMS_FILE Utility"

SYSTEM
	SOURCE                  VAX/VMS

FILE
	ALLOCATION              0
	BEST_TRY_CONTIGUOUS     yes
	BUCKET_SIZE             3
	CLUSTER_SIZE            3
	CONTIGUOUS              no
	EXTENSION               3
	GLOBAL_BUFFER_COUNT     0
	NAME                    "RECORDINGS.INDEXED_DATA"
	ORGANIZATION            indexed
	PROTECTION              (system:, owner:RWED, group:, world:)

RECORD
	BLOCK_SPAN              yes
	CARRIAGE_CONTROL        carriage_return
	FORMAT                  variable
	SIZE                    132

AREA 0
	ALLOCATION              0
	BUCKET_SIZE             3
	EXTENSION               3

AREA 1
	ALLOCATION              0
	BUCKET_SIZE             3
	EXTENSION               3

KEY 0
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_RECORD_COMPRESSION yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "ARTIST"
	NULL_KEY                no
	PROLOG                  3
	SEG0_LENGTH             50
	SEG0_POSITION           0
	TYPE                    string

KEY 1
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "RECORDING_TITLE"
	NULL_KEY                no
	SEG0_LENGTH             50
	SEG0_POSITION           50
	TYPE                    string

KEY 2
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Catalogue_Number"
	NULL_KEY                no
	SEG0_LENGTH             20
	SEG0_POSITION           100
	TYPE                    string

KEY 3
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Medium"
	NULL_KEY                no
	SEG0_LENGTH             12
	SEG0_POSITION           120
	TYPE                    string

KEY 4
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Artist_and_title"
	NULL_KEY                no
	SEG0_LENGTH             100
	SEG0_POSITION           0
	TYPE                    string

KEY 5
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              no
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Whole_Record"
	NULL_KEY                no
	SEG0_LENGTH             132
	SEG0_POSITION           0
	TYPE                    string

ANALYSIS_OF_AREA 0
	RECLAIMED_SPACE         0

ANALYSIS_OF_AREA 1
	RECLAIMED_SPACE         0

ANALYSIS_OF_KEY 0
	DATA_FILL               63
	DATA_KEY_COMPRESSION    83
	DATA_RECORD_COMPRESSION 56
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     48
	DEPTH                   1
	INDEX_COMPRESSION       73
	INDEX_FILL              10
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     10
	MEAN_DATA_LENGTH        130
	MEAN_INDEX_LENGTH       52

ANALYSIS_OF_KEY 1
	DATA_FILL               87
	DATA_KEY_COMPRESSION    67
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     15
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       58
	INDEX_FILL              8
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     5
	MEAN_DATA_LENGTH        26
	MEAN_INDEX_LENGTH       52

ANALYSIS_OF_KEY 2
	DATA_FILL               76
	DATA_KEY_COMPRESSION    57
	DATA_RECORD_COUNT       252
	DATA_SPACE_OCCUPIED     12
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       55
	INDEX_FILL              3
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     4
	MEAN_DATA_LENGTH        19
	MEAN_INDEX_LENGTH       22

ANALYSIS_OF_KEY 3
	DATA_FILL               71
	DATA_KEY_COMPRESSION    0
	DATA_RECORD_COUNT       12
	DATA_SPACE_OCCUPIED     6
	DEPTH                   1
	DUPLICATES_PER_SIDR     23
	INDEX_COMPRESSION       28
	INDEX_FILL              2
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     2
	MEAN_DATA_LENGTH        180
	MEAN_INDEX_LENGTH       14

ANALYSIS_OF_KEY 4
	DATA_FILL               91
	DATA_KEY_COMPRESSION    60
	DATA_RECORD_COUNT       284
	DATA_SPACE_OCCUPIED     30
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       37
	INDEX_FILL              42
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     10
	MEAN_DATA_LENGTH        49
	MEAN_INDEX_LENGTH       102

ANALYSIS_OF_KEY 5
	DATA_FILL               90
	DATA_KEY_COMPRESSION    15
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     75
	DEPTH                   2
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       6
	INDEX_FILL              58
	INDEX_SPACE_OCCUPIED    12
	LEVEL1_RECORD_COUNT     25
	MEAN_DATA_LENGTH        121
	MEAN_INDEX_LENGTH       134
$
$File_Exists:                   
$
$        Open/read/write data_file 'Recordings_File
$
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Basic_Loop:                                              
$
$ 	Read/prompt="[R]eport,[U]pdate.[A]dd,[D]elete,e[X]it <A> " -
		SYS$COMMAND ACTION
$ 	If action .eqs. "" then action = "A"
$ 	Action = f$Extract(0,1,f$edit("''action'","UPCASE,COLLAPSE"))
$ 	If action .eqs. "R" then GoTo report_section
$ 	If action .eqs. "X" then GoTo last_section
$       If action .eqs. "U" then GoTo UD_Section
$       If action .eqs. "D" then GoTo UD_Section
$       If action .eqs. "A" then GoTo Add_Section
$	Oput "''bell'''action' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo basic_loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$UD_Section:
$ !
$	Oput " "
$	Oput "How would you like to select your Update / Delete ?"
$	Read/prompt="Select by [A]rtist, [T]itle or [C]atalogue_number <T>:" SYS$COMMAND update_action
$ 	update_action = f$Extract(0,1,f$edit("''update_action'","UPCASE,COLLAPSE"))
$	If update_action .eqs. "" then update_action = "T"
$       If update_action .eqs. "A" then GoTo Artist_Update
$       If update_action .eqs. "T" then GoTo Recording_Update
$       If update_action .eqs. "C" then GoTo Cat_Num_Update
$	Oput "''bell'''update_action' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo UD_Section
$ !
$ Artist_Update:
$ !
$ Read/prompt="Artist of Recording? " SYS$COMMAND ARTIST
$ artist=f$fao("!(#AS)",50,artist)
$ if debug then Oput "artist=|''artist'|"
$ !
$ first_read:
$ !
$ 	Read/Error=No_Such_Record/index=0/key="''artist'" data_file record
$ goto by_pass
$ sequential_read:
$ !
$ 	Read/Error=No_Such_Record data_file record
$ !
$ by_pass:
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ Read/prompt="Correct Recording ? <Y>" SYS$COMMAND YES_NO
$ yes_no = f$Extract(0,1,f$edit("''yes_no'","UPCASE,COLLAPSE"))
$ if yes_no .eqs. "" then goto record_found
$ if yes_no .eqs. "Y" then goto record_found
$ if yes_no .eqs. "YE" then goto record_found
$ if yes_no .eqs. "YES" then goto record_found
$ if yes_no .eqs. "N" then goto sequential_read
$ if yes_no .eqs. "NO" then goto sequential_read
$
$	Oput "''bell'''yes_no' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo UD_Section
$ !
$ !
$ GoTo record_found    
$ !
$ Cat_Num_Update:
$ !
$ Read/prompt="Catalogue Number ? " SYS$COMMAND NUMBER
$ number=f$fao("!(#AS)",20,number)
$ if debug then Oput "number=|''number'|"
$
$ 	Read/Error=No_Such_Record/index=2/key="''number'" data_file record
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ !
$ GoTo record_found    
$ !
$ Recording_Update:
$ !
$ Read/prompt="Title of Recording? " SYS$COMMAND TITLE
$ title=f$fao("!(#AS)",50,title)
$ if debug then Oput "title=|''title'|"
$
$ 	Read/Error=No_Such_Record/index=1/key="''title'" data_file record
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ !
$ GoTo record_found    
$ !
$No_Such_Record:
$ !
$	Oput "''bell'No such record"
$	GoTo basic_Loop
$ !
$Record_Found:
$ !
$       If update_action .eqs. "A" then -
	    read/delete/index=0/match="GE"/key="''artist'" data_file record
$       If update_action .eqs. "T" then -
	    read/delete/index=1/match="GE"/key="''title'" data_file record
$       If update_action .eqs. "C" then -
	    read/delete/index=2/match="GE"/key="''number'" data_file record
$!
$ If action .eqs. "U" then GoTo update_section
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !     
$Delete_Section:
$ 	Oput " "
$ 	c_rec=f$edit("''record'","Compress") 
$ 	Oput "''c_rec' deleted"
$ 	Oput " "
$ 	GoTo Basic_Loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$Update_Section:
$ !                  
$	Artist=F$edit(f$extract(0,50,"''record'"),"COMPRESS")
$	Title=F$edit(f$extract(50,50,"''record'"),"COMPRESS")
$	Catalogue_Number=F$edit(f$extract(100,20,"''record'"),"COMPRESS")
$ 	Medium=F$edit(f$extract(120,10,"''record'"),"COMPRESS")
$ ! 
$	GoTo Add_Section
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Add_Section:
$
$	if "''action'" .eqs. "A" then title=""
$	if "''action'" .eqs. "A" then Catalogue_Number=""
$
$	New_artist = ""
$	New_title = ""
$	New_catalogue_number = ""
$	New_medium = ""
$
$  	Read/prompt=" Artist? < ''artist' > " sys$command New_artist 
$ 	If New_artist .eqs. "" then New_artist = artist
$ !
$	Read/prompt=" Title? < ''title' > " sys$command New_title 
$ 	If New_title .eqs. "" then New_title = title
$ !
$	Read/prompt=" Catalogue Number? < ''Catalogue_number' >  " -
		sys$command New_Catalogue_number 
$ If New_Catalogue_number .eqs. "" then New_Catalogue_number = Catalogue_number 
$ 	New_Catalogue_number =F$EDIT("''New_Catalogue_number'","UPCASE")
$ !
$  	Read/prompt=" Medium? < ''Medium' > " sys$command New_Medium 
$ 	If New_Medium .eqs. "" then New_Medium = Medium
$	New_Medium=f$edit("''New_medium'","UPCASE")
$	if New_medium .eqs. "CASS" then New_medium ="Cass"
$	if New_medium .eqs. "REC" then New_medium ="Rec"
$                   
$	Artist=New_Artist
$	title=""
$	catalogue_number=""
$	medium=New_medium
$
$ record = -
f$fao("!50AS!50AS!20AS!10AS",New_artist,New_title,New_Catalogue_number,New_Medium)
$
$       write data_file record
$
$ 	GoTo Basic_Loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !                        
$Report_Section:
$ !
$ 	Report_File=""                                              
$ 	Read/prompt="Output file? <Recordings.Report> " sys$command report_file 
$ 	If report_file .eqs. "" then report_file="Recordings.Report"
$
$ Report_sort:
$                   
$ 	open/write output 'report_file'
$ 	Page_Number=0
$ 	key=" "
$ 	Line_Number=61 ! Forces new page at start
$
$ ! Read first record
$ 	read/index=4/key=" "/match="GE"/err=eof data_file record 
$
$ Report_Read_loop:              
$                               
$	if Line_Number .ge. 60 then page_number = page_number + 1
$	if Line_Number .ge. 60 then call page_top
$	if line_number .ge. 60 then line_number = 5
$ 	write output record
$	Line_Number=Line_Number+1
$ 	read/err=eof data_file record
$ 	GoTo report_read_loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ 
$ Page_Top: SUBROUTINE                 
$ 
$ title_record =  -
f$fao("!50AS!50AS!20AS!10AS","Artist","Title","Catalogue No","Medium")
$                
$ firstline= "" + -
f$fao("!60AS!60AS!32AS",f$element(0," ",f$time()),"Recordings Report","Page ''page_number'")
$ 	write output firstline
$ 	write output " "
$ 	write output title_record
$ 	write output " "
$
$ ENDSUBROUTINE                                                  
$
$ EOF:
$ 
$ 	Oput "Report written to ''Report_file'"
$	write output ""
$ 	close output 
$	GoTo Basic_Loop
$ !
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Last_section:         
$
$ 	close data_file 
$ 	Oput "Database Operations Completed"
$ !
$Exeunt:
$ !
$ 	dummy = f$verify(Verify_Proc)
$ 	If "''control_proc'" .nes. "" then -
	 	set control=('Control_Proc')	
$ !
$	Exit
886.9And in this corner...COOKIE::ROLLOWIt&#039;s OK to say the U... wordWed Sep 09 1987 22:594
    I have a couple of hacks and shell scripts for maintaining my
    catalog on an Ultrix system.  If there's interest post some of
    the stuff.
    
886.10Suggestion...WIDGIT::WESTI&#039;m just visiting this planet.Thu Dec 31 1987 21:106
    I would like to see the DCL version to include a key choice on the
    report generation.  i.e.  Just CD's or just LP's...etc.
    
                                    -=> Jim <=-
    
    
886.11Your wish...LESLIE::LESLIEAndy, CSSE DECnet/OSI Program, WG5.Sat Jan 02 1988 15:43587
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ ! This procedure has been written purely as an example of uses of dcl        !
$ !                                                                            !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ !                           Recordings.Com                                   !
$ !                                                                            !
$ ! The purpose of this procedure is to maintain a database of                 !
$ ! Recordings: VTs/CDs/LPs etc, enabling updates, additions, deletions        !
$ ! and reports to a user-specified file.                                      !
$ !                                                                            !
$ ! Bugfixes, Suggestions, etc welcomed.                                       !
$ !                                                                            !
$ ! -- Andy Leslie 26/Aug/87                                                   !
$ !                                                                            !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !                                                                            !
$ ! Change History:                                                            !
$ !                                                                            !
$ !  V1.1  Change "Media" to Medium"  28-8-87                                AL!
$ !  V1.2  Change "INQUIRE" to READ/PROMPT                                   AL!
$ !        Allow Duplicate Catalog Numbers (for blanks)                        !
$ !        Reporting via new 4th key (Artist AND Title)                        !
$ !        Allow repeat Artist /  Medium                                       !
$ !  V1.3  Change Record Length to 132, extend artist and title fields to 50 AL!
$ !  V1.4  Change UPDATE section to use other keys                           TS!
$ !  V1.5  Take out OWNER field from FDL to not upset unprivved users        AL!
$ !  V1.6  Give choice of CD/REC/ALL for report                              AL!
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ 	Control_Proc = f$environment("CONTROL")
$ 	If "''control_proc'" .nes. "" then -
		Set NOCONTROL=('control_proc') ! Restore at end of procedure
$	set control=y
$	on control_y then GoTo last_section
$
$ 	Verify_Proc = f$environment("VERIFY_PROCEDURE")
$ 	Set NOVERIFY ! restore at end of procedure
$ !
$	on error then continue
$	on warning then continue
$ !
$Set_Ups:
$ !
$	Oput:== write sys$output 
$	esc[0,8]   = 27
$	CSI = "''esc'" + "["
$	cr[0,8]    = 13
$	lf[0,8]    = 10
$	Bell[0,8]  = 7
$	Quote[0,8] = 34
$	Artist=""
$       Title=""
$       Catalogue_Number=""
$       Medium=""
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$ 	DEBUG= 0 ! Set to 1 for debugging
$ !                 
$  	IF DEBUG THEN SET VERIFY
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$First_Section:
$
$ Announce:
$
$	Oput " "
$	Oput "LP/CD/Tape Recordings Database DCL Program V1.6"
$	Oput " "           
$            
$ 	Read/prompt="Input file? <Recordings.Indexed_Data> " -
		sys$command Recordings_file 
$ 	If Recordings_file .eqs. "" then -
		recordings_file="Recordings.Indexed_Data"
$                             
$ !    	 If need be create the file
$	IF "" .nes. f$SEARCH("''Recordings_File'") then GoTo file_exists
$ 
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !		Create The File
$ Oput " "                     
$ Oput "Creating ''Recordings_File' ( 1 time operation )"
$ Oput " "
$ create/fdl=sys$input 'Recordings_File
IDENT	"29-AUG-1987 03:08:56	VAX/VMS ANALYZE/RMS_FILE Utility"

SYSTEM
	SOURCE                  VAX/VMS

FILE
	ALLOCATION              0
	BEST_TRY_CONTIGUOUS     yes
	BUCKET_SIZE             3
	CLUSTER_SIZE            3
	CONTIGUOUS              no
	EXTENSION               3
	GLOBAL_BUFFER_COUNT     0
	NAME                    "RECORDINGS.INDEXED_DATA"
	ORGANIZATION            indexed
	PROTECTION              (system:, owner:RWED, group:, world:)

RECORD
	BLOCK_SPAN              yes
	CARRIAGE_CONTROL        carriage_return
	FORMAT                  variable
	SIZE                    132

AREA 0
	ALLOCATION              0
	BUCKET_SIZE             3
	EXTENSION               3

AREA 1
	ALLOCATION              0
	BUCKET_SIZE             3
	EXTENSION               3

KEY 0
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_RECORD_COMPRESSION yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "ARTIST"
	NULL_KEY                no
	PROLOG                  3
	SEG0_LENGTH             50
	SEG0_POSITION           0
	TYPE                    string

KEY 1
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "RECORDING_TITLE"
	NULL_KEY                no
	SEG0_LENGTH             50
	SEG0_POSITION           50
	TYPE                    string

KEY 2
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Catalogue_Number"
	NULL_KEY                no
	SEG0_LENGTH             20
	SEG0_POSITION           100
	TYPE                    string

KEY 3
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Medium"
	NULL_KEY                no
	SEG0_LENGTH             12
	SEG0_POSITION           120
	TYPE                    string

KEY 4
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              yes
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Artist_and_title"
	NULL_KEY                no
	SEG0_LENGTH             100
	SEG0_POSITION           0
	TYPE                    string

KEY 5
	CHANGES                 no
	DATA_KEY_COMPRESSION    yes
	DATA_AREA               0
	DATA_FILL               100
	DUPLICATES              no
	INDEX_AREA              1
	INDEX_COMPRESSION       yes
	INDEX_FILL              100
	LEVEL1_INDEX_AREA       1
	NAME                    "Whole_Record"
	NULL_KEY                no
	SEG0_LENGTH             132
	SEG0_POSITION           0
	TYPE                    string

ANALYSIS_OF_AREA 0
	RECLAIMED_SPACE         0

ANALYSIS_OF_AREA 1
	RECLAIMED_SPACE         0

ANALYSIS_OF_KEY 0
	DATA_FILL               63
	DATA_KEY_COMPRESSION    83
	DATA_RECORD_COMPRESSION 56
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     48
	DEPTH                   1
	INDEX_COMPRESSION       73
	INDEX_FILL              10
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     10
	MEAN_DATA_LENGTH        130
	MEAN_INDEX_LENGTH       52

ANALYSIS_OF_KEY 1
	DATA_FILL               87
	DATA_KEY_COMPRESSION    67
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     15
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       58
	INDEX_FILL              8
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     5
	MEAN_DATA_LENGTH        26
	MEAN_INDEX_LENGTH       52

ANALYSIS_OF_KEY 2
	DATA_FILL               76
	DATA_KEY_COMPRESSION    57
	DATA_RECORD_COUNT       252
	DATA_SPACE_OCCUPIED     12
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       55
	INDEX_FILL              3
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     4
	MEAN_DATA_LENGTH        19
	MEAN_INDEX_LENGTH       22

ANALYSIS_OF_KEY 3
	DATA_FILL               71
	DATA_KEY_COMPRESSION    0
	DATA_RECORD_COUNT       12
	DATA_SPACE_OCCUPIED     6
	DEPTH                   1
	DUPLICATES_PER_SIDR     23
	INDEX_COMPRESSION       28
	INDEX_FILL              2
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     2
	MEAN_DATA_LENGTH        180
	MEAN_INDEX_LENGTH       14

ANALYSIS_OF_KEY 4
	DATA_FILL               91
	DATA_KEY_COMPRESSION    60
	DATA_RECORD_COUNT       284
	DATA_SPACE_OCCUPIED     30
	DEPTH                   1
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       37
	INDEX_FILL              42
	INDEX_SPACE_OCCUPIED    3
	LEVEL1_RECORD_COUNT     10
	MEAN_DATA_LENGTH        49
	MEAN_INDEX_LENGTH       102

ANALYSIS_OF_KEY 5
	DATA_FILL               90
	DATA_KEY_COMPRESSION    15
	DATA_RECORD_COUNT       1
	DATA_SPACE_OCCUPIED     75
	DEPTH                   2
	DUPLICATES_PER_SIDR     0
	INDEX_COMPRESSION       6
	INDEX_FILL              58
	INDEX_SPACE_OCCUPIED    12
	LEVEL1_RECORD_COUNT     25
	MEAN_DATA_LENGTH        121
	MEAN_INDEX_LENGTH       134
$
$File_Exists:                   
$
$        Open/read/write data_file 'Recordings_File
$
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Basic_Loop:                                              
$
$ 	Read/prompt="[R]eport,[U]pdate.[A]dd,[D]elete,e[X]it <A> " -
		SYS$COMMAND ACTION
$ 	If action .eqs. "" then action = "A"
$ 	Action = f$Extract(0,1,f$edit("''action'","UPCASE,COLLAPSE"))
$ 	If action .eqs. "R" then GoTo report_section
$ 	If action .eqs. "X" then GoTo last_section
$       If action .eqs. "U" then GoTo UD_Section
$       If action .eqs. "D" then GoTo UD_Section
$       If action .eqs. "A" then GoTo Add_Section
$	Oput "''bell'''action' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo basic_loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$UD_Section:
$ !
$	Oput " "
$	Oput "How would you like to select your Update / Delete ?"
$	Read/prompt="Select by [A]rtist, [T]itle or [C]atalogue_number <T>:" SYS$COMMAND update_action
$ 	update_action = f$Extract(0,1,f$edit("''update_action'","UPCASE,COLLAPSE"))
$	If update_action .eqs. "" then update_action = "T"
$       If update_action .eqs. "A" then GoTo Artist_Update
$       If update_action .eqs. "T" then GoTo Recording_Update
$       If update_action .eqs. "C" then GoTo Cat_Num_Update
$	Oput "''bell'''update_action' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo UD_Section
$ !
$ Artist_Update:
$ !
$ Read/prompt="Artist of Recording? " SYS$COMMAND ARTIST
$ artist=f$fao("!(#AS)",50,artist)
$ if debug then Oput "artist=|''artist'|"
$ !
$ first_read:
$ !
$ 	Read/Error=No_Such_Record/index=0/key="''artist'" data_file record
$ goto by_pass
$ sequential_read:
$ !
$ 	Read/Error=No_Such_Record data_file record
$ !
$ by_pass:
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ Read/prompt="Correct Recording ? <Y>" SYS$COMMAND YES_NO
$ yes_no = f$Extract(0,1,f$edit("''yes_no'","UPCASE,COLLAPSE"))
$ if yes_no .eqs. "" then goto record_found
$ if yes_no .eqs. "Y" then goto record_found
$ if yes_no .eqs. "YE" then goto record_found
$ if yes_no .eqs. "YES" then goto record_found
$ if yes_no .eqs. "N" then goto sequential_read
$ if yes_no .eqs. "NO" then goto sequential_read
$
$	Oput "''bell'''yes_no' is invalid"
$ 	Oput "''bell'Try again"
$	GoTo UD_Section
$ !
$ !
$ GoTo record_found    
$ !
$ Cat_Num_Update:
$ !
$ Read/prompt="Catalogue Number ? " SYS$COMMAND NUMBER
$ number=f$fao("!(#AS)",20,number)
$ if debug then Oput "number=|''number'|"
$
$ 	Read/Error=No_Such_Record/index=2/key="''number'" data_file record
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ !
$ GoTo record_found    
$ !
$ Recording_Update:
$ !
$ Read/prompt="Title of Recording? " SYS$COMMAND TITLE
$ title=f$fao("!(#AS)",50,title)
$ if debug then Oput "title=|''title'|"
$
$ 	Read/Error=No_Such_Record/index=1/key="''title'" data_file record
$ !
$ recording = f$edit("''record'","COMPRESS")
$ Oput "--------------------------------------------------------------------"
$ Oput "''recording'"
$ Oput "--------------------------------------------------------------------"
$ !
$ GoTo record_found    
$ !
$No_Such_Record:
$ !
$	Oput "''bell'No such record"
$	GoTo basic_Loop
$ !
$Record_Found:
$ !
$       If update_action .eqs. "A" then -
	    read/delete/index=0/match="GE"/key="''artist'" data_file record
$       If update_action .eqs. "T" then -
	    read/delete/index=1/match="GE"/key="''title'" data_file record
$       If update_action .eqs. "C" then -
	    read/delete/index=2/match="GE"/key="''number'" data_file record
$!
$ If action .eqs. "U" then GoTo update_section
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !     
$Delete_Section:
$ 	Oput " "
$ 	c_rec=f$edit("''record'","Compress") 
$ 	Oput "''c_rec' deleted"
$ 	Oput " "
$ 	GoTo Basic_Loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !
$Update_Section:
$ !                  
$	Artist=F$edit(f$extract(0,50,"''record'"),"COMPRESS")
$	Title=F$edit(f$extract(50,50,"''record'"),"COMPRESS")
$	Catalogue_Number=F$edit(f$extract(100,20,"''record'"),"COMPRESS")
$ 	Medium=F$edit(f$extract(120,10,"''record'"),"COMPRESS")
$ ! 
$	GoTo Add_Section
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Add_Section:
$
$	if "''action'" .eqs. "A" then title=""
$	if "''action'" .eqs. "A" then Catalogue_Number=""
$
$	New_artist = ""
$	New_title = ""
$	New_catalogue_number = ""
$	New_medium = ""
$
$  	Read/prompt=" Artist? < ''artist' > " sys$command New_artist 
$ 	If New_artist .eqs. "" then New_artist = artist
$ !
$	Read/prompt=" Title? < ''title' > " sys$command New_title 
$ 	If New_title .eqs. "" then New_title = title
$ !
$	Read/prompt=" Catalogue Number? < ''Catalogue_number' >  " -
		sys$command New_Catalogue_number 
$ If New_Catalogue_number .eqs. "" then New_Catalogue_number = Catalogue_number 
$ 	New_Catalogue_number =F$EDIT("''New_Catalogue_number'","UPCASE")
$ !
$  	Read/prompt=" Medium? < ''Medium' > " sys$command New_Medium 
$ 	If New_Medium .eqs. "" then New_Medium = Medium
$	New_Medium=f$edit("''New_medium'","UPCASE")
$	if New_medium .eqs. "CASS" then New_medium ="Cass"
$	if New_medium .eqs. "REC" then New_medium ="Rec"
$                   
$	Artist=New_Artist
$ 	title=""
$	catalogue_number=""
$	medium=New_medium
$
$ record = -
f$fao("!50AS!50AS!20AS!10AS",New_artist,New_title,New_Catalogue_number,New_Medium)
$
$       write data_file record
$
$ 	GoTo Basic_Loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ !                        
$Report_Section:
$ !
$ 	Report_File=""                                              
$ 	Read/prompt="Output file? <Recordings.Report> " sys$command report_file 
$ 	If report_file .eqs. "" then report_file="Recordings.Report"
$                   
$Report_Medium_Query:
$
$
$ 	Read/prompt="Report on? {CD/REC/ALL} " sys$command Report_Medium
$ 	If Report_Medium .eqs. "" then Report_Medium="ALL"
$	Report_Medium = f$edit(Report_Medium,"UPCASE,TRIM")
$	IF Report_Medium .nes. ("ALL" .or. "CD" .or. "REC" ) then -
		goto Report_Sort
$	Oput "''bell'Options are CD, REC or ALL"
$       GoTo Report_Medium_Query
$                   
$ Report_sort:
$                   
$ 	open/write output 'report_file'
$ 	Page_Number=0
$ 	key=" "
$ 	Line_Number=61 ! Forces new page at start
$
$ ! Read first record
$ 	read/index=4/key=" "/match="GE"/err=eof data_file record 
$ 	Medium=f$extract(120,12,record)
$	Medium=f$edit(medium,"UPCASE")
$ Report_Read_loop:              
$                               
$	if Line_Number .ge. 60 then page_number = page_number + 1
$	if Line_Number .ge. 60 then call page_top
$	if line_number .ge. 60 then line_number = 5
$
$	If Report_Medium .eqs. "ALL" then goto Write_Output_Rec
$	If f$locate("''Report_Medium'","''medium'") .eq. -
		f$length("''medium'") then goto read_datafile
$                                        
$Write_Output_rec:
$ 	write output record
$	Line_Number=Line_Number+1
$
$Read_datafile:
$
$ 	read/err=eof data_file record
$ 	Medium=f$extract(120,12,record)
$	Medium=f$edit(medium,"UPCASE")
$ 	GoTo report_read_loop
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$ 
$ Page_Top: SUBROUTINE                 
$ 
$ title_record =  -
f$fao("!50AS!50AS!20AS!10AS","Artist","Title","Catalogue No","Medium")
$                
$ firstline= "" + -
f$fao("!60AS!60AS!32AS",f$element(0," ",f$time()),"Recordings Report","Page ''page_number'")
$ 	write output firstline
$ 	write output " "
$ 	write output title_record
$ 	write output " "
$
$ ENDSUBROUTINE                                                  
$
$ EOF:
$ 
$ 	Oput "Report written to ''Report_file'"
$	write output ""
$ 	close output 
$	GoTo Basic_Loop
$ !
$ !
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !
$Last_section:         
$
$	close/nolog output
$ 	close/nolog data_file 
$ 	Oput "Database Operations Completed"
$ !
$Exeunt:
$ !
$ 	dummy = f$verify(Verify_Proc)
$ 	If "''control_proc'" .nes. "" then -
	 	set control=('Control_Proc')	
$ !
$	Exit