Computer Corporation of America
|
Feedback
Search CCA:
   
USA CCA
CCA Products
CCA Customer Support
CCA Resources
CCA - Company
CCAPRINT: A Newsletter for Model 204® and System 1032® Users
December 10, 2005
     
Model 204: Playing It Safe--Parallel Streams for CHKPOINT and CCAJRNL Printer-friendly version
System 1032: Forms Feature, Part 2 Printer-friendly version

Model 204
USE OF AND ACCESS TO PRODUCTS AND FEATURES ARE IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE USER’S SOFTWARE LICENSE. THE PRESENTATION OF MATERIAL HEREIN DOES NOT, IN ANY MANNER, MODIFY SUCH TERMS AND CONDITIONS.

Playing It Safe--Parallel Streams for CHKPOINT and CCAJRNL
By James Damon



The CHKPOINT and CCAJRNL datasets are the two most critical datasets in a Model 204 production online. They provide for complete recovery of the entire database environment in the event of a power failure, system crash or other event that abruptly terminates Model 204.

Media failures can also bring down a system. If the media where either of these datasets resides experiences a failure, then roll back, roll forward recovery is impossible. Your next recovery option is the more time consuming process of file-by-file reorganization. But that can leave files logically inconsistent, if incomplete transactions are reapplied. Regenerating files using the REGENERATE command is also possible, if CCAJRNL remains intact—another time consuming process.

Introducing Parallel Streams
So, how can the integrity of CHKPOINT and CCAJRNL be guaranteed for roll back, roll forward recovery in the event of a media failure? The answer is parallel streams. While this is not a 100% guarantee, it substantially reduces the probability of losing either dataset. Parallel streams in Model 204 provide a dual-copy feature. Whenever a block is written to a parallel stream, it is written concurrently to all members or datasets defined to that stream. There is no inherent performance penalty--the write to the stream is considered complete when all writes complete. This means that the write completion time for the stream is the longest time for any single I/O to complete. On current devices that is usually 2-4 milliseconds.

Defining PARALLEL Streams
You can define both CHKPOINT and CCAJRNL as parallel streams in CCAIN prior to defining any parameters. Figure 1 illustrates how this might be done for CHKPOINT.

Figure 1. Defining CHKPOINT as a parallel stream

//CCAIN DD *
DEFINE STREAM CHKPOINT WITH SCOPE=SYSTEM –
PARALLEL=(CHK1,CHK2) MINAVAIL=1
DEFINE DATASET CHK1 WITH SCOPE=SYSTEM –
OLD SEQUENTIAL DSN=CCA.CHKPOINT.CHK1 VOLUME=DISK01
DEFINE DATASET CHK2 WITH SCOPE=SYSTEM –
OLD SEQUENTIAL DSN=CCA.CHKPOINT.CHK2 VOLUME=DISK02
PAGESZ=6184,NUSERS=1000,MAXBUF=100000,…

Note the following considerations when you define parallel streams:

  1. The device type and space allocation for each member of a parallel stream must be identical.
  2. The number of parallel members is not limited to two. You can specify as many members as desired.
  3. The datasets CHK1 and CHK2 could also be defined as GDGs when you require 24x7 availability. See the October 2005 issue of CCAPRINT for more information on GDGs.
  4. Similar DEFINEs could be used to define CCAJRNL as a parallel stream.

Output Processing of Parallel Streams
A parallel stream definition essentially produces, in parallel and in real time, a backup copy or copies of the CHKPOINT dataset. If a media failure or I/O error occurs on either volume, DISK01 or DISK02, the CHKPOINT dataset on the other volume can be used instead to provide roll back recovery. MINAVAIL=1 indicates that the run can continue even if an I/O error or media failure occurs in one of the parallel members--CHK1 or CHK2.

When a record is written to a parallel stream, it is simultaneously duplicated on each member defined to the stream. When the I/O completes, the I/O completion status of each member is examined. Any error on a member deactivates that member and removes it from the stream. If the number of remaining and available members is greater than or equal to MINAVAIL, the stream remains open. Otherwise the parallel stream is closed and the following message is issued:

M204.0095 PARALLEL STREAM streamname DISABLED, NUMBER OF MEMBERS BELOW MINAVAIL

