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 *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...