Previous Topic: Displaying the Procedure Definition PanelNext Topic: Defining Parameters Used as Input


Defining Working Data

The WORK command or equivalent function key displays the working data definition fill-in for the current program definition.

The working data definition fill-in names and describes data local to the application.

Working data is defined and maintained using the following fill-in.

=> ------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN.    PGM ADRMRPT                  SYS: DOC     FILL Command Level Field Name          T I Ch/Dg Occur Value/Comments/Clauses ====== ===== ====== T O P ====== = = ===== ===== ============================= ...... ...... ...... ...... ...... ...... ====== ===== === B O T T O M === = = ===== ===== =============================

The fields on the working data definition fill-in are:

Command

Designates an area where you can specify line commands.

Level

Specifies the number that hierarchically ranks fields. Elementary field names must be unique to the highest level (level-1) group name. Simple fields not in a group (level-1 names by themselves) must be unique to the program, and do not require a level number.

Field Name

Contains one of the following:

This entry is blank when the Value/Comments/Clauses column contains a continuation line or a comment or when the rest of the line is blank.

T (Type)

Specifies the field type. Type defaults to N if the internal representation is specified. Type must be blank for a group item, continuation lines, and subscript initial values. Any types that can hold null values must be defined as nullable, which is identified with the keywords WITH IND in the Value/... column. The following are the valid entries:

X

Specifies an alphanumeric field. The value of the field can be any alphabetic, numeric, or special character, or the null value.

V

Specifies a variable length alphanumeric field. The value of the field can be any alphabetic, numeric, or special character or the null value.

N

Specifies a signed numeric field. The value of the field can be 0-9, a minus sign, or decimal symbol, or the null value.

U

Specifies a unsigned numeric field. The value of the field can be 0-9 or decimal symbol, or the null value.

D

Specifies a date field. This type is a numeric field containing an integer number, reflecting the number of days, plus or minus, from December 31, 1900 (day zero), or the null value.

C

Specifies a condition name assigned to a specific value of a field.

F

Specifies a flag that signifies a condition. The only valid values for a flag are TRUE and FALSE.

I (Internal Representation)

Specifies the internal representation of numeric (signed and unsigned) and date type fields:

P

Specifies a packed decimal field.

Z

Specifies a zoned decimal field.

B

Specifies a binary field.

Note: Internal representation must be blank unless the type is N, U, or D. P is the default.

Ch/Dg (Characters/Digits)

Specifies the length of the field value. Either the number of alphanumeric characters or the number of integers, a period, and the number of decimal places in a numeric or date field value. For a variable length alphanumeric field, the maximum number of alphanumeric characters. Date fields cannot have decimal places.

You must specify the characters and digits for all elementary field types except dates and flags. The default for date fields is 7. The minimum length for date fields is 5. For numeric and date fields, the maximum is 31 for packed and zoned, and 9 for binary.

A non-date entry with no type or length information is assumed to be a group name and must have subordinate fields following it.

For example, in the following table, 42 in the Ch/Dg column for the first alphanumeric field (Type X) indicates a length of 42 characters. The value 16 for the variable length field indicates a maximum length of 16 characters. A numeric field (Type N) with 7 specified in the Ch/Dg column indicates a seven-digit field with 7 integer positions. The next numeric field, with 10.3 specified in the Ch/Dg column, indicates a 13-digit field with 10 integer positions and 3 decimal places. A date field (Type D) with 5 in the Ch/Dg column can hold an internal five-integer date value of up to 273 years from the base year.

Type

Ch/Dg

X

42

V

16

N

7

N

10.3

D

5

Occur (Number of Occurrences)

Specifies the number of times a group or field occurs.

When a group or field repeats a fixed number of times, enter the number of occurrences in this column.

Occurring fields (elementary items) can optionally have initial values specified in the Value column. Enter these values on each successive line in the Value column. Enter a valid subscript number (of the form (n), (n,o), or (n,o,p)) on the corresponding line in the Field Name column.

You cannot specify initial values for repeating groups. However, specify initial values for individual occurrences by placing the subscript in Field Name.

A group or field can also occur a variable number of times that depends on the value of another field known as the Depending on field. In this case, the Occur column contains the maximum number of occurrences. The Depending on field name is specified in the Value/... column by using the phrase DEP ON field-name. Only one group or field is permitted in any level-01 group. It must be at the end of the level-01 group.

