Perl Script to Convert a Progress Table Dump file to a CIM Load File

Written by James McDonald

September 14, 2012

Ran into a problem trying to load a .d file with the progress editor.  I think there was a unique index on the first first field of the msg_mstr table so I had to update the records using CIM from inside QAD.

This is the script I used to convert it from .d format to .cim.

#!/usr/bin/perl -w

open ( FH, "<msg_mstr.d") or die "Can't open File";

open ( OUT, ">msg_mstr.cim") or die "Can't open output";

while(<FH>) {

	chomp;
	# given this line in the msg_mstr.d file
	# 1576 "Lotus Notes does not fully support this option" \
        # "us" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
	# this regular expression will select the 1st three
        # values and store them in $1, $2 and $3
	$_ =~ m/(\d+)\s(\".*\")\s(\"\w{2}\")/;

	print OUT '@@batchload mgmsgmt.p' . "\n";

	print OUT "$3\n$1\n$2\n";

	print OUT '@@end' . "\n";

}

close(FH);

close(OUT);

The above created the following CIM format.

@@batchload mgmsgmt.p 
"us" 
1576 
"Lotus Notes does not fully support this option" 
@@end

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...