Open Menu

Synergex Blog

Mr Numpty’s hair stood on end. It must be the static!

By Richard Morris, Posted on August 26, 2010 at 8:09 am

One fine day (well, it was raining – it is the UK after all), not too long ago (yesterday), there was a man called Mr Numpty (names changed to protect the innocent).  Mr Numpty was a seasoned Synergy developer and wrote Toolkit applications in his sleep (amazing what Workbench can do for you these days).

This one day, Mr Numpty was browsing the web site for the early bird registration form when suddenly his big red support phone rang.  It has a unique ring tone and a strange light appears in the sky, which can be easily seen on the lovely grey storm clouds forming outside his window.  Mr Numpty says to himself “this must be very important” and reaches for his cloak.  Picking up the phone, a rather bemused voice, which he recognises immediately as his uncle, ‘Uncle Joe’, says;

“Numpty my man, things they be strange. My list is looking great, but my data’s in a rage.”

“Is it the new product browser?” asks Mr Numpty.

Uncle Joe replied;

“It is indeed, that’s the one.  ‘Been using it all day, ‘cos it’s so much fun.  The windows are great, and the tabs are a hit.  But when I print, the results are not that great!”

“OK Uncle Joe I’ll take a look” replied Mr Numpty.  He looked through the code but could not see any errors.  He ran the program, and clicked on the tab.  Uncle Joe was right.  The list looked great with all the right data.  Printing from here worked also and the results were fine.  Confused, Mr Numpty pondered and scratched his head.  He scratched so hard his hair stood on its end. From the corner of his eye he caught sight of himself in the mirror.  Wow he thought. My head looks funny. I must be fully charged with static!

Ping!  Suddenly he remembered a dim and distant UI Toolkit training course, and the voice of a PSG consultant began to haunt him… “Remember the golden rule: The list processor first updates the current non-window data area, processes the request, then returns the current non-window data!”  So something must be corrupting my non-window data, but only sometimes. 

Taking a closer look at his list routine he noticed his problem.  The data being passed to the list processor was defined as ‘stack’.  This means that each time the routine is called the data area is created, and the contents undefined.  Calling the routine for the first time creates the list, which is correctly loaded from the load method.  By clicking on other tabs means we leave the list routine.  Clicking back on the tab containing the list causes the list record area, defined as stack data, to be created with the contents undefined.  When this is then passed to the list processor the non-window data will be updated with this undefined data.  Visually, everything will look fine, but the data used by the program will be corrupted.

Taking inspiration from his static hair style, Mr Numpty changes the record declaration to ‘static’ and his program now fully works.  He updates Uncle Joe’s computer.

“Numpty my man, it all looks swell.  Now can we filter and sort the columns as well?”

Mr Numpty thought for a moment, “I’m not sure how to do that, but it sounds like a great idea.  Now where was I?”  Mr Numpty continues to complete the early bird application form, wondering if this year’s conference will give him the knowledge to give his uncle the features he wants.

Blunt Pencil?

By Richard Morris, Posted on August 2, 2010 at 10:22 am

I guess all jobs have their perks. This week visiting the office in California, in July, is certainly one of mine. OK, so being stuck in an air conditioned office all week is not exactly lapping up the sunshine, but today is Saturday and I’ve been loaned a bike!  Now, when I say bike, let me explain. It’s kind of like a laid back Harley Davidson Fat Boy with thick tires, wide handle bars and a thick padded seat. That’s where the resemblance with a Harley ends I’m afraid. There is no chrome laden chassis, or thumping V-twin engine, just two pedals, powered by my spindly and pale English legs! It’s certainly no wheelie machine either. Actually it’s quite a cool ride, just totally out of place against all the racing style cycles I found myself among while cycling along the great American River towards Folsom Dam. But I mind not. Those spandex and lycra clad enthusiasts take it far too seriously! I was simply out for a great ride through some stunning scenery.  

So, MP3 player blasting in my ears I boldly set off on my adventure. I made sure it was only the guys on the ultrafast slick racing bikes that overtook me, but the trouble was, everyone seemed to be on a slick racing bike, honest! I still can’t explain how the walkers got past me though. I’m sure they were taking short cuts!

Undaunted, I pedelled on. Some of the downhill sections of the cycle track may well have been enjoyed at slightly more than the 15 mph speed limit – no, not me officer! Some of the rather tight corners were taken pedal down (similar concept as knee down, just at a more sedate pace). Big smiles all round.

And then the inspiration came to me! My MP3 player has a very varied collection of tunes from many different decades and genres. I regularly add new CD’s to see if I like what I hear. One new song had a lyric from which my inspiration was born. “Like a pencil, old and blunt, I’m writing in a bolder font”. I thought, "ya, how true!".  There is nothing worse than trying to be artistic with an old blunt pencil that smudges as you scribe. So, is this what I’m trying to do with Toolkit? Recent posts on Synergy-L continue to highlight the challenges we all have with fonts and colours, trying to make our applications look cool, modern and saleable.

So maybe it’s time to sharpen our pencils, utilise the new capabilities in Synergy 9, and begin to incorporate new slick UI’s into our existing applications. This is my focus for SPC2010 in October. I’ll present the tools and techniques we can all use to implement new, modern interfaces within our existing and proven Synergy applications.

My adventure is over now and I’m back in the office. Now, where is my pencil sharpener?  It’s time to give ChronoTrack a new lick of paint.

Not convinced? Then why not rise to this challenge…  Send me all the code and data required to build and run a sample element of your application and, in return, as long as you’re at the conference, I’ll demonstrate your same code running with a modern UI. And did I mention that it doesn’t have to be a toolkit application?

Glossary of terms. Wheelie: The act of raising the front wheel of your bike, in a controlled manner, while propelling your bike forward at high speed. In my case: always unintentional and usually with painful and expensive results! Knee down: The art of skimming your knee close to the tarmac while engaging a perfectly executed cornering manoeuvre. In my case: falling off!

On The Conference Trail

By Richard Morris, Posted on March 28, 2010 at 9:45 pm

Can you believe it is four months since I posted my first blog from Microsoft TechED in Berlin?  Time certainly does fly by, and so does the changing world of software development.  At Synergex we are committed to ensuring that we keep abreast of advancing technologies, so that we can continue providing expert advice and direction to Synergy/DE developers. 

This week I’m in London, and for the start of the week I can actually say “sunny” London.  Considering the weather we have been having here recently, I can honestly say spring may just be on its way!  I’m in London attending DevWeek 2010.  A software developer’s conference sponsored by, but not presented by, Microsoft.  I say that to emphasise that this is not another TechED.  This conference focuses more on the people using the tools and technologies, the real people like you and me, and not just the products on offer.

DevWeek 2010 is a lot smaller, in attendee numbers, than the TechED conference.  There are hundreds of people here, not thousands.  It’s a lot more personal, and you get much more opportunity to “discuss” (read “ague my case”) with the presenters.  The first session I attended on Monday morning had twelve people in the room, so it’s a lot more intimate.  The content, however, is far from small scale, with some impressive solutions to today’s application requirements.

Monday was a pre-conference day and I spent it delving deep into Silverlight, Microsoft’s XAML/WPF based Web development and application deployment environment.  You can achieve many cool things very easily with just a line or two of code.  Did you know, using Silverlight, it’s possible to deploy your application to appear to run natively on an Apple MAC?

One thing this conference has again emphasised to me is the abstract between software development and design.  And by design I mean the user interface.  All us programmers believe we can “cut it” when it comes to UI development, and many of us can do a reasonable job.  But put today’s design tools into the hands of the UI designers and it’s amazing what they can produce.  And the ease at which you can then implement their “styles” into you application is astonishing!  My first “hello world” foray into UI design was to produce a form with a round ball like object on it, and of course the customary “Press Me” button.  Pressing the button caused the ball to drop from the top of the window to the bottom, and then bounce a couple of times before coming to a rest.  Using Microsoft’s Expression Blend made it far too easy.  It really is a simple case of draw the object (my ball), define the result (ball at bottom of window) and pick a transition (how it gets from top to bottom).  Add my button, and a couple of clicks later, it really does look like the ball is naturally falling (starts slow and speeds up) and then bounces a little as it comes to its final resting place.  And I have not written a single line of code!

