Open Menu

Synergex Blog


Shameless plug

By William Hawkins, Posted on March 28, 2011 at 4:38 pm

I’ve just come back from the UK, where Richard Morris and myself attended DevWeek 2011.   The DevWeek conference was hosted at the Barbican center in London, and covered a multitude of various Microsoft / Windows technologies. As it wasn’t hosted by Microsoft, there were no significant goodies/toys given away, but we did gain a lot of great info on developing state-of-the-art user interfaces, and lose a few pounds climbing 4 flights of stairs between sessions.
After the conference, Richard and I visited a couple of customers and had planned to spend a couple of days performing analysis work for a prospective PSG project.  However, a few hours into this analysis task, we got a cry for help from another UK customer that Richard had been working with.
This customer was in the process of moving their application from OpenVMS to Windows.  They had already moved the executables to Windows and were using xfServer to access the data on OpenVMS.  Over the weekend that followed DevWeek, Richard had helped them do a test migration of the data from OpenVMS RMS files to Windows SDBMS isam files, and it all appeared to be working fine.  However, during their testing, a few files were showing spurious data in a few fields – hence the cry for help.
It turns out that the bad data was actually caused by integer fields, that everybody had assumed were decimal fields.  Now, when you unload data files, most people just use the standard isload/fconvert (or Convert on OpenVMS) to generate a sequential file, which works great for Synergy alpha and decimal fields, but when you have integer (aka binary) fields, regular sequential files no longer “cut the mustard”.  One of the issues you have to deal with is this.  If you have an integer field that contains the value 13, (aka a Carriage Return character) in a sequential file, the operating system assumes that it’s an end-of-record character and treats the record as truncated.  So now the next part of the same record is now treated as a new truncated record, and you have two “bad” records in the file, instead of one “good” one.
The way to resolve this class of issue is to use a “counted” file.  This is a special form of sequential file where the length of the record is included with each record, so when re-loading data, the application knows how many characters there are in the record, and it will ignore any “spurious” control characters in the middle of the record.   Job done, you would think, but no.  Being OpenVMS it wasn’t as simple as that, as we also had to use the OpenVMS Convert utility to change the sequential file into a stream file, so we can preserve the file as a counted file after it was FTP’d to Windows.

With Synergy version 9, the language supports several new data types (e.g. boolean, enum) which are really integer fields, so if you start to store these new data types in your Synergy DBMS files, you need to start using counted files, instead of regular sequential files when loading/unloading data.  Fortunately, (in this case) both OpenVMS and Windows are little endian systems, so there was no issue about changing endian type, but this is something that you may need to consider, should you consider moving integer data between systems.
Now, to come back to the topic I started with of “attending conferences” (and to issue a shamless plug), if you come to the 2011 SPC in Chicago or Oxford, you’ll be able to hear all about managing binary data in Synergy DBMS files.

Hope to see you there.


Free Stuff!

By William Hawkins, Posted on March 14, 2011 at 2:46 pm

It’s a rare occasion where anything is truely free. Most of the time it’s simply a way for a marketing company to obtain information about you, so they can provide (or bombard) you with information about products that you have no interest in purchasing. However, there are some occasions when “free” really does mean that there’s no additional cost. The Synergex CodeExchange is (IMHO) one of those gems.
In may last blog, I discussed the process of validating a large number of the CodeExchange submissions with Synergy 9.5 and Synergy for .Net. In this blog, I want to highlight a couple of new submissions that you may find useful.

SynArrayList – this submission contains a couple of subroutines that allow you to sort an ArrayList in Synergy, either using a bubble sort or dynamic memory/qsort. You probably won’t need to use both methods of sorting, but they provide code examples to allow you to create custom sort routines of your own. This submission also contains an example of extending the ArrayList class, and creating a new class that processes Synergy alpha types natively.  This allows you to avoid the requirement to box/unbox your alpha variables as you process a collection.  Of course, the underlying arraylist still requires object types, but you don’t have to be concerned about that. And it has sort() and reverse() methods and some other ArrayList method that are part of the ArrayList class in .NET

SourceTree – this submission builds a utility that will parse your source code, and generate a data file that records the subroutine/functions in your application that call other subroutines/functions.  This allows you to create documentation on where routines are used in your application.  It can also be used to generate a list of routines called by a particular subroutine/function/mainline and all the routines that are called by those routines.

I’m also working on some other CodeExchange submissions – examples include a file I/O class and a utlity to create the xfNetLink attributes that can decorate your code.  Watch this space!!!


Dig into Synergy/DE 9.5 – Using CodeExchange

By William Hawkins, Posted on November 19, 2010 at 12:46 pm

Like many of you, I’ve been waiting with bated breath for the release of Synergy/DE 9.5, and the general availability of Synergy .NET. The development team has been working on this project for a few years (I’m sure it seems like longer for them). But it wasn’t until the beta release earlier this year, that it became something with which you could actually start to write code that really did something useful. Those of you who were at the SPC a few weeks ago had an opportunity to use Synergy/DE 9.5 to develop a WPF application that used Synergy for all the (non-XAML) code in Visual Studio 2010.

As part of the beta testing effort, I’ve been using and updating code that has been submitted to the CodeExchange, and I thought I’d share what I did. Hopefully you can leverage the modifications that were done to the CodeExchange items to help with a possible migration to the .NET environment.

In order to make my life easier, I created a folder C:\Development\CodeExchange and deposited all of the CodeExchange submissions that were created by Synergy PSG, into subfolders.

Phase 1 Test the code in traditional Synergy 9.5.

As I knew I’d be doing a lot of test builds, I wanted to use the project build system built into Workbench (in Synergy/DE 9.3). So I created an empty workspace, and added all the Workbench projects that were in the subfolders. For those projects that didn’t have a Workbench projects, I created one, and for the few projects that didn’t have a mainline program, I created one of those too. Most of the time spent in this phase was in setting the Workbench build environment. As you would expect, the code didn’t require much (if any) modification.

Phase 2 Test the code in Synergy .NET 9.5.

When taking the CodeExchange submissions and building them in Visual Studio, it turned out to relatively easy. In order not to “pollute” the standard CodeExchange folders with Visual Studio “stuff”, I decided to create a separate folder for Visual Studio project. This was C:\Development\CodeExchangeVS, and under this folder is a subfolder for each submission – just like the Workbench folders. Inside these subfolders are a Visual Studio solution and a Synergy project. The Synergy project contains references to the code in the Workbench folders, so that I can use the same code in both places. If you just add a source code file to a Visual Studio project, what you’re really doing is copying the file to the project folder, but all Add Reference does is point the project to the appropriate source file. Now that I have a Visual Studio project, it’s just a matter of hitting the F6 button to build my application. If only it were that simple…..

When building the CodeExchange code in Visual Studio, the code falls into a number of different categories;

1) Requires no/minimal changes

2) Uses features (functions/subroutines) that are not supported

3) Needs recoding

4) Uses features (APIs) that are not supported

Again, most of the code fell into the first category, as it had already compiled using the traditional Synergy compiler. One thing that fell into the “minimal changes” category was the introduction of a logical to point to an include folder (usually the same folder as the source). As Visual Studio was using sources from a different folder, we could no longer rely upon the include file being in the “current folder”. For the purposes of CodeExchange sources, wherever a logical is required to access an include file, the source will use INC:

Also, there was very little code that required recoding – this was almost exclusively required by the use of %DLL_CALL(), which needed to be changed to %DLL_NETCALL(). The coding change was relatively straightforward. (See example below.)

.ifdef DBLNET

begin

argArray = new object[2]

argArray[1] = (object)^addr(spec)

argArray[2] = (object)^addr(WIN32_FIND_DATA)

srch_hdl = %dll_netcall(dll, DLL_TYPE_WINAPI, ‘FindFirstFileA’, argArray)

end

.else ;DBLNET

srch_hdl = %dll_call(dll, DLL_TYPE_WINAPI, “FindFirstFileA”, ^addr(spec), ^addr(WIN32_FIND_DATA))

.endc ;DBLNET