Recovery Using Parallel Streams
When the CHKPOINT stream defined in Figure 1 is required for roll back recovery, the CCAIN definitions shown in Figure 2 would be required.

Figure 2. CCAIN definitions required for roll back recovery

//CCAIN DD *
DEFINE STREAM RESTART WITH SCOPE=SYSTEM –
PARALLEL=(CHK1,CHK2) MINAVAIL=1
DEFINE DATASET CHK1 WITH SCOPE=SYSTEM –
OLD SEQUENTIAL DSN=CCA.CHKPOINT.CHK1 VOLUME=DISK01
DEFINE DATASET CHK2 WITH SCOPE=SYSTEM –
OLD SEQUENTIAL DSN=CCA.CHKPOINT.CHK2 VOLUME=DISK02
PAGESZ=6184,NUSERS=1,MAXBUF=100000,…
RESTART ROLL BACK ERROR CONTINUE ROLL FORWARD

Input Processing of Parallel Streams
In Figure 2 the RESTART stream is a parallel input stream. Input processing opens all members of the parallel stream and reads simultaneously from each member of the stream. However, only one member is considered the active member. Records read from inactive members are ignored as long as an I/O error is not encountered on the active member. If that does occur or an end-of-data condition occurs, the active member is closed and the next member of the stream becomes the active member. Each record read from any member is compared for content and length to each corresponding record from the other members and each must be identical. If the records are not identical the stream is disabled with the following message:

M204.1282: PARALLEL STREAM streamname DISABLED, RECORD number IS NOT THE
	           SAME FOR ALL MEMBERS

If this should occur, use the other valid stream members and define them as a parallel RESTART stream and rerun recovery. If only one member is valid, define it as the RESTART dataset, not a parallel stream, and rerun recovery.

Messages Associated with Parallel Streams
The following messages are associated with parallel streams.

M204.0095: PARALLEL STREAM streamname DISABLED, NUMBER OF MEMBERS BELOW 	         
           MINAVAIL
M204.0096: MEMBER membername REMOVED FROM PARALLEL STREAM streamname
M204.1282: PARALLEL STREAM streamname DISABLED, RECORD number IS NOT THE SAME FOR ALL MEMBERS
M204.1350: PARALLEL STREAM streamname MEMBER membername RECORD number SEQ # OF date time IS OF LENGTH length
M204.1826: MEMBER membername OF PARALLEL STREAM streamname HAS number RECORDS
M204.1827: OPEN FAILED FOR MEMBER membername OF PARALLEL STREAM streamname
M204.1894: PARALLEL STREAM streamname MEMBER membername RECORD number [SEQ # sequence OF date time] CONTAINS X’value’ IN POSITION position

Summary
If you require something approaching a fail-safe recovery setup, you should consider using parallel streams for both the CHKPOINT and CCAJRNL datasets. Although this requires double (or more when using more than two members) the disk space you currently use for those datasets, you do have an additional level of protection in the rare event of a media failure involving those critical datasets.


System 1032
USE OF AND ACCESS TO PRODUCTS AND FEATURES ARE IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE USER’S SOFTWARE LICENSE. THE PRESENTATION OF MATERIAL HEREIN DOES NOT, IN ANY MANNER, MODIFY SUCH TERMS AND CONDITIONS.

Forms Feature, Part 2
By Tym Stegner

Tym

In the November CCAPRINT, Forms Feature, Part 1, as a case study we created a small application called STORES_LIB with ease using FormGen and the STORES dataset. The application includes the form STORES_FORM, as shown in Figure 1.

 

Figure 1. STORES_FORM generated by FormGen

+--------------------------- S T O R E S -----------------------------+
|Store Name     ________________________  Store ID      __            |
|Division ID __ City ______________|
|State/Province _______________ Country ______________|
|Budget ____________________ Gross to date ______________|
+---------------------------------------------------------------------+

In this part of the STORES_LIB case study we will refine the layout of the form, which is itself also an easy task. We are doing these refinements to eliminate the DIVISION_ID field, as well as to add new fields to the form in support of corresponding attributes already added to the STORES dataset.

Update the Form Definition with New Fields
After issuing a SHOW FORM STORES_FORM DEFINITION command with the STORES_LIB library open, you can modify and save the code shown in Figure 2. (Alternately, you can extract the form definition STORES_FORM from the library definition file STORES_LIB.DMD.)

Start the update of the STORES_FORM by commenting out the DIVISION_ID field, and adding two new Time_Span fields to the end of the group. (Be sure to add the new fields within the group definition, that is: before the End_Group keyword. Otherwise, they will display outside the form box.)

Copy the LATITUDE and LONGITUDE attribute definitions from the previously modified STORES dataset definition and paste them directly into the STORES_FORM code. Then remove the ATTRIBUTE and KEYED keywords and the title option, as shown in blue. The commented out DIVISION_ID field is shown in red.

Figure 2. Deleting and adding fields to the STORES_FORM code

Form STORES_FORM Message Shared Prompts Bold Values Reverse -
Comment "Form for Dataset STORES" -
Field STORES_FORM_G1 Group Prompt " S T O R E S " of
STORE_NAME or SNAME Text 25 Prompt "Store Name" -
Value Reverse Bold -
Help "Enter up to 25 characters of text"
STORE_ID or SID Integer Comment -
"This is the join attribute to DIVISIONS." Format NU2 Prompt –
"Store ID" -
Value Reverse Bold Right_Justified -
Help "This is the join attribute to DIVISIONS."
! DIVISION_ID or DIVID Integer Format NU2 Prompt "Division ID" -
! Value Reverse Bold Right_Justified -
! Help "Enter a whole number"

CITY Text 15 Prompt "City" -
Value Reverse Bold -
Help "Enter up to 15 characters of text"
STATE or PROVINCE Text 15 Prompt "State/Province" -
Value Reverse Bold -
Help "Enter up to 15 characters of text"
COUNTRY Text 15 Prompt "Country" -
Value Reverse Bold -
Help "Enter up to 15 characters of text"
STORE_BUDGET or BUDGET Decimal Format N$,12.2 Prompt "Budget" -
Value Reverse Bold Right_Justified -
Help "Enter a decimal number between -9999999999.99 "&-
"and 9999999999.99"
GROSS_TO_DATE or GROSS Decimal Format N$,12.2 –
Prompt "Gross to date" Value Reverse Right_Justified -
Help "Enter a decimal number between -9999999999.99 "&-
"and 9999999999.99" LATITUDE or LAT Time_Span Range -90:00:00 : 90:00:00 -
Precision Seconds Format TS4.9 Prompt "Latitude"
LONGITUDE or LNG Time_Span Range -180:00:00 : 180:00:00 -
Precision Seconds Format TS4.9 Prompt "Longitude"

End_Group
End_Form;

The code in Figure 2 defines the STORES_FORM shown in Figure 3.

Figure 3. STORES_FORM with modified fields

+----------------------------- S T O R E S -------------------------------+
|Store Name _________________________ Store ID __ |
|City _______________ State/Province _______________ |
|Country _______________ Budget _________________ |
|Gross to date ____________________ Latitude _________ |
|Longitude _________ |
+-------------------------------------------------------------------------+

When you compare Figure 1 and Figure 3, note that Forms, via auto-layout, has moved the next available field to the position formerly held by the DIVISION_ID field, and that the new LATITUDE and LONGITUDE fields were placed at the end of the form.

System 1032 Forms, by default, positions the defined fields so that the form is filled from left to right, top to bottom, fitting the fields into the default width of 80 characters.

Using the Form Editor to Display Field Positions
This functional layout does not fulfill my requirement to have all the address-related data grouped together, separated from the financial information. Furthermore, I want each prompt text adjacent to its value window.

The System 1032 Form Editor, also called the Stand-Alone Form Editor (SAFE), is a utility residing in the S1032_FE library, accessed by the EDIT_FORM command variable. The editor is menu-driven. You can use it to modify or create just about any form that is syntactically allowed. The Form editor can be used with forms defined in $TEMP, or those within existing, opened libraries. Used with the STORES_FORM as input, the Form Editor screen appears as shown in Figure 4.

Figure 4. STORES_FORM opened in the Form Editor

+----------------------------- S T O R E S -------------------------------+
|Store Name _________________________ Store ID __ |
|City _______________ State/Province _______________ |
|Country _______________ Budget ____________________|
|Gross to date ____________________ Latitude _________ |
|Longitude _________ |
+-------------------------------------------------------------------------+
… (extra blank lines omitted)
EDIT FORM Paint Edit Field Edit Group
Add Field Add Group Remove Field Remove Group
Resequence Auto Layout Replace Form Set Form Options
Modes Output Def'n Exit
Please select an option

Revealing the Field Positions
Press the Tab key to navigate within the menu at the bottom of the screen to select an action option. Then press the Return key to run the option. (This in turn often prompts within the subject form to select the field to be operated upon. Many other sub-menus and sub-forms appear as needed to process the desired action on the selected field).

Select the Output Def’n option, which works in a similar fashion to a SHOW FORM DEFINITION command to output the source for the subject form to an external file. However, this option creates a form definition file containing layout information, including the AT and ALIGN clauses.

To explicitly position the fields, you can modify the values of n,m in the AT clauses for the form fields. The form definition shown in Figure 2 did not have any AT clauses, because Forms relies on default form layout to arrange the fields. Although we could go through each field in the definition to manually add an AT clause to each field, it is convenient to let the mechanism of the Form Editor return the definition that includes the AT clauses.

Back to Repositioning Fields
Now that you have a version of the form definition with the field positions, you can rearrange the form display to suit you. Briefly, Figure 5 illustrates the field position layout: a two-column grid (positions indented to indicate on-screen layout):

Figure 5. The STORES_FORM code with AT clauses

Form STORES_FORM
Form_Field STORES_FORM_G1 Group At 1,1 of
STORE_NAME Text 25 At 2,2 Align
STORE_ID Integer At 2,45 Align
CITY Text 15 At 3,2 Align
STATE Text 15 At 3,45 Align
COUNTRY Text 15 At 4,2 Align
STORE_BUDGET Decimal At 4,45 Align
GROSS_TO_DATE Decimal At 5,2 Align
LATITUDE Time_Span At 5,45 Align
LONGITUDE Time_Span At 6,2 Align

In my layout I want all the address information in the second display column and the remaining fields in the first column, as shown in Figure 6. This arrangement causes the visit order on the form to proceed down the first column, then down the second column, rather than left-to-right, as is the default. Initially, field visit order depends on the order in which the fields were defined.

Figure 6. Rearranging fields in columns

Form STORES_FORM
Form_Field STORES_FORM_G1 Group At 1,1 of
STORE_NAME Text 25 At 2,2
STORE_ID Integer At 3,2
STORE_BUDGET Decimal At 5,2
GROSS_TO_DATE Decimal At 6,2
CITY Text 15 At 2,45
STATE Text 15 At 3,45
COUNTRY Text 15 At 4,45
LATITUDE Time_Span At 5,45
LONGITUDE Time_Span At 6,45

Note the ALIGN feature, shown in Figure 5, is removed in Figure 6 to move the prompts to be only one space separated from the value windows. I reordered the fields, because I expect once the address information is entered, it is less likely to be changed and that budget and gross data are more likely to be changed, so I moved those fields forward in the navigation order. The form now displays as shown in Figure 7.

Figure 7. STORES_FORM displayed with the fields in the desired groupings

+------------------------------ S T O R E S ------------------------------+
|Store Name _________________________ City _______________ |
|Store ID __ State/Province _______________ |
| Country _______________ |
|Budget ____________________ Latitude _________ |
|Gross to date ____________________ Longitude _________ |
+-------------------------------------------------------------------------+

Next I want to tweak the field positions to line up the data windows as shown in the Figure 8 layout. Using the same technique shown in Figure 6, I changed the m value (the cell position) in the AT clauses to get the alignment I required.

Figure 8. STORES_FORM data entry fields aligned

+----------------------------- S T O R E S -------------------------------+
|Store Name _________________________ City _______________ |
| Store ID __ State/Province _______________ |
| Country _______________ |
| Budget ____________________ Latitude _________ |
|Gross to date ____________________ Longitude _________ |
+-------------------------------------------------------------------------+

Note: you can also use either the Paint or Edit Field options of the Form Editor to rearrange fields in a form. Using the Paint option you can effectively drag a field to a new position and using the Edit Field option you can selectively edit field qualities, including position and alignment. These examples demonstrate the functionality of field repositioning by editing the form definition.

Coming Attractions
OK, the Figure 8 layout of the form now suits my requirements. The next step is to update the procedures in the form application to support the changes made to the field in the form. We will cover this topic in Forms Feature, Part 3.

 


Contact CCA Webmaster
Copyright 2008