OK, So I can hear you thinking “and the use of a bouncing ball is?”  Good question.  Not much, I agree, but the techniques can easily add such a visual edge to you application.  Consider if you created a button style, which you could apply, as a default, to all buttons within your application.  The style could, for example, make the button double in size, including the text, when you hover over it with the mouse, making it easier to read.  Maybe have a circular ripple effect when you press it.  What if the input control (field) on your form that had focus is automatically magnified, giving the user a clearer view of what’s being asked for, without obscuring other areas of the form.   Your options are endless, and from a software developers standpoint – no code changes.  The code to data bind you fields to your Synergy data remains the same, but the look can be infinitely customisable.

Ensuring we structure our UI design correctly, data bind our controls in the XAML and avoid all non-UI related code behind ensures that we can utilise these UI development tools to the full.  We’ll be presenting these cool techniques at this year’s SPC in October, so make sure you’ve booked your place!

How Did I Get Here?

By Richard Morris, Posted on March 22, 2010 at 9:41 pm

Well, that was the DevWeek that was.  As I mentioned in my last blog, it’s been my first time here, and it’s been a very informative and interesting conference.  Will I attend next year?  I’d like to think so.  But that decision is not mine to be made.  As many of you reading this know, it’s “Manny” who makes the decisions.

So how does he (or she for that matter – I too had a lady boss once) go about making such a decision?  Is it a case of “If I mention it enough, I’ll get to go?”  I’m not sure that one works, and it’s certainly not going to be too reliable!  I could try the tact of “if I request to go to everything I must get to go to something”, but information overload just takes up too much of your managers time.  My boss certainly doesn’t search the web and peruse the small ad’s looking for events to send me on, far from it!  He’s got much better things to do, like figuring out just how he can squeeze my two new, 23 inch, flat panel, high resolution, wide screen monitors that I’ve just ordered, into this month’s budget.

But I need to ensure I keep up to date with modern technologies and techniques.  Reading web articles, blogs and industry publications helps, and one of the biggest benefits of my job is working with such a diverse user base – you all have different and unique requirements, but can apply very similar solutions using Synergy and all its related capabilities.

So, my boss relies on me to investigate and review all the available options.  I must admit, although Synergex has a single office in California, it certainly has a global attitude to training and employee development – I’ve been to conference and training events in the US, and across Europe.

The factors which influence my decisions as to which conference or training event to attend come directly from the requirements from our user base, and the direction in which Synergy/DE is going.  There is little point it being an expert in a technology that is of little or no use to our users.

I learnt a lot this week, both by attending some really good sessions, and also by talking to presenters and other attendees.  My background is significantly different from many (ok all!) of the people I spoke to.  They live, breath and sleep Microsoft and .NET.  I don’t, but need to understand how best we can encapsulate these new technologies within Synergy/DE applications.

Now, what are your justifications for attending this year’s SPC in October?  Firstly, as soon as the agenda is published, review it and ask yourself “what in the agenda will help me to advance my application?” I bet you can find at least ten things.  If your application runs on Windows and you plan on sprucing up your UI, there are a number of sessions that will walk you through the process of implementing the latest super slick WPF interface.  And remember, all source code will be made available on Code Exchange.  Not running on Windows?  It’s lucky you have Synergy/DE then!  Many of this year’s sessions focus on non-Windows environments, and the latest OO capabilities within the language.  Beginning to implement simple OO practices within your application will greatly improve the quality of your code, and the speed at which you can develop it.  And it’s not difficult to get started using synergy OO concepts, and it can integrate seamlessly with your existing procedural code!

How many of you UNIX and OpenVMS developers have a PC on your desk, and use a telnet terminal emulator to edit and build your code?  You’ve seen Workbench, know just how powerful a development environment it is, so why not swap the emulator for Workbench? We’re developing a session that will show you just how easy it is to edit then remote build your source code from within Workbench.

Arm yourself with the facts.  Talk to “Manny”, and book your ticket to this year’s SPC!

One of the justifications I have for attending these conferences is that I can impart my new found knowledge and understating, through the SPC, to our customers – you!

To Print or not To Print