The bulk of the changes needed were mostly to deal with unsupported or not yet implemented features. I first started this project in Feb/Mar 2010, and as time progressed, the number of issues grew significantly smaller as the Synergy development team implemented features omitted from the early betas. At the time of writing, the unsupported features that got caught by the compiler are the use of HTTP_SERVER, %SS_FATAL() and W_CAPTION(). Another problem feature is the use of UI Toolkit. While there is a version of UI Toolkit that you can use when you build using Visual Studio, it’s not a complete implementation. The UI Toolkit provided with Synergy .NET is primarily aimed at allowing UI Toolkit code to be used with xfNetLink .NET and/or .NET interop projects – which are projects that do not use UI Toolkit for the User Interface. If you actually run the application and call a UI-related Toolkit routine, a runtime error will be thrown. For all the projects that used UI Toolkit, I added a try-catch around the entire application, so that I can catch any errors thrown by UI Toolkit. From a CodeExchange perspective, use of UI Toolkit is the main item that falls into the fourth category. The RCB API is another example of an unsupported feature in Synergy .NET.

One difference between traditional Synergy and Synergy .NET, is that there is no “stop message” dialog. “Hurrah!” I hear a lot of you say. Me too. However, with the CodeExchange submissions, most of the test programs are console applications, and now that there’s no stop message, when they complete, the application goes away too. This doesn’t give you much time to read the screen. So I wrote myself a little StopMessage routine, and added it to every application that needed it. As it turns out, this change was by far the largest change that I had to do.

Along the way, we’ve also enhanced some of the submissions; for example, the StringUtil submission is now more functionally rich, and we also added some new submissions (e.g., isamBenchmarks, GetDirFiles, memProc, POP3mail and SelectExample). There is also a new submission CodeExchangeVS which contains all the submissions below, plus the Workbench workspace with all the Workbench projects and all the Visual Studio solutions.

Here are the CodeExchange submissions that are included in the CodeExchangeVS download;

addSourceControl, ASCIIEncoding, axlsort, Base64, Base64_convert, BatchFileConversion, COPY_HANDLE, creditCard, DateTime, DTKproto, dtk_i_enable_set, dtk_list_multi_select, FileLocks, FindNPchars, FixData, GetDirFiles, GetWindowSize, HTTPexample, HTTPqueryString, iConvert, IsamBenchmarks, isHoliday, ismKey, ismSts, lct_lmf, LicensingToolkitExample, ll_accept, memProc, PartialMatch, POP3mail, Registry, RemoteServer, rfa_hex, rpschk, rpssql, rpsxdl, rpsxml, SelectExample, SMTPmail, SocketExamples, StringUtil, synckodbc, SynPsg.Rps, UpsTrack, url_encode, uspsWebService, WinDir, xfnl_synergy, xfplini, xfpllog, xfspism2xml.

Also, one final change. At the request of Synergy/DE Developer Support, each submission includes all the code required to rebuild the application. Previously, some CodeExchange submissions required you to download other CodeExchange submissions.

If you’re using any of the CodeExchange items above, I would recommend that you download the updated version. Synergex PSG is constantly looking for new opportunities to enhance the CodeExchange code submissions, so if you have any suggestions for new items, please let us know.

A Synergy/DE 9.5 RC (release candidate) is available now, and the general release should be available soon.


Giving people what they want

By William Hawkins, Posted on August 6, 2010 at 12:53 pm

I just spent the past few days in Seattle attending Visual Studio Live! 2010. If you’re a regular follower of the Synergex PSG blog, you may have the impression that we swan around the world doing nothing but attending conferences. While I'd like that to be true, it's really in an effort to provide our customers with consultants that are more knowledgeable in non-Synergy technologies, Synergex has expanded both the number of people that we send to conferences and the number of conferences that we attend.  For example, this week I was accompanied by Jerry Fawcett and Steven Lane—both from our support team. And, in my defense, this is only the third conference that I’ve been to (as an attendee) in a decade and a half.

