Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Hamilton
    Posts
    150

    Unanswered: loading configuration information from a flat file

    Hello all, we have a load script to load some iformation into a database, however the information being inputted is hard coded.

    Is there a way to have this configuration information loaded from a flat file instead of hard coding it?

    Also if down the line in if some other part of the process fails, is there a way to undo the changes that have been loaded?

    thanks for your help

    Mark

    here is the load script

    delete from indexfield;
    delete from datatype;
    delete from doctype;
    delete from folder;
    delete from docformat;
    delete from archivelogonprofile;
    delete from clientorg;

    -- insert Client Orgs: orgID, orgDN, description, sorryDoc
    insert into clientorg values ('XXX', 'orgDN.XXX', 'XXX (Pyramid)', null);

    -- insert Archive Logon Profiles: logonName, password, poolSize
    insert into archivelogonprofile values ('username', 'password', 3);

    -- insert User Profiles: orgId, userName, logonName, notificationMethod, notificationUrl, notificationEmail, maxSearchOverride, maxRangeOverride
    insert into userprofile values ('XXX', 'user', 'username', 1, 'url', 'email', 5, '90');
    insert into userprofile values ('XXX', 'user', 'username', 1, 'url', 'email', 5, '90');

    -- insert Doc Formats: code, description, convertorPlugin
    insert into docformat values ('001', 'MODCA', '');

    -- insert Folders: folderName, docFormatCode, maxSearchItems, maxRetrieveItems
    insert into folder values ('XXXARI - GL,Group1,Group2', '001', 5, 5);

    -- insert Doc Types: orgId, docTypeName, folderName
    insert into doctype values ('XXX', 'GL/1/2', 'XXXARI - GL,Group1,Group2');

    -- insert Data Types: code, description
    insert into datatype values ('N/A', 'data type - not applicable');
    insert into datatype values ('DAT', 'data type - date');
    insert into datatype values ('DEC', 'data type - decimal');
    insert into datatype values ('INT', 'data type - integer');
    insert into datatype values ('STR', 'data type - string');

    -- insert Index Fields: folderName, logicalIndexName, physicalIndexName, dataTypeCode, displayFormat, minValue, maxValue, maxRange, isAlternateKey, isMandatory, sortOrder, sortAscending
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'ProcessingDate', 'Processing Date', 'DAT', 'YYYYMMDD', '0', '99991231', '90', 'Y', 'Y', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'TransitBankAcct', 'TransitBankAcct', 'STR', '', '', '', '', 'Y', 'Y', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'Account', 'Account', 'STR', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'RoutingTransitNumber', 'Routing/Transit Number', 'STR', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'SerialNumber', 'Serial Number', 'DEC', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'ChequeAmount', 'Amount', 'DEC', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'TransactionCode', 'Transaction Code', 'INT', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'DebitCreditIndicator', 'DR/CR Indicator', 'STR', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'DepositAccount', 'Deposit Account', 'STR', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'DepositAmount', 'Deposit Amount', 'DEC', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'Region', 'Capture Site', 'STR', '', '', '', '', 'N', 'N', 0, 'Y');
    insert into indexfield values ('XXXARI - GL,Group1,Group2', 'ItemSequenceNumber', 'Item Sequence Number', 'DEC', '', '', '', '', 'Y', 'N', 0, 'Y');

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Mark,

    First make sure that you logs are large enough to do all the work
    of the script in one unit of work. (if that is your entire script, your logs should be OK).

    Second you have manually established a connecction to the database
    (db2 connect to mydb user me using password)

    Third add the following command to the very end of your script:
    COMMIT WORK;

    Then run the script with:
    DB2 -c- -tvsf script.ddl
    ( the -c- turns off auto-commit, the s in -tvsf will stop the script on an error)


    If it runs to completion, you are done. If there is an error you will
    need to issue:
    DB2 rollback

    Don not forget to hang up your connection manually:
    db2 disconnect all

    HTH
    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •