Working with Group Versions

These topics provide an overview of version numbers and discuss how to work with versions (for developers).

Each time you build a group, the system generates a version number and stores it in the Group Result Table. The system creates a new version number and updates the result table if any of the following have changed since the last time you executed the group:

  • The group definition.

  • The query definition.

  • Any parameters that you used to generate the group; for example, if you used effective-dated job data.

Before reading this topic, see "Building Applications or Batch Programs That Include Group Build Functions".

You can implement Group Build in an application by:

  • Using the default developer query.

    The default developer query works with the default Group Result Table.

  • Creating your own query.

    If you use your own query, you can define more parameters and/or more fields in a personal Group Results Table.

However, you can use your own Group Results Table with the default developer query or use the default Group Results Table with your own query, as long as the fields selected by the query match the default Group Results Table structure.

This means that the system regenerates the group and changes the version number if either of the following changed since the last time you executed this group:

  • The query definition that was added by the developer.

  • The Group Results Table.

Note: You can bypass the versioning mechanism by calling GB_EXEC("Y"). Then the group is generated each time it is called.

Note: When using Developer Query or User Query, keep in mind that GB_QRY_LINK_VIEW is based on the JOB record. When Group Build generates the SQL, the system replaces all references to GB_QRY_LINK_VIEW with JOB. If, after this is done, the left REC.FIELD is the same as the right REC.FIELD, Group Build will not process the line in the SQL generation.

For example, if you have the criteria GB_QRY_LINK_VIEW.EFFDT <= JOB.EFFDT in Query, Group Build will replace it with JOB.EFFDT <= JOB.EFFDT. The system will then remove the line because the left REC.FIELD is the same as the right REC.FIELD. As a result, the Query count may differ from the one returned by Group Build.