Anyway, I digress. The VS Live! conference was hosted on the Microsoft campus in Redmond, but the speakers were mostly non-Microsoft peeps. There was a keynote presentation on two of the days from Microsoft peeps, both of which were delivered in a very professional manner, but (with a few notable exceptions) I was disappointed by the presentations. The presenters obviously knew the topic matter, but had not coordinated session content very well, or made sure that the infrastructure was setup (doing a demo on Cloud/Azure technology requires a properly configured internet connection) or even made sure that the presentation slides were in the order in which they wanted to present them. Even little things like closing unnecessary toolbars/windows in Visual Studio, or using an appropriate font to show code, impacts the perceived quality of a presentation.

For years, Bill Mooney has been telling PSG that he considers the SPC presentations amongst the best he seen. I always just put that down to his enthusiasm, but after this week I can see what he’s getting at. I know I’m far from the world’s best presenter, but after this week I’m starting to appreciate the level of professionalism with which we’ve been providing Synergy customers at our conferences over the years.

Last week, the PSG team met to go over the SPC 2010 conference content, and we all gave an overview of our planned sessions. Most of us were still in the planning stage of content development, but I had mostly completed my allotted sessions. So I thought I was pretty much done. But, as they say, no good deed goes unpunished, and I managed to get myself allocated a new 3 hour tutorial session to prepare.

The SPC this year promises to be another great conference with lots of hands on (and a reappearance of the CodePhantom), and I hope you will come see us in Sacramento.


Using Workbench to Build Applications on Remote Servers

By William Hawkins, Posted on February 18, 2010 at 4:21 pm

I recently went to a customer site, to help them integrate Workbench into their OpenVMS development environment.  As a source code editor, the “integration” is relatively simple, you just need to have NFS/CIFS/SAMBA installed, and use it to make your OpenVMS (or UNIX) drives look like they’re actually Windows drives.  However, when you want to compile or link your application, you either need to go back to your telnet window and build it there, or you can download the RemoteBuild utility from the SynergyDE CodeExchange.  There are two versions for OpenVMS out there right now, both provided by Chris Blundell from United Natural Foods Inc.

Synergex PSG decided that we wanted to provide a remote build facility that could talk to multiple environments using information from a single Workbench project.  We wanted to minimize any potential firewall issues (for companies that have internal firewalls), and we also wanted to build on the SynPSG.System classes (distributed with ChronoTrack – our SPC 2009 demonstration application) for the network communication.  For those of you unfamiliar with the SynPSG.System classes, they are a partial implementation of the Microsoft System classes written in Synergy, (so they work on all supported platforms,) but when we have Synergy for .Net available, we'll be able to use the native .NET framework System class without modifying code. (ok, we'll have to change the import statements, but that should be all.)

So PSG has posted our flavor of a remote building application into CodeExchange – it's called remoteServer.   There is a client component to install into Workbench, and a server component (written in Synergy) that runs on each development server.  If you have both SAMBA (or equivalent) and remoteServer installed and configured, you are able to compile your application on the remote system, and in the unlikely event of a compile error (I know, you never have any coding errors) you will be able to double click on the error on the output window, and go straight to that line of code in the source file on your remote server.

If you work in a multi-platform development environment, I would encourage you to go download any of the remote build offerings in CodeExchange, and start using the power of Workbench to help improve the productivity of your developers.


What’s in my library?

By William Hawkins, Posted on February 4, 2010 at 4:22 pm

The obvious answer that springs to mind is "books", but some may respond "what sort of library?".  Of course, in this context, I'm really referring to a library containing Synergy object code. 

When referring to Synergy subroutines and functions, on both Windows & Unix, you can perform a "listdbo" or "dblibr -t" on the object file/object library and peruse the output to see the names of your routines.  However, when referring to methods (in classes/namespaces), the name used is mangled.  This mangling process takes the fully qualified name of the method, the return type, and all the parameter types, and reduces it down to a mangled name.  In a lot of cases, you can look at the mangled name and stand a chance of actually recognizing the name of the routine, but decoding the parameters in your head may require the use of illegal drugs.