Value/Comments/ Clauses

Specifies one of the following: A value for the occurrence of the field, a REDEFINITION or REDEF keyword, a DEP ON clause, a WITH INDICATOR or WITH IND clause, a COPY DATAVIEW or COPY DVW clause, or a COPY SQLCA clause. You can specify a descriptive comment about the field alone or with any of the others.

Note: The case of the data entered in this column as CA Ideal retains it depends on the setting that was determined for case by default or with a SET EDIT CASE command. Keywords and identifier references must be in uppercase for compiling and editing.

Value

Specifies a specific value assigned to an occurrence of a field.

You can assign an elementary field a value in the Value/... column. This value can be a numeric or alphanumeric literal, depending on the type of the elementary field.

You must enclose alphanumeric literals in delimiters (“ or '). If an alphanumeric literal is longer than the space provided, continue the alphanumeric literal on the next line of the same column surrounded by a new pair of delimiters. Leave all other columns on the continuation line blank. Two or more delimited alphanumeric literals continued in this fashion are concatenated and treated as one.

The default value of a nullable field defined as WITH IND is null, regardless of type. Otherwise, the default value for a numeric field is zero. For a fixed alphanumeric field, it is spaces. For a variable length alphanumeric field, it is the empty string of zero length.

In the case of an occurring field, the Value column is left blank on the line that contains the field name. The following lines can contain occurrence subscripts.

You can assign a variable length field with a value of an alphanumeric literal enclosed in delimiters. The length of this literal is the initial length of the field. It must not exceed the maximum length specified in the Ch/Dg column.

A flag can have an initial value of either TRUE (or T) or FALSE (or F). The default is FALSE.

You cannot assign an initial value to a date field. The initial value is always zero.

If you omit the length for a character field, but provide a literal value, CA Ideal will set the field length to the length of the literal.

A value of CRLF (without quotes) represents the carriage return/line feed combination used in HTML and XML documents.

If you omit the length for a character field, but provide a literal value, CA Ideal will set the field length to the length of the literal.

A value of CRLF (without quotes) represents the carriage return/line feed combination used in HTML and XML documents.

Comments

Contains useful information about the field. A preceding colon (:) indicates a comment in this column. For more information about how to specify and use comments, refer to the Programming Reference Guide.

To continue a comment over multiple lines, start each line of the column with a colon. The other columns can be blank or the continuation of a field name.

REDEF

The keyword REDEFINITION (or REDEF) in this column indicates that this working data item is another view of the closest previously defined item at the same level that is not itself a redefinition.

This item cannot be larger than the item that defines it. The two items can be different types (such as alphanumeric and numeric), but neither item can be a variable length field or a nullable field. Neither item can be a group containing a variable length field or a nullable field.

CA Ideal determines the data type of the REDEF working data item by using the Type specified for the item it redefines. Types explicitly specified with the REDEF working data item are ignored. If the REDEF data item is a group, the data types in its subordinate field do not affect whether the group is alpha or non-alpha. Rather, the item that it redefines determines whether it is an alpha or non-alpha group.

An item with a REDEF cannot have an initial value. If a group has a REDEF, none of its subordinate fields can have initial values. However, the item that defines it can have an initial value.

DEP ON

Designates a field as a counter to limit the number of occurrences of a field that was defined as occurring a variable number of times. Field-name must be an elementary numeric field that appears previously in the same level-1 structure. The field must be defined with zero decimal places and cannot be specified with an Occur value. It cannot be a date field. You can specify an initial value for the field.

The keywords DEP and ON can be split over two consecutive lines without a continuation character. To continue a field name onto a second line, specify a semicolon (;) as the last character of the first line. You can break the field name at any character. Leading blanks on the continuation are stripped.

COPY DATAVIEW

Automatically copies the entire structure of a dataview into a working data definition.

To continue a dataview name onto a second line, specify a semicolon (;) as the last character of the first line. You can break the name at any character.

References to field names in a copied dataview must be qualified with the level-1 data name, even if they are the only references to the names. This distinguishes the copied fields from the dataview fields.

CA Ideal performs the copy when the program is compiled. To see the dataview structure, enter the DISPLAY DATAVIEW command or turn the EXD compiler option on. The dataview structure is never expanded in working data.

COPY SQLCA (SQL access only)

Automatically copies the entire structure of the SQLCA work area into a working data definition. The SQLCA contains information about the last SQL statement processed by this program. COPY SQLCA is not needed when using $SQL functions. To use this clause:

You can define only one SQLCA group in working data for each database management system that can be accessed using SQL. The level-1 data name cannot be DB-SQLCA, the name CA Ideal uses. The subordinate fields of each group are the SQLCA fields.

For a list of the SQLCA fields, refer to the $SQL functions in the Programming Reference Guide and to the SQL reference guide for the appropriate database management system.

If the resource table includes an SQL dataview or the EXD compiler listing option is turned on, the SQLCA structure is listed following the WOR/PAR sections in the compiler listing.

CA Ideal performs the copy when the program is compiled.

If you have both CA Datacom SQL and DB2 SQL:

WITH INDICATOR

Indicates (WITH INDICATOR or WITH IND, or IND) that this elementary field is nullable; that is, that it can receive null values. You can specify this clause with alphanumeric, variable length, numeric, date fields, and condition names. You can also specify an initial value but, if you do not, the null value is the default.

NULL

You can specify a nullable field with an initial null value with the keyword NULL in this column. In this case, WITH INDICATOR is optional.

Example

The following example shows the various types of data structures that you can define using the working data definition fill-in. The components of this example apply equally to the record structures of a CA Datacom/DB database as defined through the dictionary. Dataview definitions from the dictionary, as the CA Ideal user sees them, closely resemble the PDL working data structure, as does the definition of parameter data.

The example uses a working data definition fill-in to show how numeric and alphanumeric fields, groups, alpha-groups, and repeating groups are specified.

The following two screens show sample definitions of a flag, an alphanumeric group, and a non-alphanumeric group. ADDRESS, in the second fill-in, is the name of a non-alpha group.

=> ------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN. PGM JEPDX1 (001) TEST SYS: DOC DISPLAY Command Level Field Name T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ===== ============================= 000100 1     PART-NAME           X      16       'SAMPLE-PART-NAME' : DEFAULT 000200                                            : PART NAME 000300 1     PART-NUMBER         N       9       999999999 : DEFAULT PART NUM 000400 1     IN-STOCK            F               FALSE : PART NOT FOUND ====== ===== === B O T T O M === = = ===== ===== =============================

=> ------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN.    PGM JEPDX3  (001) TEST          SYS: DOC DISPLAY Command Level Field Name T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ================================== 000100 1     EMPLOYEE-NAME                       : THIS GROUP NAME CAN BE USED 000200                                            : WHEN FULL NAME IS NEEDED 000300   2    LAST-NAME           X      15 : USE FOR LAST NAME ONLY 000400   2    MIDDLE-INITIAL      X       1 000500   2    FIRST-NAME          X      10       : USE FOR FIRST NAME ONLY 000600                                            : 000700 1     ADDRESS                             : THIS GROUP NAME CAN BE USED 000800                                            : WHEN FULL ADDRESS IS NEEDED 000900 2 STREET              X      20       : STREET NUMBER AND NAME 001000 2 CITY                X      15 001100 2 STATE               X       2       : 2-CHARACTER ABBREVIATION 001200 2 ZIP-CODE            N       9       : SPACE FOR NEW 9-DIGIT CODE ====== ===== === B O T T O M === = = ===== ===== ============================

The next screen shows an example of a repeating field with initial values in the form of a table of months:

=> ------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN.    PGM JEPDX2 (001) TEST          SYS: DOC DISPLAY Command Level Field Name          T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ===== ============================ 000100 1     MONTH-TABLE         X       9    12 000200        (1) 'JANUARY' 000300        (2) 'FEBRUARY' 000400        (3) 'MARCH' 000500        (4) 'APRIL' 000600        (5) 'MAY' 000700        (6) 'JUNE' 000800 (7) 'JULY' 000900 (8) 'AUGUST' 001000 (9) 'SEPTEMBER' 001100 (10) 'OCTOBER' 001200 (11) 'NOVEMBER' 001300 (12) 'DECEMBER' ====== ===== === B O T T O M === = = ===== ==================================

The next screen shows how to define several data types:

It also shows several types of data structures:

=> ------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN. PGM JEPDX4 (001) TEST SYS: DOC DISPLAY Command Level Field Name T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ===== ============================ 000100 1 EMPLOYEE-NAME 000200 000300 2 LAST-NAME           X      15 000400 2 MIDDLE-INITIAL      X       1 000500 2 FIRST-NAME          X      10 000600 000601 1     EMPLOYEE-NUMBER     N P     7 000602 000700 1 ADDRESS 000800 000900 2 STREET X     20 001000 2 CITY                X     15 001100 2 STATE               X      2 001200 2 ZIP-CODE            U Z    9 001201 2 ZIP-CODE-ALT        X      9        REDEF 001202 001203 1 COM-ADDRESS         V     46 001300 001400 1 MARITAL-STATUS      X      1 001500 MARRIED             C               'M' 001600 SINGLE              C               'S' 001700 DIVORCED            C               'D' 001800 WIDOWED             C               'W' 001900 SEPARATED           C               'E' 002000 002100 1 DEPENDENTS 002200 2 #DEPENDENTS         N P    2        : NUMBER OF DEPENDENTS 002300 2 DEPENDENT 12 DEP ON #DEPENDENTS 002400 3 FULL-NAME 002500 4 GIVEN               X     10        : DEPENDENT'S FIRST NAME 002600 4 MIDDLE              X      1 002700 4 LAST                X     15        : IF DIFFERENT FROM EMPLOYEE 002800 3 BIRTH-DATE          D 5 ====== ===== === B O T T O M === = = ===== ===== ============================

The following screen defines a working data field used as a report summary line. The multiple consecutive lines of values are concatenated into a single alphanumeric literal.

=>

------------------------------------------------------------------------------- IDEAL: WORKING DATA DEFN. PGM JEPDX6 (001) TEST SYS: DOC DISPLAY Command Level Field Name T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ===== ============================ 000100 1 RPT-LITERAL X 44 '**** This Is the Last Line ' 000200 'of the Report ****' ====== ===== === B O T T O M === = = ===== ===== ============================

The following screen shows the definition of a two-dimensional array (ROWS,RANKS) representing the squares on a chess board. The initial values show the deployment of pieces at the start of a game.

=>

‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ IDEAL: WORKING DATA DEFN. PGM JEPDX5 (001) TEST SYS: DOC DISPLAY Command Level Field Name T I Ch/Dg Occur Value/Comments/Clauses ------ ----- ------------------- - - ----- ----- ----------------------------- ====== ===== ====== T O P ====== = = ===== ===== ============================ 000100 1 CHESS-BOARD 000200 2 ROW                               8 000300 3 RANK                X       9     8 000400 (1,1) 'WH-ROOK' 000500 (1,2) 'WH-KNIGHT' 000600 (1,3) 'WH-BISHOP' 000700 (1,4) 'WH-KING' 000800 (1,5) 'WH-QUEEN' 000900 (1,6) 'WH-BISHOP' 001000 (1,7) 'WH-KNIGHT' 001100 (1,8) 'WH-ROOK' 001101 (2,1) 'WH-PAWN' 001102 (2,2) 'WH-PAWN' 001103 (2,3) 'WH-PAWN' 001104 (2,4) 'WH-PAWN' 001105 (2,5) 'WH-PAWN' 001106 (2,6) 'WH-PAWN' 001107 (2,7) 'WH-PAWN' 001108 (2,8) 'WH-PAWN' 001114 (7,1) 'BL-PAWN' 001115 (7,2) 'BL-PAWN' 001116 (7,3) 'BL-PAWN' 001117 (7,4) 'BL-PAWN' 001118 (7,5) 'BL-PAWN' 001119 (7,6) 'BL-PAWN' 001120 (7,7) 'BL-PAWN' 001121 (7,8) 'BL-PAWN' 001200 (8,1) 'BL-ROOK' 001300 (8,2) 'BL-KNIGHT' 001400 (8,3) 'BL-BISHOP' 001500 (8,4) 'BL-KING' 001600 (8,5) 'BL-QUEEN' 001700 (8,6) 'BL-BISHOP' 001800 (8,7) 'BL-KNIGHT' 001900 (8,8) 'BL-ROOK' ====== ===== === B O T T O M === = = ===== ===== ============================