You are on page 1of 3

ACL Technical Support

Standard Script Document

COMMENT
** DISCLAIMER NOTICE:
** ACL SERVICES LTD. ("ACL") AND ITS DISTRIBUTORS PROVIDE THE SCRIPT "AS IS" AND
** FREE OF CHARGE. ACL AND ITS DISTRIBUTORS: (A) DO NOT PROVIDE SUPPORT FOR THESE
** SCRIPTS; (B) MAKE NO WARRANTIES OR REPRESENTATIONS, EXPRESSED OR IMPLIED, WITH
** RESPECT TO THE SCRIPT, INCLUDING ITS FITNESS FOR A PARTICULAR PURPOSE,
** MERCHANTABILITY, DURABILITY, QUALITY OR ITS NON-INFRINGEMENT; (C) DO NOT
WARRANT ** THAT THE SCRIPT IS FREE FROM ERRORS; AND (D) WILL NOT BE LIABLE FOR ANY
DAMAGES ** (INCLUDING, BUT NOT LIMITED TO INDIRECT DAMAGES SUCH AS LOST PROFITS
AND LOST
** DATA) ARISING OUT OF THE USE OF, OR THE INABILITY TO USE THE SCRIPT. YOU AGREE
TO ** ASSUME ALL RISK OF LOSS OR DAMAGE ARISING FROM THE USE OF THE SCRIPT.
END

COMMENT
*******************************************************************************
** Script Name: Append_multiple_report_files (Script 1 of 2)
** Description: This script calls script Append_multiple_report_files_2. It
** appends all report files in the current folder with extension
** '.RPT' into one master file.
**
** Requirements: Existing table used as a template. All files must be
** identical in structure. They must be defined by skipping the
** Data Definition Wizard and defining individual filters for
** different record types. This implies that there is a detail
** record type filter, for which the user will be prompted.
**
** Output: A single data file with the combined records from all '.RPT'
** files in the current folder.
**
** Written By: Thomas Steeves, ACL Services On: March 8, 2000
** Updated By: Adam Lai, ACL Services On: Oct 13, 2003
** Last Edit By: Don Mak, ACL Services On: August 30, 2004
*******************************************************************************
END

COMMENT
***** This will allow the script to overwrite previous results.

SET SAFETY OFF

CLOSE PRI SEC

DELETE ALL OK
DELETE "All_Records.FIL" OK
DELETE FORMAT All_Records OK

COMMENT
***** Prompt for the template table to use for all data files.

DIALOG (DIALOG TITLE "ACL - Append Multiple Report Files" WIDTH 407 HEIGHT 169 )
(BUTTONSET TITLE "&OK;&Cancel" AT 300 96 DEFAULT 1 ) (ITEM TITLE "f" TO
"v_template_table" AT 24 60 WIDTH 232 ) (TEXT TITLE "Please select the table to be
used as template:" AT 24 28 )

OPEN %v_template_table%

Page 1 of 3
ACL Technical Support
Standard Script Document

COMMENT
***** Prompt for the record type to use.

DIALOG (DIALOG TITLE "ACL - Append Multiple Report Files" WIDTH 487 HEIGHT 143 )
(BUTTONSET TITLE "&OK;&Cancel" AT 384 72 DEFAULT 1 ) (TEXT TITLE "Please select the
detail record type filter used in the template table:" AT 36 40 ) (ITEM TITLE "L" TO
"v_detail" AT 36 72 WIDTH 212 )

COMMENT
***** Modify the following line if report files to be appended use a different
***** extension.

DIR *.RPT TO Report_Names

OPEN Report_Names

COUNT

COMMENT
***** Initialize temporary counter variables to track the number of files
***** selected.

v_counter = COUNT1
v_record = 1

COMMENT
***** Do Append_multiple_report_files_2 script once for each file.

DO Append_multiple_report_files_2 WHILE v_record <= v_counter

DELETE FORMAT Report_Names OK


DELETE "Report_Names.FIL" OK

IF FILESIZE("All_Records.FIL") > -1 OPEN All_Records

SET SAFETY ON

Page 2 of 3
ACL Technical Support
Standard Script Document

COMMENT
** DISCLAIMER:
** ACL SERVICES LTD. ("ACL") AND ITS DISTRIBUTORS PROVIDE THE SCRIPT "AS IS"
** AND FREE OF CHARGE. ACL AND ITS DISTRIBUTORS MAKE NO WARRANTIES OR
** REPRESENTATIONS, EXPRESSED OR IMPLIED, WITH RESPECT TO THE SCRIPT,
** INCLUDING ITS FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, QUALITY
** OR ITS NON-INFRINGEMENT. ACL DOES NOT WARRANT THAT THE SCRIPT IS FREE FROM
** ERRORS. ACL AND ITS DISTRIBUTORS WILL NOT BE LIABLE FOR ANY DAMAGES
** (INCLUDING, BUT NOT LIMITED TO INDIRECT DAMAGES SUCH AS LOST PROFITS AND
** LOST DATA) ARISING OUT OF THE USE OF, OR THE INABILITY TO USE THE SCRIPT.
** YOU AGREE TO ASSUME ALL RISK OF LOSS OR DAMAGE ARISING FROM THE USE OF THE
** SCRIPT.
END

COMMENT
*******************************************************************************
** Script Name: Append_multiple_report_files_2 (Script 2 of 2)
** Description: This script links the template table to the selected data
** file.
**
** Requirements: Existing table used as a template to link all data files
** before appending the files.
**
** Output: A single data file with the combined records from all
** selected files.
**
** Written By: Thomas Steeves, ACL Services On: March 8, 2000
** Updated By: Adam Lai, ACL Services On: Oct 13, 2003
** Last Edit By: Don Mak, ACL Services On: August 30, 2004
*******************************************************************************
END

COMMENT
***** Select the correct filename from the temporary file.

LOCATE RECORD v_record


v_file_name = ALLTRIM(File_Name)

OPEN "%v_file_name%" FORMAT %v_template_table%

COMMENT
***** Extract and append all data to a new file called All_Records.

EXTRACT FIELDS ALL TO "All_Records" IF %v_detail% APPEND

COMMENT
***** Increase counter for next file.

ASSIGN v_record = v_record + 1


OPEN Report_Names

Page 3 of 3

You might also like