For example, if you see a mangled name of '7SYNPSG5CORE11UTILITIES3CC6SYNCC11GETCCNAME_O7SYSTEM7STRINGI', you could intuitively see that it's probably this routine: 'SYNPSG.CORE.UTILITIES.CC.SYNCC.GETCCNAME(I)@SYSTEM.STRING'. 

But what about this one: '7SYNPSG5CORE11UTILITIES3CC6SYNCC11GETCCNAME_O7SYSTEM7STRINGSP0P1P2P39CARDTYPE'?  It’s the "same" overloaded routine, but it has a SYNPSG.CORE.UTILITIES.CC.CARDTYPE parameter instead of an integer parameter.  Similarly, if you saw '7SYNPSG5CORE11UTILITIES8WORKING9SHOWFORM_XO7SYSTEM7STRING', you could probably see that it's 'SYNPSG.CORE.UTILITIES.WORKING.SHOWFORM(@SYSTEM.STRING)'.  Now, what if you saw this '7SYNPSGCR1UTLTESWRKNGSHW9HTGB13'?   Well, it's surprisingly the same SHOWFORM method, but it's been mangled beyond recognition.  The term used here at Synergex is "crushed".  In fact, if you have a crushed name, it's basically impossible to determine the original method name. If the mangled name of the method is too long for the environment, the mangled name is crushed down to the maximum size permissible.  OpenVMS has a limit of 31 characters, 64-bit systems have a 188 character limit, and 32-bit systems have a 200 character limit. Actually, the limit is one character less, because we use the rule that if the name is exactly the maximum size, it must be a crushed name.  As the last 7 characters of a crushed name is a checksum, on OpenVMS you’re only left with 24 characters for a human “readable” name.

So how, exactly, does a mangled name become a crushed name? Well, characters are removed, one by one, until the name is exactly the correct length. First non-alphanumeric characters are removed, then vowels, then letters from the name of your first born child, then random letters based on the cycle of the moon, until you eventually get a name that fits. So, with only 31 characters for method ames, the OpenVMS users out there will have to become accustomed to seeing crushed (i.e. indecipherable) method names inside Shared Image Libraries.  If you need to create an OpenVMS Shared image library, I would recommend creating an object library, and using the make_share.com file to convert to a shared image library.  However, you may need to review the use of the MATCH qualifier on your shared image libraries, as method names can change with the modification of a parameter (or return) type. So changing a method to (for example) have an additional optional parameter will cause a new method name to be created.  Unless you rebuild your application to see (and use) the new name, you could find that the application starts giving “routine not found” errors.

You might think that not knowing the name of the routine would be a problem – it's not really, because the compiler has a consistent supply of the same high quality drugs, and given a constant method signature, will always generate the same crushed name.  So it really doesn't care that that your code said  "object.showform(1)", because it'll know that you really want to call the method '7SYNPSGCR1UTLTESWRKNGSHW9HTGB13' from your library.

For most developers out there, the actual name of the method inside a library is unimportant, but I though the more curious of you out there would be interested in this.


Application Design Model

By William Hawkins, Posted on November 24, 2009 at 4:39 pm

During the past few years, the process of designing an application has gone through another revolution of terms.  When I started out in computing, data was in records and you wrote programs that have subroutines to perform repetitive tasks.  Then there was the short-lived  foray into 4GL’s,  More recently with the introduction of OO-based languages,  we had to learn about data in structures, instance objects, methods, enumerations and a whole host of new terms. At the same time, we got into client/server and N-tier application design.  Mostly, these were just variations on what we were already familiar with, although making the most out of the new terminology can require a new way of thinking.  In the past few years, the way you design applications has sort of been through another evolution.  I say “sort of” because what’s happened is that some new terms have entered common usage.  One of which is design patterns.  Design patterns are just what they say, a pattern that you use when designing an application.  They define/redefine some of the practices that we have been following for years.   Two design patterns I want to highlight are MVC and MVVM.

