Save Changed Views Automatically with SEQUEL Versioning

Posted on June 27, 2016

Have you ever made a change to an IBM i object and then wished you could undo the change like with PC objects? Have you added some test calculations and hit Save without remembering to make a copy of the SEQUEL View first? Or has a user ever called you to ask for a copy of a SEQUEL Report because the original was destroyed in an attempt to modify the results?

These are common mistakes many business and IBM i professionals encounter on a regular basis, but SEQUEL now gives you a built-in solution.

Starting in version 11 (R11M02), SEQUEL Versioning allows you to archive “versioned” copies of your SEQUEL Views, Reports, and Scripts automatically with minor setting changes. Versioning also works with output stream files, which are PC files on the Integrated Files System (IFS).

Setting Changes

When SEQUEL version 11 is installed, a library will be created named SEQUELREPO. This library will be used as the default repository library to hold the versioned copies of your views, reports, and scripts. You can create your own library and change the user defaults to use that library name. There will also be a corresponding directory on the IFS with the same name (/sequel/History/SEQUELREPO). You can also make your directory:

MKDIR ‘/SEQUEL/HISTORY/XXXXX’ (where XXXXX is the Repository Library name)  

This is the folder where copies of stream files will be kept.

The other place in SEQUEL you would need to change is the user defaults. This can be done with the SETDFT command or ViewPoint Administrator. There are two methods to implement versioning—Implied and Explicit—and these settings are described below.

Implied Versioning

The user’s SEQUEL defaults can be changed to set the Repository Replace Action to *VER. A setting of *VER means when this user changes and saves a view, table, or script, a copy of the original will be placed in whichever library is specified in the Repository Library setting. 

 

Image

Use ViewPoint Administrator to set defaults.

The first archived copy of a definition will have the same name. Subsequent copies will be assigned names made up of the first six characters of the original name and a four digit number (0001 to 9999). For example, a copy of a customer list would look like this: CUSTLI0001. 

 

Image

This list includes two archived copies of the same Script.

Because of the way versioned objects are created, you are limited to 9999 versions per object. Implied versioning does not apply when creating stream files from ViewPoint.

Explicit Versioning

Explicit versioning refers to SEQUEL commands that use the REPLACE parameter. A new value is now allowed for this parameter: *VER. You can also use the value *DFT and have the user’s SEQUEL Default set to *VER. For SEQUEL ViewPoint objects, the commands for create views (CRTVIEW) and create scripts (CRTSCRIPT) can use the new replace value. For PC files on the IFS, the commands EXECUTE, EXECUTEVPT, REPORT, and REPORTVPT can be set to use versioning.

 

Image

Set the REPLACE parameter to *VER.

The Execute command then might look like this:

SEQUEL/EXECUTE VIEW(SEQUELEX/CUSTLIST) TOSTMF(‘/TMP/CUSTLIST.TXT’) REPLACE(*VER)

Versioned Copies

Whether you choose to use the default library and IFS folder name, SEQUELREPO, or create your own, these locations will contain the copies of the views, reports, scripts, and stream files. You can easily use ViewPoint Explorer to navigate the repository library and explore its contents. Or from a command line, you can enter: WRKSEQUEL OBJ(xxx/*ALL), where xxx is the library name—SEQUELREPO, for example.

Also, a SEQUEL file called SQVRSNUS contains information or audits of what and when an object was versioned. This includes the view, report, and script, as well as the stream file on the IFS. You can use the SEQUEL Display command to see the contents of the file:

DISPLAY SQL(‘SELECT * FROM SEQUEL/SQVRSNUS’)

Or you can use ViewPoint to see the files entries.

 

Image

Use ViewPoint to see when an object was versioned.

Summary

With an install or upgrade to SEQUEL 11, you’ll be able to save copies of your changed views, reports, scripts, and stream files. You can use the default library and IFS folder or create your own. Where appropriate, you can change your design user defaults and/or the commands used to create stream files on the IFS to take advantage of versioning. You can also view an audit file on IBM i for more information on what was versioned and when.

 

Image

At-a-glance guide to implementing Versioning.

Versioning gives you a safety net. You no longer need to worry about making mistakes when changing SEQUEL objects and wasting time trying to fix them. This built-in solution can help you and everyone else on your team work more efficiently. To find out about the other new features in SEQUEL 11, check out the release notes.