<p>I have a 200+ case statement in Classic ASP which is getting out of control. It sets 5 variables, based on which case is selected. Address, Phone, Name etc. Just sets the variables and nothing else in each case.</p>

<p>Databases or files are not an option for this application.</p>

<p>Coming from the Perl world I would use a hash to store this info. </p>

[{'answer_id': 50146, 'author': 'ColinYounger', 'author_id': 1223, 'author_profile': 'https://Stackoverflow.com/users/1223', 'pm_score': 2, 'selected': False, 'text': "<p>Getting out of control? I think it's already out of control!</p>\n\n<p>Can you not categorise the cases into 'x' general areas and split down into helper routines?</p>\n"}, {'answer_id': 50212, 'author': 'Luke Girvin', 'author_id': 133, 'author_profile': 'https://Stackoverflow.com/users/133', 'pm_score': 3, 'selected': True, 'text': '<p>Brian, the classic ASP equivalent of a Perl hash is the <a href="http://www.microsoft.com/technet/scriptcenter/guide/sas_scr_ildk.mspx?mfr=true" rel="nofollow noreferrer">Scripting.Dictionary</a> object.</p>\n'}, {'answer_id': 51661, 'author': 'JeffV', 'author_id': 445087, 'author_profile': 'https://Stackoverflow.com/users/445087', 'pm_score': 1, 'selected': False, 'text': "<p>Depends on what you want for performance. </p>\n\n<p>The case statement is ugly but does not consume memory that would need to be allocated.</p>\n\n<p>However, you could create a class for your fields and load instances of them into a Dictionary. Perform this operation in the global.asp script so it only happens once. Store the dictionary in the global asp collection such that it is only allocated once but used with each page call.</p>\n\n<p>My appologies for not getting too specific here... it's been a while.</p>\n"}, {'answer_id': 52406, 'author': 'Michael Pryor', 'author_id': 245, 'author_profile': 'https://Stackoverflow.com/users/245', 'pm_score': 0, 'selected': False, 'text': "<p>This should be done with a database, but since you said that is not an option, nothing you will write will be any less complex than a switch statement, since it's all required to live in your code (according to your terms of no db and no files).</p>\n\n<p>I mean, you could use an Excel Spreadsheet if the idea of a <strong>database</strong> is too <strong>complicated</strong> but technically that would be a file as well!</p>\n"}, {'answer_id': 52414, 'author': 'Jimmy Chandra', 'author_id': 5321, 'author_profile': 'https://Stackoverflow.com/users/5321', 'pm_score': 1, 'selected': False, 'text': '<p>A lot of people use VBScript for Classic ASP, but you can use JavaScript / JScript on the server as an alternative.  As a matter of fact, this is my preferred way of doing Classic ASP before finally moving to .NET (except in some cases, you will have to mix in VBScript for special cases, i.e. Disconnected Recordset, ExecuteNoRecords, etc.).  It will provide you with better OOP support vs VBScript.  Maybe you can try refactor that to.some sort of Strategy pattern afterward.  Worth looking into I guess for better maintenance in the long run.</p>\n'}, {'answer_id': 52427, 'author': 'rjzii', 'author_id': 1185, 'author_profile': 'https://Stackoverflow.com/users/1185', 'pm_score': 1, 'selected': False, 'text': "<p>The fact that you can't migrate this over to a database or a text file is a bit of an issue as they would be the best solution for this type of data. However, if you have to have it in the code you could always try putting it into a matrix that you predefine. Then you could provide a function that returns the data from a given row in the matrix.</p>\n"}, {'answer_id': 60344, 'author': 'Scott', 'author_id': 6126, 'author_profile': 'https://Stackoverflow.com/users/6126', 'pm_score': 0, 'selected': False, 'text': '<p>Scripting dictionary is the best option <strong>IMHO</strong>.</p>\n'}]
['https://Stackoverflow.com/questions/50140', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3208/']