MVC is Model-View-Control.   This is where the Model (business logic & data) is separated from the View (what you see) and the Controller (dispatch logic).  The Controller monitors both the Model and View components, and acts as the communicator between these two components.  When you are using a well- designed UI Toolkit application, you’re probably using a MVC design.  If you have your real business logic abstracted away from the UI Logic (which UI Toolkit doesn’t really help you implement), you have the Controller logic separated from your View, which is part of the MVC pattern.  At a very simplistic level, the Synergy UI Toolkit List processor is the controller part of a MVC pattern, the load method is the Model and the list window is the View.  The UI Toolkit code is partially agnostic to the actual data being processed – you just pass it the data as a parameter and the forms processing inside UI Toolkit takes care of the rendering of the data on screen.   In a recent project, I created wrappers for the Synergy UI Toolkit logic in order to implement a formal MVC design, such that almost all of the logic required to drive the UI was abstracted into standard routines. So as far as the application developer was concerned, all they had to provide were the window scripts that defined the View, and the various business logic routines that were registered with the Controller.

MVVM is Model-View-ViewModel.  This is a variation of the MVC, where the controller is replaced by the ViewModel.   The ViewModel component instantiates instances of the Model component and it exposes public properties that the View component consumes. In a MVVM design, the Model is oblivious to the ViewModel and the View, and the ViewModel is oblivious to the View.  MVVM seems to be the design pattern of choice for WPF applications, and was used by Microsoft when they developed Expression Blend.  Because the View is separate to the ViewModel and Model components, it’s really easy to apply a new skin to an application that is implemented with this design.   Synergy applications have been moving in this direction since the release of xfNetLink/xfServerPlus, so it’s a natural evolution to consider this design practice when updating the UI of an application.

In addition to the two I mentioned there are other variations in application design patterns (e.g. MVP). In the course of reading up on the various application design models, I came across a reference to a blog by Josh Smith on The Code Project, where he states “If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions.” In a lot of cases, you’ll have an in-house design pattern that you’ve been using for years, but as you continue to develop your Synergy application, you should consider reassessing all the available design patterns to determine which pattern is the most appropriate for future-proofing your application.


Cloud and Sunlight at PDC09

By William Hawkins, Posted on November 18, 2009 at 4:26 pm

PDC09 is my first Microsoft conference, and I wasn't quite sure what to expect. Some excitement at seeing some of leading edge technologies being demonstrated by resident experts, Some trepidation at being presented with a huge variety of different technology and buzzwords.

The first session yesterday was a two hour keynote based around some of the non-UI technologies being presented – Windows Azure and Cloud. Today's keynote was based on the UI side of the equation – Silverlight and Sharepoint. There were some great demos from developers on how they had used Silverlight to develop new UI's that leverage the technology being provided, using web camera''s to import pictures directly from the device, playing video's and use multitouch to rearrange/resize on screen items. Part of the keynote discussed that Microsoft's employees don't really get involved in the hardware that is the platform for their great software, so they decided to get involved in the design of a PC. After a short discussion on the features of the PC, they announced that every PDC09 attendee was to get their own copy of the laptop. Imagine the reaction from 5000 attendees, when the clouds parted, and we realized that Microsoft was giving us a laptop to take home.

Of course, a cynical person would say that in order for Microsoft to get developers to write software for the Cloud and/or with Silverlight, they need the appropriate hardware, so a multitouch-enabled tablet PC with webcam is a great way to do this. Not to look a gift horse in the mouth, I'm trying out my new laptop in writing this blog 🙂 We had already started to discuss what Synergex PSG will have in stall for our conference attendees at SPC 2010, and the ability to run Synergy applications based upon multitouch applications, WCF & Silverlight have been topics of conversation. As laptops like this become more available, be prepared to leverage the hardware with your Synergy application.

The past two days have been a real eye opener for me, as I've seen the Microsoft technology that is coming down the pipe in the next few months. Of course the real trick for Synergex is to take this great technology and work out how it can be applied in the Synergy environment. While Microsoft only seem to see the "Cloud and Silverlight" in their future direction, I can see both Cloud and sunlight in the future for Synergy applications.


It’s a good time to clean up your old Synergy DBMS data

By William Hawkins, Posted on November 11, 2009 at 4:27 pm