By Richard Morris, Posted on February 12, 2010 at 10:10 pm

The Synergy Windows Printing API is a collection of routines that allow you to fully control printing on the Windows platform, and make use of extended printer features.  The API records the print information in a Windows enhanced metafile which can then be played back to devices such as a printer or the print preview window.

Many of you will be using this API to bring true Windows printing capabilities to you applications. So, when you upgraded to version 9.3 of Synergy and rebuilt your applications, where did your prints disappear to?  You may have been caught out by a new feature added to the API.  In version 9.3 two new integer fields were introduced to the font specifications structure to enable you to change the orientation and escapement of the font.  The orientation allows you to specify the angle between the baseline of a character and the page’s horizontal axis.  The escapement specifies the angle between the baseline of a string of text and the page’s horizontal axis.  For full details see the version 9.3 on-line manuals.  The default value for both of these two new fields is zero, meaning that no rotation of the text will occur.

To set the required font characteristics you use the DWP_FONT sub-function of the WPR_SETDEVICE() function.  The font characteristics are defined within a structure called “font_specs”, included in the DBLDIR:winprint.def header file.  This structure is used to allocate memory to store the font specifications, and provide them to the %WPR_SETDEVICE() function.  You allocate the required memory using the %MEM_PROC() function, for example;

    fontHandle = %mem_proc(DM_ALLOC+DM_STATIC, ^size(font_specs))

You can then set the required font details;

    ^m(font_specs.face_name, fontHandle) = “Courier”

However, if you don’t specify values for all of the fields defined within the “font_specs” structure, the values will be undefined, and for the integer fields, most likely be non-zero.  So, the two new fields will actually contain values, and so orientation and escapement settings will be passed to the %WPR_SETDEVICE() function.  Things will no longer print as you expect!

One way to ensure that the integer data is initialised when you allocate dynamic memory is to use the DM_NULL qualifier.  This ensures that any integer data is initialised correctly.  For example;

    fontHandle = %mem_proc(DM_ALLOC+DM_STATIC+DM_NULL, ^size(font_specs))

However, this does not correctly initialise any non-integer data, and is not future-proof.  If the structure is modified to include new alpha/decimal/implied decimal fields in the future, these fields would then contain incorrect values.  An alternative is to initialise a local copy of the font specifications structure and then assign that to the allocated dynamic memory.  The INIT statement ensures that fields within a record or structure are initialised correctly based on the field type.  Firstly, create a structfield, which is a field defined as a structure type.

.ifdef DBLV9


    tmpFont    ,font_specs



The code to allocate the memory for the font specification remains the same;

    fontHandle = %mem_proc(DM_ALLOC+DM_STATIC+DM_NULL, ^size(font_specs))

Now we use the structfield to correctly initialise the dynamic memory;

.ifdev DBLV9

init tmpFont    ;ensures individual fields correctly initialised

^m(font_specs, fontHandle) = tmpFont


This same coding structure can be applied to the other structure specifications defined in the DBLDIR:winprint.def header file.  The code is backward compatible with earlier versions of Synergy, and will prevent any similar issues in the future.

Alternatively, from version 9.1 you can remove the need to allocate memory, and simply use the structfield.  For example;


    textFont    ,font_specs


And then use the structfield to define font characteristics;

    init textFont    ;ensures individual fields are correctly initialised

    textFont.facename = “Courier”

    textFont.weight = 700

    wpr_setdevice(rptHandle, DWP_FONT, textFont)

    wpr_pint(rptHandle, DWP_WRITEOUT, x, y, “Hello Bloggers!”)

This second approach has two advantages.  Firstly, you no longer need to allocate and clean up any dynamic memory.  The second is that you get full intellisense within workbench, listing the available fields within the font structfield.

Picture This!

By Richard Morris, Posted on January 28, 2010 at 11:29 pm

In days of old, carrying your trusted, heavy weight camera around your neck, you’d take the perfect snap.  You’d then continue snapping away until the film was full, which, for the impatient among us, meant taking a large number of “I was just finishing off the film darling” type shots. On returning home you’d quickly rewind the film back into its cartridge, unless you had one of those fancy modern “advanced” film cameras of course, where the camera did it for you, and then pop it into your “postage free” envelope.  And off you sent it, in the hope that your “once in a life time” shot would be processed and returned to you post haste.

