Misi,

Thank you for finding that!  Saved me from having to turn on my NAS backup 
drives and scanning them.  :)

Much appreciated!

Matt

-----Original Message-----
From: Action Request System discussion list(ARSList) 
[mailto:[email protected]] On Behalf Of Misi Mladoniczky
Sent: Saturday, August 25, 2012 8:01 AM
To: [email protected]
Subject: Re: Anyway to populate ardb.conf other than manual?

Hi Matt,

Here is the makeARDB.pl ARSperl-script Matt Reinfeldt wrote, apparently in 2001.

I am pasting the code at the end, as I guess PL attachment might be truncated 
or barred.


        Best Regards - Misi, RRR AB, http://www.rrr.se (ARSList MVP 2011)

Products from RRR Scandinavia (Best R.O.I. Award at WWRUG10/11):
* RRR|License - Not enough Remedy licenses? Save money by optimizing.
* RRR|Log - Performance issues or elusive bugs? Analyze your Remedy logs.
Find these products, and many free tools and utilities, at http://rrr.se.

#!/usr/local/bin/perl
###########################################################################
#    makeardb.pl - generate an ardb.conf file
#    Original Author:   Matt Reinfeldt <[email protected]>
#
#    (c) Copyright 2001
#    Available under the terms of the GNU GENERAL PUBLIC LICENSE
###########################################################################

use ARS;
use strict;

if ($ARS::VERSION < 1.61) {
  die "This is version $ARS::VERSION of ARSperl, version 1.61 or later 
required\n"; } print "ARS version: $ARS::VERSION\n"; my %config = ();

## change these variables to suit your needs
        $config{'Username'} = '';  ## you will be prompted if left empty
        $config{'Password'} = '';  ## you will be prompted if left empty
        $config{'Server'}       = '';  ## you will be prompted if left empty
        $config{'ErrMax'}       = 0;
        $config{'Verbose'}      = 0;

        ## comment out this next line if you don't want to use a Private Server
        ## otherwise, change the RPC# to what you need it to be
        $ENV{'ARRPC'} = 390650;

        ### please modify these Clauses to suit your needs!
        my @clauses = '';
        $clauses[0] = 'Clause:PCTFREE 20';
        #$clauses[1] = 'Clause: TABLESPACE arindex';
        #$clauses[2] = '';
        #$clauses[3] = '';
        #$clauses[4] = '';
        #$clauses[5] = '';
        ###
        my $outFile = 'ardb.conf';

### do not change anything below here unless you know what you are doing! :-) 
my $Ctrl = '';

$Ctrl = &login;
my @schemata = '';
my $sql = '';
$sql = "select name from aradmin.arschema where schematype = 1 order by name";

print "\n\n\nGetting list of schemas... \n"; (my $h = ars_GetListSQL($Ctrl, 
$sql)) or die "ERR: $ars_errstr\n";

## load the schemata array...
my $rows = scalar($h->{numMatches});
for(my $col = 0; $col < scalar($h->{numMatches}); $col++) {
    for(my $row = 0 ; $row <= scalar($#{@{$h->{rows}}[$col]}); $row++) {
                push(@schemata, @{@{$h->{rows}}[$col]}[$row] );
    }
}
## need to strip the empty entry
shift(@schemata);
print "Done getting schemas\n";
print "\nGenerating $outFile...\n\n";

open (OUT, ">$outFile");
foreach my $schema (@schemata) {
        print OUT "Form:$schema\n";
        my $s = ars_GetSchema($Ctrl, $schema);

        my $index = $s->{'indexList'};
        foreach my $in (@$index) {
                my $list = $in->{'fieldIds'};
                foreach my $fieldid (@$list) {
                        print OUT "Index {\nId:$fieldid\n";
                        foreach my $clause (@clauses) {
                                print OUT "$clause\n";
                        }
                        print OUT "}\n";
                }
        }
}
close(OUT);
print "Done making $outFile!\n$#schemata Forms were processed.\nLogging out of 
Remedy...\n\n";

&logout;
if ( $config{'Verbose'} ) {
    print "logged out of the Remedy system...\n"; } print "Thank you, and have 
a nice day!\n"; 
###########################################################################
# end of - Main -
# begin sub-routines
###########################################################################
sub login {
    use Term::ReadKey;
    my ($server,$user, $pass) = '';

    if ( $config{'Server'} eq '' )
    {
        print "Enter the name of the Server you wish to document: ";
        $server =<STDIN>;
        chomp($server);
        $config{'Server'} = $server;
    }
    if ( $config{'Username'} eq '' )
    {
        print "Admin Username for $config{'Server'}: ";
        $user=<STDIN>;
        chomp($user);
        $config{'Username'} = $user;
    }
    if ( $config{'Password'} eq '' )
    {
        if ($^O eq 'MSWin32') {
            ReadMode 'noecho';
        } else {
            system("stty -echo");
        }
        print "${config{'Username'}}'s password on $config{'Server'}: ";
        $pass = <STDIN>;
        chomp($pass);
        $config{'Password'} = $pass;
        if ($^O eq 'MSWin32') {
            ReadMode 'normal';
        } else {
            system("stty echo");
        }
    }

    return(ars_Login($config{'Server'}, $config{'Username'},
        $config{'Password'})) or die "\n$ars_errstr!\n"; } 
###########################################################################
sub logout {
  ars_Logoff($Ctrl);
}
###########################################################################

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org attend wwrug12 
www.wwrug12.com ARSList: "Where the Answers Are"

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to