Synergy/DE is a pretty forgiving environment when it comes to dealing with fields containing unexpected data. For example, you can have a d field that is either all spaces, all numbers, or some combination, and Synergy/DE will treat the spaces as zeros. (For those of you old enough to remember DBL version 2, back then you could even increment a decimal field that was all spaces, resulting in a field that was all spaces except for the last character which was a !, and DBL would still see the decimal field as a numeric 1. When that occurred, it made for some interesting debugging!)

Now that the world of Synergy/DE for .NET is imminent (a beta version is available for those who are interested), the issue of data interoperability and ensuring that C#/ VB.NET/Framework-language-of-choice can work with Synergy data is also moving to the forefront. For those of you who have been using xfODBC and/or SQL Connection, some of these issues may be familiar, but a lot of developers will foray into this arena for the first time with Synergy/DE for .NET. This is especially true for those of you using xfNetLink .NET edition and looking to bypass the xfNetLink layer and use your code directly from Synergy/DE for .NET. (xfNetLink shelters you from these issues, as it can coerce inappropriate data into a usable native form.)

Synergy/DE basically has three “native” data types: integer, alpha, and decimal. Here are some of the issues that you’ll need to think about for each:

· Synergy integer fields (not to be confused with System.Integer fields) – No issue here; you really cannot store inappropriate data in a Synergy integer field. All you really need to watch for is storing an integer field that is all spaces. Of course, this is still a valid integer; it’s just not the zero value that you may have expected.

· Synergy alpha fields – Non-printable characters (outside the 7-bit characters space thru tilde) really need to be processed as a byte array and not thought of as a string (or alpha) field. But for most situations, alpha fields are relatively problem-free.

· Synergy decimal fields – Here’s your main problem area. I think of Synergy decimals as a special form of Synergy alphas that only contain numeric data and that you can perform math functions on. So, you need to ensure that decimal fields only contain the characters 0 thru 9, with the last character optionally being p thru y (to deal with trailing over-punch data). It’s not uncommon for decimal fields to be all spaces or to have spaces inside the field instead of zeros. It really depends on your code and the last time that you wrote the data to the file. It’s not all that uncommon to have data that’s over 10 years old and hasn’t ever been updated.

Another common issue is that Synergy/DE allows a d8 date to have a value of 00000000. In most other languages, this is an invalid date. If you don’t have a date, other languages use null, not zero, to indicate this. When you move your d8 date field to a datetime field in .NET, you’ll need some conditional logic to cope with this. Your code may also deal with a date field that contains a value such as 20090230, and it will just ignore the fact that this a bad date and display 02/30/2009 (U.S. format) or 30/02/2009 (rest of the world). Try to do this in other languages and you could be in for an unpleasant surprise.

Hopefully, most of the reasons for having inappropriate data in your Synergy DBMS files have been addressed over time. However, you may still have residual data out there that is technically “bad” but is hidden due to the forgiving nature of Synergy/DE. In our experience, adding logic to the intermediate layer to check and fix the data as it’s being pushed to non-Synergy/DE systems can add significant overhead to the application. It’s much more efficient to fix the data (hopefully as a one-off exercise) and modify your application to stop adding bad data to the Synergy DBMS database. For example, commands such as the INIT statement can help ensure that decimals and integers contain correctly initialized data. There are probably a few of you out there who have cleared a Synergy record and then realized that an ISAM key contained a number that got stored as a space and not a zero, so that the key contained records that were “out of order.”

To help, we have added a utility to CodeExchange (fixdata.dbl) that will allow you to apply a Synergy Repository structure definition to a Synergy DBMS file, forcing fields to contain valid characters and (for example) date fields to contain valid dates. We will be extending the utility to include other features, such as validation logic based on Synergy Repository definitions, so that it will be able to detect when a field contains an “out of range” value. If you already expose or plan on exposing your data to .NET, xfODBC, or SQL Connection, I encourage you to download and run this utility. If you have any comments or suggestions on this utility, please email me at William.Hawkins@Synergex.com.


Don't miss a post!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts Tag Cloud Archives