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>) {

	# 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";




The above created the following CIM format.

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


Submit a Comment

Your email address will not be published.

You May Also Like…


Zebra Printer Language The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...