And what of the results?  Normally a hazy, slightly out of focus, batch of glossy pictures that really don’t give your artistic prowess justice.  After all, the subject must have moved because you’d never intentionally crop the top of the head of the bride, just above the eye line, and why was the gentleman third from the right picking his nose?

If this sounds like your photography experiences, the chances are if you live in the UK the people processing your film were a company called Harrier L L C.  You may know them better as “TRUPRINT”.  At their peak they were processing 85,000 rolls of film per day!  Today, however, they are processing no more than 1,000 films.  Not really a great statistic if film processing is your business.  But Harrier saw the potential of the digital world and has embraced the processing of the digital image.  Today they average over 200,000 prints a day, which can rise to over 1,000,000 prints at times like Christmas.  However, although this figure is significantly lower than the prints they were processing in the heyday of film, it’s now a very small part of their product portfolio.  The key to success was to diversify.  Today, in this digital age, people want more than just a glossy print of their blurred, half-cropped pictures.  They want the t-shirt, a coffee mug and of course the family calendar, all donned with their own artistic compositions.  Today, with a few clicks of a mouse you can upload your pictures and have them delivered to your door on anything from coffee mugs, placemats to a full size framed canvases.  You can even have your prized picture delivered to you in lots of tiny pieces – in the form of a jigsaw!

So where does Synergy fit into their IT strategy?  Their OpenVMS based Synergy /DE applications manage the order processing and management of every item they process.  Once an order is accepted through the many portals including a host of web sites, major supermarket chains, leading pharmacies, and of course by post, the Synergy application takes control.  It manages the processing or the required prints, storybooks or mugs (to name but a few product lines – they have over 500) through to despatch and successful delivery to the customer.  The Synergex Professional Services Group is assisting Harrier to evaluate to work needed to migrate their Synergy/DE applications from the OpenVMS platform to Microsoft Windows.

Testing Times

By Richard Morris, Posted on November 30, 2009 at 11:35 pm

Today, I am a Net Ninja!  Well that’s what my freebie t-shirt, procured from TechEd, says I am :).

To be honest I’m not sure what a Net Ninja is, but my understanding of a “Ninja” is a warrior, a fighter.  Someone who battles against adversity is pursuit of perfection.  Well, I feel a little like that at the moment.  Battle scared and bruised.  Not in the physical sense you understand.  I’ve been on beta testing duties, which brings both frustration and joy in equal amounts.

We currently have two products out in beta test at the moment.  The 9.3 beta contains some really cool new features, including encryption and a new “select” class.  The data encryption allows you to store your data in your SDBMS/RMS files in a form that can’t be read, even if you unload (or for you VMS guys – edit!) your files.  You can also encrypt your data between client and server for both xfServer and xfServerPlus.  The latter two ensure that any data you are transferring between server and client is “un-sniff-able!” 

Encryption is becoming more and more important in today’s world, and the ability to simply “switch on” encryption within your client/server Synergy applications is a really powerful capability.  I was stung earlier this year by identity theft.  I’d ordered a product off a web site, secure from the outside world because I ensured it was all done over HTTPS!  Suddenly I noticed credit card transactions that I didn’t know about – first port of call, my wife!  She knew nothing of the transactions and after some investigations I figured the only way my information could have been got at was from within the company – their employees!  Version 9.3 offers you the ability to encrypt your data at field, record, routine (xfServerPlus) or file level.  It’s extremely flexible.  When 9.3 is released ChronoTrack has been updated to provide examples of using encryption, and we’ll post it onto code exchange at the same time.

The “select” class is a cool and mega efficient, especially over xfServer, way of selecting data from a file that matches your selection criteria – your where clause!  I think Tod is preparing a blog about this as we speak :).

The other area of testing I’ve been doing is with our beta version of Synergy for .NET (not sure of the official title yet :)).  It was released last month.  This is really where the pain and ecstasy belong.  It’s such a cool product.  Being able to build applications in Visual Studio and have all the code in Synergy is very reassuring.  And my testing bed?  You guessed it, ChronoTrack!  It’s taken a lot of effort (the pain) to get to a point where ChronoTrack will build and run (the ecstasy) in the .NET framework, but we got there last week!  Our development team has worked tirelessly to build a product that’s going to allow our users to take full advantage of the .NET environment.  And what, I hear you ask, are the changes to the existing Synergy Code?  Well, to be honest, if the code didn’t interact with the UI then I changed no code.  I had to comment out a few references to statements (line INIT) that are not quite supported yet, but other than that the code remains the same.  It really is an endorsement of Synergy that we can build code that could have been written twenty years ago and run it in the latest and greatest environments without change.

If you want to beta test either version 9.3 or our .NET products then please sign-up and sharpen your blade.  It can be tuff, but the rewards are worth it.  And you do get ROI – you’ll have coded all your routines to support encryption and the select class before we even release the product, meaning you will be ready to take full advantage when the product is official!

If you are interested in seeing ChronoTrack running under Synergy for .NET then please let me know.  I may even produce a video about it!

I’m not sure I have made the grade as a “Ninja”, but my testing duties are complete.  I’m out and about visiting customers in the UK and Ireland this week with Nigel David.  If we encounter anything note worthy then I’ll keep you posted.

Wave Goodbye to the MDU

By Steve Ives, Posted on November 12, 2009 at 5:41 pm

If you have ever developed with xfServerPlus and xfNetLink then, like me, you may have a “love-hate” relationship with the Method Definition Utility (MDU). You love it because it is an enabling technology … it is one step in the process of extending your Synergy applications with all types of cool client applications. But at the same time you hate it … because it’s an inconvenience to have to remember to run up the utility and update the method catalog each time you want to add a new method, or change the interface of an existing one. Today, using the MDU is a “necessary evil”. It has served us well over the years, but things are about to get a whole lot better.

Synergy/DE 9 introduced many new features to the language, and some of these new features could make entering information into the MDU kind of redundant. For example, rather than declaring a routine like this:

function get_product, ^val
  arg1 ,a ;Product code (passed in, a10)
  arg2 ,a ;Product record (returned, product record)

Synergy 9 allows us to define the routine like this:

function get_product, boolean
  required in productCode ,a10
  required out productRecord ,sProduct


As you can see, we can now specify much more information about the external interface of a routine actually in the source code … and this additional information is the same as the information that we specify when defining the routine in the MDU. But in 9.1 the picture wasn’t complete. There is still information that xfServerPlus (and tools like GENXML and GENCS) require from the method catalog, for which there is no language syntax to allow that information to be expressed in the actual code. For example, at a minimum we need to specify the name of the “interface” that the routine (method) will belong to, and the name of the library in which the routine in located.

Enter Synergy/DE 9.3, and an array of new features. One of those features is the introduction of support for “attributes”. Attributes are a mechanism which allows a programmer to “decorate” source code with additional information, or metadata, which provides information about the code. The metadata can then be used by compilers, or other tools that may process the source code in order to extract information, or take some other action.

We’re likely to see many and varied uses for attributes in Synergy/DE for .NET, but for now, as well as adding support for attributes in the language, 9.3 introduces the first use of attributes for Synergy/DE xfServerPlus developers. Attributes can be used to provide all of the remaining information needed to automatically populate the method catalog!

Here’s the same function that we looked at earlier, but with an attribute added:

function get_product, boolean
  required in productCode ,a10
  required out productRecord ,sProduct

By the way, this is a simple example. There are many properties that can be specified in the xfMethod attribute, and there is also an xfParameter attribute which allows you to provide information about the routines parameters.

It’s also possible to specify “documentation comments” within source code, and these comments can be used to populate the method, parameter and return value description fields in the method catalog. A routine with documentation comments would look something like this:

;;;<summary>Retrieves a product record.</summary>
;;;<returns>Returns true for success or false for failure.</returns>
;;;<param name="productCode">SKU of product to retrieve</param>
;;;<param name="productRecord">Returned product record</param>
function get_product, boolean
  required in productCode ,a10
  required out productRecord ,sProduct

Once you have “decorated” your code with attributes and doc comments, it is possible that you may never have to interact with the MDU ever again! But wait a minute … how does all this work?

Well, there is a new utility called dbl2xml, and this utility reads all of the information that is now contained in your source code and it creates an XML file containing just that information. You can then load that XML file into the method catalog using a command-line invocation of the MDU program. Of course you’ll probably automate these steps in the script that you already use to build your methods. The additional steps you’ll need will look something like this:

dbl2xml -out XFPL_SMCPATH:smc.xml SRC:AllMyMethods.dbl
dbr DBLDIR:mdu -i XFPL_SMCPATH:smc.xml

There is one “gotcha” with this new approach, and that is that you have to use the dbl2xml utility one time and process ALL of the code for all of the routines that are to be included in your method catalog. They don’t all have to be in the same source file, but the dbl2xml utility needs to process them all at once so that it can create the entire method catalog in a single pass. But that shouldn’t be a problem.

If you’ve ever done xfServerPlus development then I’m sure you’ll agree with me that this is a very nice new feature in Synergy/DE 9.3 … and it’s just one of many.

By the way 9.3 has been in beta for a while now. So if you want to check out the new features early, then why not help us to validate the release? Head on over to, log in to the Resource Center, and download the beta today.

New select classes are a home run

By synergexadmin, Posted on September 23, 2009 at 4:18 pm

Early last week, I was given a copy of the beta build of Synergy/DE 9.3.  My task was to do some testing of one the exciting new features it includes: The Select classes.

Now, testing isn’t always fun, and it can be frustrating trying to figure out if a bug is really a bug, or just a problem born of having no clue what I’m doing.  This time, however, any minor problems I encountered were completely overshadowed by the sheer awesomeness of the new classes.

The Select classes provide a SQL-like syntax for communicating with Synergy databases, and it’s amazing just how simple they are to use.  Once I had a basic understanding of how they worked, I was able to compress a simple READS loop – complete with “filters” and error checking – into a single line.

Consider the following code, which loops through active customer records and prints out the customer number, name and last sales date of anyone with no sales for more than a year:

        reads(ch_cusmas,cusmas)  [err = eof]     if (cusmas.status .ne. ‘A’); If customer is not Active, ignore it
        if (cusmas.last_sale.year < lastYear)
        call printLine
eof,    etc…

The basic syntax and usage of the Select Class is:

    foreach myRecord in @Select(@From[, @Where][, @OrderBy])

And so, using the Select classes, I condensed everything into:

customers = new From(ch_cusmas,cusmas)
noNewSales = new Select(customers,(where)status.eq.’A’ .and. last_sale.year < lastYear)
foreach cusmas in noNewSales
    call printLine

(I actually condensed the first three lines into just one foreach statement, but the result is a line of code that doesn’t fit nicely into a blog entry, and therefore becomes more difficult to read.)

The syntax is neat, but it’s not the best part; the really cool stuff is happening under the hood.  The actual database I/O layer is now handling all of the “filter” logic, and it’s doing it faster than a regular READS loop can handle.  In fact, during my tests, a filtered return of around 18,375 records showed a performance benefit that ranged from 11 to 21 percent.  Now, that’s a small data set and we’re only talking about milliseconds, but it demonstrates a performance boost nevertheless – and that’s for a local application, running against a local database.  The savings over a network connection to a remote database (i.e., xfServer) is likely to be enormous, as the I/O layer on the server is now doing the filtering, rather than returning the data to the client to handle.

Other features include the OrderBy class, which (as expected) sorts the returned data in either ascending or descending order based on the key being read.  The classes also provide for a sparse record population, in which only the fields needed by the application are actually returned.  There are even methods available to get at each individual record returned in the set, write back to the file, etc.

The fact that an update to Synergy/DE 9.3 is all that’s required is impressive as well.  There’s no need to perform any database conversions, or add additional services or products; the Select classes work right out of the box.

The Select classes represent a significant addition to the language, and I can imagine a time in the not-too-distant future when they become the primary Synergy database access mechanism.  My hat’s off to the Synergex development team; it appears that they’ve hit this one out of the park.


Subscribe to the RSS Feed!

Recent Posts Categories Tag Cloud Archives