Images: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 1,373: Line 1,373:
The MODIFY BUFFER statement requires that you specify at least one option. </p>
The MODIFY BUFFER statement requires that you specify at least one option. </p>
<p>
<p>
When you overwrite the contents of BUFFER area, the value of $BUFFER_USED is set to zero and the value of $BUFFER_POSITION is set to one. See [[$BUFFER SIZE#$BUFFER SIZE|$BUFFER SIZE]] and [[$BUFFER USED#$BUFFER_USED|$BUFFER_USED]].</p>
When you overwrite the contents of BUFFER area, the value of $BUFFER_USED is set to zero and the value of $Buffer_Position is set to one. See [[$BUFFER SIZE#$BUFFER SIZE|$BUFFER SIZE]] and [[$BUFFER USED#$BUFFER_USED|$BUFFER_USED]].</p>
<p>
<p>
If you exceed the 2-gigabyte limit on the size of BUFFER, $STATUS returns a value of 34. A negative number or a number less than UBUFSZ is changed to UBUFSZ.</p>
If you exceed the 2-gigabyte limit on the size of BUFFER, $STATUS returns a value of 34. A negative number or a number less than UBUFSZ is changed to UBUFSZ.</p>
 
==OPEN statement==
==OPEN statement==
<p>
<p>

Revision as of 14:03, 8 July 2014

Overview

This article describes a feature of User Language, called images, that allows:

  • A request to read and process non-Model 204 files, that is, sequential and VSAM files, and terminal input, such as a Host Language IFDIAL thread
  • A request to write to sequential files and terminals
  • The creation of formatted blocks of storage that can be used to build records or to process data that is not in a format automatically recognized by Model 204

Terminology

Before reviewing the capabilities and requirements of images, you should be familiar with the following terms that are used throughout this discussion:

Term Definition
Array Ordered arrangement of data elements. Multiple occurrences of an item or a group of items.
Block A contiguous storage area into which a record is read or from which a record is written. Also, block can be a contiguous storage area in which data can be manipulated.
Image A description of the format of data in a block.
Item An individual string or number in an image.

Global images

Global images provide a means for passing image data from one request to another, and for efficiently managing more than one image in one request.

Although there are some differences in the way you use the DECLARE IMAGE statement, you generally define and use global images the same as you do non-global images. See Global images and screens where a discussion of global screens, menus, and images begins.

Using images

See Global images and screens for a discussion of global images.

Reading external files or terminal input

Input sources

The image feature lets a request read and process records from the following sources of input:

Input sources Description
Sequential or VSAM files

Any number of sequential or VSAM files can be read and processed. If VSAM files are used, the files must be keyed sequential (KSDS). KSDS files can be accessed using an alternate index path.

For more information on the types of files and keys that can be used, see the DEFINE DATASET command.

Terminal

Terminal input can be read and processed. A terminal can consist of the physical device on which the request is run, or a User Language connection that has been made from a Host Language application program by using the IFDIAL function.

For more information on IFDIAL, refer to the Rocket Model 204 Host Language Interface Reference Manual.

External records

Records read from sequential or VSAM files and data passed from the terminal are referred to as external records in this discussion to distinguish them from Model 204 records.

The format of the external record is described by a structure called an image. Multiple descriptions of a record are allowed, as discussed later in this article. User Language statements can refer to each item described in the image definition.

Reading records into an image

User Language statements, which are documented beginning with Processing images, let the request open the file, read records into the image, and close the file.

For keyed VSAM files, the request can position the file to read sequentially starting with any record in the file.

Writing to sequential files or a terminal

The image feature lets a request write records to any number of sequential files or to a terminal. This capability allows multiple output files and reports to be written by a single pass of the database.

Note: Only printable characters of a record are displayed on a physical terminal device. Therefore, images used to write to a physical terminal device should be defined with string items only.

Defining storage blocks

You can define the data in a block of storage as an image.

The image definition can consist of item definitions as well as definitions of areas in the block that do not need to be accessed. Items in the image can be filled with constants, %variables, fields from a Model 204 record, screen items, items from the current block or another block, and expressions.

Each item defined in the image can be referred to by User Language statements.

Possible uses

In addition to sequential file, VSAM file, or terminal I/O processing, the ability to manipulate a block of storage has several other uses. For example, you can:

  • Construct print lines by filling in items in one or more images at various points in a request. Once the print lines are complete, you can print the lines.
  • Copy into an image fields in Model 204 records that have formats not directly recognized by User Language; the individual parts of the field then can be accessed as image items. For example, if the user wants to use packed decimal data that is stored in a Model 204 field, the data can be moved into an image item and used directly. This eliminates the need to use the $PACK function to convert the data prior to its use.
  • Store blocks of data of up to 255 bytes as a single field, copied to an image, and the parts of the block can be referred to separately. Data that is stored as a single, large field, for example, a line of text, can be moved into an image that defines the data as one or more items. The items then can be referred to separately.
  • Pass data from one request to another.
  • You can manipulate more than one image at a time in an application, for example, in an HORIZON application involving simultaneous conversations.
  • You can use images to structure the local working storage of a request in a more disciplined manner than is possible with %variables.

Defining an image

Managing blocks

You must define the layout of the block before it can be used by the request.

A block is defined by one or more images that describe the data in the block.

Images describe blocks of data up to 32,767 bytes in length.

Define an image before referring to it

In a request, an image definition must precede any references to the image.

Understanding how data is described by images

To design applications using images, you can review the following summary of how images are used to describe different views of the data is provided below:

  • Using images, the application can access any piece of data in the block. As many as 255 images can describe the same block.
  • Although a single request can contain more than one block of images, the total number of images for all blocks within each request cannot exceed 256 images.
  • You can define multiple images to provide different views of the same data. This is similar to the COBOL capability to REDEFINE a piece of storage. The multiple image capability enables the request to read in a record, determine the format of the data in the record, and access different data items in the record according to format.
  • You can define the image items as strings or numbers. Numbers can have binary, floating point, packed decimal, zoned decimal, and exponential formats. Model 204 automatically handles all data type conversions when referring to image items.
  • You can define fixed and variable length arrays within an image. Each array element can contain one or more items. Arrays can be nested up to 255 levels deep.
  • You can define image items precisely or their length can be determined during evaluation. Similarly, the number of array occurrences can be determined during evaluation. This capability allows the request to handle all types of data structures.

Image components

Each block definition must begin with an IMAGE statement and end with an END IMAGE statement. Between these statements, the following components are used to describe the contents of the block:

  • Image definitions
  • Item definitions
  • Array definitions
  • Reserved area definitions

Comments, blank lines, and INCLUDE statements can also be part of a block definition.

Concurrent access to multiple records of the same format

One image definition is required for each record to be accessed concurrently.

If you need concurrent access to multiple records of the same format, the image definition must be duplicated with a different name. This can be done easily by using an INCLUDE statement inside the image definition.

Image naming and reference conventions

Rules for image names

  • An image name is a character string that consists of any number of letters, numbers, and some special characters. The name can have no embedded blanks, colons, or Model 204 reserved characters. Refer to Reserved words and characters for a complete list of reserved characters.
  • An image cannot have the same name as a screen or menu.
  • If IMAGE, MENU, or SCREEN is an image name, it must be preceded by the keyword IMAGE in READ IMAGE and PREPARE statements.

Rules for item names and array names

  • Item and array names follow the same naming conventions as image names.
  • Every image item name and array name must be unique within the block definition. An item name or array name can be reused in different blocks, screens, and menus.
  • An item (or array) name and its image name cannot have a combined length exceeding 253.

Rule for reserved item names

The item name READLEN is reserved by Model 204 to contain the length of the last record read into the block. This value can be obtained from the variable %imagename:READLEN.

Do not duplicate names in the same block

Do not duplicate item, array, and image names within the same block.

References

To identify the item uniquely, all references outside the image definition must include the image name and item name and must be specified in this format:

%imagename:itemname

For example:

%INVENTORY:PART.NO

identifies the item PART.NO in the image INVENTORY.

IMAGE and END IMAGE statements

The IMAGE statement starts the definition of the image. Each image can contain a description of the complete block or can redefine a portion of another image.

Syntax

The format of the IMAGE statement is:

IMAGE imagename [AT {itemname | imagname1 | arrayname} | GLOBAL [PERMANENT | TEMPORARY] | [PERMANENT | TEMPORARY] GLOBAL | COMMON]

Where:

  • imagename is the name of the image. Every image name defined in a request must be unique. The image name specified in the IMAGE statement is assigned to the image being defined; other User Language statements in the request can subsequently refer to this name.
  • The AT clause is optional and specifies the starting location of a redefinition. If the AT clause is omitted, the image definition starts at the beginning of the block. The location can be defined by one of the following options:
    • itemname is the name of an item in a previously defined image in this block.
    • imagename1 is the name of an image previously defined in this block.
    • arrayname is the name of an array in a previously defined image in this block.

    Note: You cannot use the AT clause with a GLOBAL image, since you can only define the first image in a multi-image block as a global image.

    • Specifying COMMON, or specifying neither COMMON nor GLOBAL, results in the image being stored in FSCB. Common elements, as well as DECLARE and COMMON, are discussed in detail in Subroutines.
    • GLOBAL specifies to store the image in GTBL. Global images have an implied scope of COMMON (see above).

Restrictions to the GLOBAL option

You must not specify the GLOBAL attribute for an image that has an image item defined with either of the following attributes:

  • OCCURS UNKNOWN
  • LEN UNKNOWN

For multi-image blocks, you can specify only the first image as GLOBAL; you must not specify subsequent images in a multi-image block as GLOBAL.

  • PERMANENT can be used only with global images. Permanent global images persist across request boundaries; that is, they are maintained in GTBL even after a request has been terminated.
  • TEMPORARY can be used with only global images. TEMPORARY global images are allocated in GTBL, but are deleted at request termination. For example, use a TEMPORARY global image when you do not need to pass the image to another request; using TEMPORARY global images eliminates the need to explicitly delete globals that do not need to persist.

END IMAGE statement

The END IMAGE statement must be the last statement in an image definition. END IMAGE terminates the definition of all images that describe the same block.

The format of this statement is:

END IMAGE

Examples of image definitions

Single image definition

An example of the definition of a single image follows:

IMAGE GENERAL.LEDGER.RECORD GL.RECORD.TYPE IS STRING LEN 1 GL.NUMBER IS STRING LEN 10 DP 3 GL.INV.TYPE IS STRING LEN 2 END IMAGE

Multiple image definition for the same block

The following example illustrates two images that define the same block. Each image completely defines the block, with the items named GL.RECORD.TYPE and AR.RECORD.TYPE both located at the first byte in the block.

IMAGE GENERAL.LEDGER.RECORD GL.RECORD.TYPE IS STRING LEN 1 GL.NUMBER IS STRING LEN 10 DP 3 GL.INV.TYPE IS STRING LEN 2 IMAGE ACCOUNTS.REC.RECORD AR.RECORD.TYPE IS STRING LEN 1 AR.ACCT.NO IS STRING LEN 6 AR.BALANCE IS PACKED DIGITS 9 DP 2 END IMAGE

Multiple image definition with shared items

When an image redefines part of another image, the AT clause names an item or array in an image already defined in the record. Items preceding the named item or array in the block are combined with items defined following the IMAGE statement to create the complete image description.

Therefore, the preceding example also could be defined in the following manner. The example illustrates two images that define the same block but share at least one item in common. In this example, the item RECORD.TYPE is shared by both images, and can be referred to by prefixing the item name by either image name. The items GL.NUMBER and AR.ACCT.NO both begin at position 2 in the block.

IMAGE GENERAL.LEDGER.RECORD GL.RECORD.TYPE IS STRING LEN 1 GL.NUMBER IS STRING LEN 10 DP 3 GL.INV.TYPE IS STRING LEN 2 IMAGE ACCOUNTS.REC.RECORD AT GL.NUMBER AR.ACCT.NO IS STRING LEN 6 AR.BALANCE IS PACKED DIGITS 9 DP 2 END IMAGE

Special considerations for multiple image blocks

When you define multiple image blocks, take note whether the sum of the individual image items completely defines the block. Is there undefined space between the image items? If there are, you must initialize the space, otherwise you might get unexpected results, as illustrated in the following code.

Using uninitialized disk space

In the following multiple image block, PART1, PART2, and PART3 define parts of the block without defining or initializing the space between them. When LINE is defined, which encompasses the entire block, the system assumes that entire block has already been defined, because LINE begins at the same place as PART1.

R HDRCTL 0 BEGIN IMAGE A PART1 IS STRING LEN 10 PART2 IS STRING LEN 5 AT 16 PART3 IS STRING LEN 5 AT 26 LINE IS STRING LEN 30 AT PART1 END IMAGE PREPARE IMAGE A %A:PART1 = 'XXXXXXXXXX' %A:PART2 = 'YYYYY' %A:PART3 = 'ZZZZZ' SET HEADER 1 %A:LINE NP PRINT '%A:LINE = ' WITH %A:LINE PRINT '$C2X(%A:LINE) = ' WITH $C2X(%A:LINE) END

However, when output from the previous procedure is displayed, a stray numeral two appears twice in the header. This system read the string of zeros for the uninitialized space in the header (shown in the line that begins $C2X) and automatically substituted the page number.

02.142 MAY 22 10.11.11 PAGE 2 XXXXXXXXXX 2YYYYY 2ZZZZZ %A:LINE = XXXXXXXXXX YYYYY ZZZZZ $C2X(%A:LINE) = E7E7E7E7E7E7E70000000000E8E8E8E8E80000000000E9E9E9E9E9

Using initialized disk space

Refining the previous code, the spaces between PART 1 and PART2 and PART3 are initialized by the intervening SKIP statements.

R HDRCTL 0 BEGIN IMAGE A PART1 IS STRING LEN 10 SKIP 5 POSITIONS INITIAL BLANK PART2 IS STRING LEN 5 AT 16 SKIP 5 POSITIONS INITIAL BLANK PART3 IS STRING LEN 5 AT 26 LINE IS STRING LEN 30 AT PART1 END IMAGE PREPARE IMAGE A %A:PART1 = 'XXXXXXXXXX' %A:PART2 = 'YYYYY' %A:PART3 = 'ZZZZZ' SET HEADER 1 %A:LINE NP PRINT '%A:LINE = ' WITH %A:LINE PRINT '$C2X(%A:LINE) = ' WITH $C2X(%A:LINE) END

Now the output displays the expected results. The line that begins $C2X has the hexadecimal representation of white space between the defined areas meaning that the space is initialized. The system prints only the white spaces.

02.142 MAY 22 10.12.26 PAGE 2 XXXXXXXXXX YYYYY ZZZZZ %A:LINE = XXXXXXXXXX YYYYY ZZZZZ $C2X(%A:LINE) = E7E7E7E7E7E7E74040404040E8E8E8E8E84040404040E9E9E9E9E9

Defining image items

You must define each item in an image that is referred to by the request. Use an item definition to describe the following attributes for an item:

  • Data type
  • Length
  • Position
  • Number of occurrences
  • Editing options

Syntax

The general format of an item definition is:

itemname [IS [TYPE] type description]

Where:

  • itemname is the name by which the item is referred to.
  • TYPE is an optional keyword.
  • type specifies the data type of the item. Data type options are:
    • String
    • Binary
    • Large Object data
    • Packed decimal
    • Zoned decimal
    • Floating point
    • Exponential notation
  • description is the length, position, number of occurrences, and editing options specified for the item based on the data type.

The format used when defining an item for each data type is provided in the following table. In addition, an example of an image item definition appears in Item definition examples:

Term Description
Numeric All types except STRING are considered numeric.
NULL Binary zeros.
Omitted The option is omitted from the item description and no default is specified.
String A string of characters. A string must be enclosed in single quotes if it contains any of the following characters: blank, =, (, ), <, >, or ^.
ZERO Numeric zero of the correct format for numeric items. String and EFORMAT items are set to a single character zero.

Defining a string item

Syntax

Define string items with this syntax:

STRING {LEN {n | UNKNOWN} [DP {k | *}] | TO position} [PAD {BLANK | character | NULL}] [STRIP | NOSTRIP] [JUSTIFY {LEFT | RIGHT}] [INITIAL {BLANK | string | ZERO | NULL}] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length either as 1-255 bytes or as UNKNOWN, if the length is determined by the request and the IDENTIFY statement establishes the length.
  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length (LEN) or end (TO) position of the item is required unless the length has been specified in a DEFAULT statement.
  • DP (optional) specifies either that the item has from 0 to 15 decimal places as specified by k, or that the number of decimal places is variable.
    • DP k represents the number of places retained when a number is stored into an item and the number of places assumed to be present in data read from an external record.
    • If DP * is specified, all decimal places in the item are retained. If this option is omitted, the default is zero. Do not use DP, if the value to be moved to the item contains a decimal point.
  • PAD (optional) defines the fill character. If a value is shorter than an item to which it is being moved, the pad character fills the remainder of the item. If PAD is omitted, a blank is assumed. Padding is done on the right end of left-justified items and on the left end of right-justified items.

    The pad character can be a single quoted character, a hexadecimal value expressed as X'hh', or a decimal number. The hexadecimal or decimal value can be from 0 to 255.

  • STRIP, the default, specifies to remove the pad characters, if an item value is extracted from an image. NOSTRIP specifies to keep the pad characters.
  • JUSTIFY (optional) specifies whether a value is to be left- or right-justified when moved into an item by an assignment statement or when stripping on extraction. If JUSTIFY is omitted, the default is left-justified.
  • INITIAL (optional) defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. If an INITIAL clause is omitted, BLANK is the default initial value.

AFTER and AT clauses

  • The AFTER and AT clauses are optional and mutually exclusive. Their function is as follows:

    An AFTER clause defines the location of an item as immediately following the end of the specified item or array. This option is particularly useful when an item is redefined and the total length of the items in a redefinition is less than the length of the item.

    An AT clause defines the location of the item in the image as adjacent to an item or array or redefines the space defined by a previously defined item. If the location is not adjacent in a forward direction to the previous item definition, a SKIP is implied (see DEFAULT SKIP statement). If position is used, the location is relative to the beginning of the image.

    The position option can have a value from 1 through 32767. The item or array named in the AT clause cannot have a DEPENDING ON option.

    Consider the following restrictions when using an AFTER or AT clause:

    • Outside of an array definition, the AFTER or AT clause cannot name an item inside the array.
    • Within an array definition, the AFTER or AT clause cannot name an item outside of the array.
    • If neither AFTER nor AT are specified, the item abuts the end of the preceding item or the start of the image.

OCCURS clause

  • The OCCURS clause (optional) specifies that there are multiple occurrences of the item. The OCCURS clause options are as follows:
    • n specifies the maximum number of occurrences of the item for a depending array and the exact number of occurrences of the item for a fixed array. The value of n can be from 1 to 32767. Space for the maximum number of occurrences is reserved in a block created by a PREPARE statement or when a block is read from a sequential file, VSAM file, or terminal.
    • The DEPENDING ON clause identifies the item or %variable that contains the current number of occurrences of this item. An item specified in this clause must be part of this image, cannot have length specified as UNKNOWN, cannot be an array element, and cannot be positioned in the image following an item defined with LEN UNKNOWN or an array defined with OCCURS UNKNOWN.
    • UNKNOWN specifies that the number of occurrences of the item is determined by the User Language request and that the IDENTIFY statement establishes the number of occurrences.

Defining a binary item

Syntax

Define binary items with this syntax:

BINARY {LEN {n | UNKNOWN} | BITS n | TO position} [BP n] [SIGNED | UNSIGNED] [ALIGN] [INITIAL {NULL | number | BLANK | ZERO}] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length as 1-4 bytes or as UNKNOWN if the length is determined by the request and the IDENTIFY statement establishes the length.
  • BITS specifies the length as 8, 16, 24, or 32 bits.
  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length or end (TO) position of the item is required unless provided in a DEFAULT statement.
  • BP (optional) specifies the number of binary places retained when a number is stored in the item and the number of places assumed present in data read from an external record. The number of places can range from zero to the number of bits defined by the length option, the maximum is 31 bits. IF BP is omitted, the default value is zero.
  • SIGNED, optional and the default, specifies that a negative number can be stored in the item in two's complement form. UNSIGNED, optional, specifies that the item is always positive and that the leftmost bit is part of the number.

    Note: If a negative number is read into an UNSIGNED BINARY item, Model 204 uses the absolute value of that number.

  • ALIGN, optional, specifies that the item is aligned as follows:
    • BINARY LEN 2 on a halfword boundary
    • BINARY LEN 4 on a fullword boundary
    • The ALIGN option is ignored for 1- and 3-byte BINARY items.

    The item is aligned by inserting a SKIP statement preceding the item so that the item's location is on the correct boundary. In arrays, a SKIP is inserted at the end of each occurrence of the array and any parent array to make the length of each occurrence a multiple of the largest aligned item in the array.

    The ALIGN option cannot be specified for an item:

    • When length is defined as UNKNOWN.
    • When location is unknown during compilation because a previously defined item specified LEN UNKNOWN or OCCURS UNKNOWN.
    • Containing an AT clause that specifies a location that is not already aligned on the proper storage boundary.
  • INITIAL (optional) defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. If this option is omitted, NULL is the default initial value.
  • The AFTER and AT clauses are mutually exclusive and optionally define the location of the item in the image. For a complete discussion, see Defining a string item.
  • The optional OCCURS clause specifies that there are multiple occurrences of the item. For a complete discussion, see Defining a string item.

Defining a packed decimal item

Syntax

Define packed decimal items with this syntax:

PACKED {LEN {n | UNKNOWN} | DIGITS n | TO position} [DP n] [SIGNED | UNSIGNED] [INITIAL {ZERO | number | BLANK | NULL}] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length as 1-8 bytes or as UNKNOWN if the length is determined by the request and the IDENTIFY statement establishes the length.
  • DIGITS specifies the length as 1-15 decimal digits.
  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length or end (TO) position of the item is required unless provided in a DEFAULT statement.
  • DP (optional) and specifies the number of decimal places to be retained when a number is stored in this item, that is, the number of places assumed present in data read from an external record. The value of n can range from 0 to 15. If this option is omitted, the default is zero.
  • SIGNED, optional and the default, specifies that the item can contain a positive or negative number. The sign stored with the number is a hexadecimal C for a positive number and D for a negative number.
  • UNSIGNED (optional) specifies that the item is always a positive number and that the sign stored with the number is a hexadecimal F.
  • INITIAL (optional) defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. If this option is omitted, the default initial value is a packed zero.
  • The mutually exclusive and optional AFTER and AT clauses define the location of the item in the image. For a complete discussion, see Defining a string item.
  • The optional OCCURS clause specifies that there are multiple occurrences of the item. For a complete discussion, see Defining a string item.

Defining a zoned decimal item

Syntax

Define zoned decimal items with this syntax:

ZONED {LEN {n | UNKNOWN} | DIGITS n | TO position} [DP n] [SIGNED | UNSIGNED] [INITIAL {ZERO | number | BLANK | NULL}] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length as 1-15 bytes or as UNKNOWN if the length is determined by the request and the IDENTIFY statement establishes the length.
  • DIGITS specifies the length as 1-15 decimal digits.
  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length or end (TO) position of the item is required unless provided in a DEFAULT statement.
  • DP, optional, specifies the number of decimal places to be retained when a number is stored in this item, that is, the number of places assumed present in data read from an external record. The value of n can range from 0 to 15. If this option is omitted, the default is zero.
  • SIGNED, optional and the default, specifies that the item can contain a positive or negative number. The sign stored with the number is a hexadecimal C for a positive number and D for a negative number.
  • UNSIGNED, optional, specifies that the item is always a positive number and that the sign stored with the number is a hexadecimal F.
  • INITIAL is optional and defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. If this option is omitted, the default initial value is zoned decimal zeros.
  • The mutually exclusive and optional AFTER and AT clauses define the location of the item in the image. For a complete discussion, see Defining a string item.
  • The optional OCCURS clause specifies that there are multiple occurrences of the item. For a complete discussion, see Defining a string item.

Defining a floating point item

Syntax

FLOAT {LEN {n | UNKNOWN} TO position [INITIAL {ZERO | number | BLANK | NULL}] [ALIGN] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length as either 4, 8, or 16 bytes or as UNKNOWN if the length is determined by the request and the IDENTIFY statement establishes the length.

    Although you can move 16-byte floating-point values between data sets and files, intermediate results and %variables inside User Language are 8 bytes long.

    Arithmetic manipulations and data conversions retain only 15 significant decimal digits in 8 bytes.

  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length or end (TO) position of the item is required unless provided in a DEFAULT statement.
  • INITIAL, optional, defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. If this option is omitted, the default initial value is a floating point zero.
  • ALIGN, optional, specifies that the item is aligned as follows:
    • FLOAT LEN 4 on a fullword boundary
    • FLOAT LEN 8 on a doubleword boundary
    • FLOAT LEN 16 on a doubleword boundary
    • The item is aligned by inserting a SKIP statement preceding the item so that the item's location is on the correct boundary. In arrays, a SKIP statement is inserted at the end of each occurrence of the array and any parent array to make the length of each occurrence a multiple of the largest aligned item in the array.

    The ALIGN option cannot be specified for an item:

    • When length is defined a UNKNOWN.
    • When location is unknown during compilation because a previously defined item specified LEN UNKNOWN or OCCURS UNKNOWN.
    • Containing an AT clause that specifies a location that is not already aligned on the proper storage boundary.
  • The AFTER and AT clauses are mutually exclusive and optionally define the location of the item in the image. For a complete discussion, see Defining a string item.
  • The OCCURS clause is optional and specifies that there are multiple occurrences of the item. For a complete discussion, see Defining a string item.

Defining an exponential notation item

Syntax

Define exponential notation items with this syntax:

EFORMAT {LEN {n | UNKNOWN} | TO position} [PAD {BLANK | character | NULL}] [STRIP | NOSTRIP] [JUSTIFY {LEFT | RIGHT}] [INITIAL {BLANK | string | ZERO | NULL}] [DIGITS n] [DP n] [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]

Where:

  • LEN specifies the length either as 1-255 bytes or as UNKNOWN if the length is determined by the request and the IDENTIFY statement establishes the length.
  • TO specifies the last byte position of the item in the image as a number from 1 to 32767. The length or end (TO) position of the item is required unless provided in a DEFAULT statement.
  • PAD, optional, defines the fill character. If a value is shorter than an item to which it is being moved, the pad character fills the remainder of the item. Padding is done on the right end of items that are left-justified and on the left end for items that are right-justified. The pad character can be a single quoted character, a hexadecimal value expressed as X'hh', or a decimal number from 1 to 255.
  • STRIP, the default, specifies that the pad character is removed if an item value is extracted from an image. NOSTRIP specifies to keep the pad characters.
  • JUSTIFY, optional, specifies whether a value is to be left- or right-justified when moved into an item by an assignment statement. The default behavior is left-justified.
  • INITIAL is optional and defines the value placed in the item by a PREPARE statement and in unused occurrences when a record is read from a sequential file, VSAM file, or terminal into an image. A single character zero is the default value.
  • DIGITS specifies the maximum number of significant digits — the total number of digits to the left and right of the decimal point. The value of n can be a number from 1 to 15.
  • DP specifies the number of digits to be placed to the right of the decimal point when a value is moved into the item.
  • The mutually exclusive and optional AFTER and AT clauses define the location of the item in the image. See Defining a string item, for a complete discussion.
  • The optional OCCURS clause specifies that there are multiple occurrences of the item. See Defining a string item for a complete discussion.

Item definition examples

An image containing various item types

IMAGE GENERAL.LEDGER.RECORD GL.RECORD.TYPE IS STRING LEN 1 GL.NUMBER IS ZONED LEN 10 DP 0 GL.INV.TYPE IS STRING LEN 2 GL.DEPRECIATION.CODE IS STRING LEN 2 GL.BOOK.VALUE IS PACKED DIGITS 9 DP 2 GL.YEARS.REMAINING IS BINARY LEN 4 GL.QUANTITY.ON.HAND IS BINARY LEN 4 GL.ITEM.SIZE IS FLOAT LEN 4 END IMAGE

Using the AT and AFTER clauses

IMAGE PRINT.DATA PRINT.LINE1 IS STRING LEN 133 DP * PRINT.CC IS STRING LEN 1 AT PRINT.LINE1 PRINT.ITEM1 IS STRING LEN 8 SKIP 2 POSITIONS PRINT.ITEM2 IS STRING LEN 7 SKIP 2 POSITIONS PRINT.ITEM3 IS STRING LEN 8 SKIP 2 POSITIONS PRINT.ITEM4 IS STRING LEN 6 PRINT.LINE2 IS STRING LEN 133 DP * AFTER PRINT.LINE1 END IMAGE

In the preceding example, PRINT.LINE2 is placed adjacent to the end of PRINT.LINE1. Without the AFTER clause, an AT clause would be required to specify the numeric position of PRINT.LINE2 in the image.

Defining arrays

An array contains multiple occurrences of a single item or a group of items.

Array definition statements

When an array is composed of a single item, the array can be defined by using the OCCURS clause on the item definition or an ARRAY statement.

When an array is composed of more than one item, the array is defined by using an ARRAY statement and is followed by definitions of the items that compose each element of the array.

None of the items in an array or subordinate array can specify LEN UNKNOWN or OCCURS UNKNOWN.

Types of arrays

The format of the ARRAY statement depends on which of the following types of arrays is being defined:

For type of array... The number of occurrences in the array is...
Fixed occurrence Constant.
Depending Constant as defined in the image, but a record that is read from a sequential file, VSAM file, or terminal or is written to a sequential file or terminal can contain a smaller number of occurrences.
Unknown Not known. The maximum number of occurrences must be specified during evaluation by using the IDENTIFY statement.

ARRAY and END ARRAY statements

You define an array with an ARRAY statement. The definitions of items and subordinate arrays follow the ARRAY statement.

You specify the end of the array with an END ARRAY statement. END ARRAY ends the definition of the array defined by the preceding ARRAY statement. In addition, an IMAGE or END IMAGE statement ends all preceding ARRAY definitions.

Defining a fixed occurrence array

A fixed occurrence array has a specified number of occurrences. Each external record read from a sequential file, VSAM file, or terminal or written to a sequential file or terminal is assumed to contain that number of occurrences.

Syntax

The format of the ARRAY statement used to define a fixed occurrence array is:

ARRAY [arrayname] OCCURS n [AFTER {itemname | arrayname} | AT {position | itemname | imagname1 | arrayname}

Where:

  • arrayname (optional) names the array. An array must be named if it is specified in the AT clause of an image definition or in the AFTER or AT clauses in an item definition.
  • n is the number of occurrences of the items in the array, which can range from 1 to 32767.
  • AFTER and AT clauses are mutually exclusive and optionally specify the location of the array in the image. See Defining a string item for detailed information.

Example

The following example of an image contains a fixed occurrence array. In this example, each element of the SALES.MONTHLY array contains the item SALES.TOTAL and five occurrences of the item SALES.BY.MODEL.

IMAGE SALES ARRAY SALES.MONTHLY OCCURS 12 SALES.TOTAL IS PACKED DIGITS 9 DP 2 SALES.BY.MODEL IS PACKED DIGITS 9 DP 2 - OCCURS 5 END ARRAY END IMAGE

The same image could be written as:

IMAGE SALES ARRAY SALES.MONTHLY OCCURS 12 SALES.TOTAL IS PACKED DIGITS 9 DP 2 ARRAY OCCURS 5 SALES.BY.MODEL IS PACKED DIGITS 9 DP 2 END ARRAY END ARRAY END IMAGE

Defining a depending array

A depending array has a fixed number of occurrences in the image, but a smaller number of occurrences can be found in records read from a sequential file, VSAM file, or terminal or records written to a sequential file or terminal.

Depending variable

A depending variable is used to specify the actual number of occurrences that exist in the record.

The depending variable is used in this manner:

  • When a record is read from a sequential file, VSAM file, or terminal into an image, the record is assumed to contain only the number of occurrences specified by the value in the depending variable. The depending variable must have a value from zero to the maximum number of occurrences in the array. The occurrences specified in the variable are moved to the image and any remaining occurrences are initialized. When an image is created by a PREPARE IMAGE statement, space in the image is allocated for the maximum number of occurrences.
  • When a record is written from an image to a sequential file or terminal, the record is assumed to contain only the number of occurrences specified by the value in the depending variable. Therefore, the record is written with all unfilled occurrences removed.

If a subordinate array has a depending variable, the value of that variable applies to all occurrences of the outer array.

Restrictions

A depending array cannot be redefined in the current image or in any other image in the block. In addition, a depending array and the AFTER or AT clause are mutually exclusive.

Syntax

The form of the ARRAY statement used for defining a depending array is:

ARRAY [arrayname] OCCURS n DEPENDING ON {itemname | %variable}

Where:

  • arrayname, optional, names the array. An array must be named if it is specified in the AT clause of an image definition or in the AFTER or AT clauses of an item definition.
  • n is the number of occurrences of the items in the array, which can range from 1 to 32767.
  • The DEPENDING ON clause names a previously defined %variable or item within the image that contains the actual number of occurrences in an input record. An item used as the depending variable cannot:
    • Be an array element
    • Vary in length, that is, be defined with LEN UNKNOWN
    • Follow any varying length item or array in the image.

Example

The following example of an image contains an array with a depending variable is shown below. In this example, SALES.MODELS contains 15 occurrences of the item SALES.MODEL.NO. Therefore, the external record can contain from 0 to 15 occurrences.

IMAGE SALES SALES.MODELS IS BINARY LEN 2 ARRAY OCCURS 15 DEPENDING ON SALES.MODELS SALES.MODEL.NO IS PACKED DIGITS 9 INITIAL 0 END ARRAY END IMAGE

If a record is read into the previous image, the number of items defined by the value of the item SALES.MODELS are moved from the record into the array. Any occurrences of SALES.MODEL.NO not filled in the array from the record are initialized to zero. Before a record is written from the SALES image to a sequential file or terminal, the number of items defined by the value of the item SALES.MODELS are moved from the array into the record. Any unused occurrences are not present in the record written to the sequential file or terminal.

Defining an unknown array

An array must be defined as unknown when you cannot determine the maximum number of occurrences until after the data moves into the image. The number of occurrences in the array is specified as UNKNOWN. During evaluation, the IDENTIFY statement is used to specify the number of occurrences in the array before any item in the array is referred to.

Syntax

The format of the ARRAY statement used for defining an unknown array is:

ARRAY [arrayname] OCCURS UNKNOWN [AFTER {itemname | arrayname} | AT {position | itemname | imaginename1 | arrayname}]

Where:

  • arrayname is required and names the array. This name is used to identify the array in IDENTIFY statements that specify the number of occurrences during evaluation.
  • The AFTER and AT clauses are mutually exclusive and optionally specify the location of the array in the image. See Defining a string item for detailed information.

Example

This example illustrates the use of unknown arrays. In this example, the number of occurrences of the array TRANSACTION is contained in the item TRANS.COUNT. Before the items TRANS.NO, TRANS.AMT, or TRANS.CUST can be referred to, the IDENTIFY statement is executed to set the number of occurrences.

TRANS.COUNT IS BINARY LEN 4 ARRAY TRANSACTION OCCURS UNKNOWN TRANS.NO IS PACKED LEN 5 TRANS.AMT IS PACKED LEN 7 DP 2 TRANS.CUST IS STRING LEN 10 END ARRAY

Referring to array elements

Individual items within an array are identified by subscripts. The subscript is enclosed in parentheses and can be any expression that evaluates to a number from 1 to the maximum size of the array.

Nested arrays

If arrays are nested, subscripts are required for each nesting level and are separated by commas. The outermost array is the first subscript.

Example

In this example, the fifth student in the second course would be referred to as COURSE.STUDENT(2,5).

IMAGE COURSE.DATA ARRAY OCCURS 20 COURSE.NUMBER IS BINARY LEN 4 COURSE.NAME IS STRING LEN 25 COURSE.INSTRUCTOR IS STRING LEN 20 COURSE.STUDENT IS STRING LEN 20 OCCURS 30 END ARRAY END IMAGE

Initialization of array values

Model 204 lets you specify multiple value assignments into array dimensions within a single User Language assignment statement by adding an asterisk (*) as the subscript value. Using the asterisk is valid for percent variable arrays and image arrays.

Example 1

The following statement sets all elements in all dimensions to 0:

%ARRAY.ITEM (*,*,*) = 0

Example 2

If an array is defined as occurs 3, occurs 4, occurs 2, %ARRAY.ITEM(*,2,*) = 9 is equivalent to the following:

%ARRAY.ITEM(1,2,1) = 9 %ARRAY.ITEM(1,2,2) = 9 %ARRAY.ITEM(2,2,1) = 9 %ARRAY.ITEM(2,2,2) = 9 %ARRAY.ITEM(3,2,1) = 9 %ARRAY.ITEM(3,2,2) = 9

Example 3

The following example prints AAA and 100:

BEGIN IMAGE TEST ARRAY OCCURS 5 PART1 IS BINARY LEN 2 PART2 IS FLOAT LEN 8 PART3 IS STRING LEN 3 OCCURS 4 PART4 IS FLOAT LEN 8 OCCURS 2 END ARRAY END IMAGE PREPARE IMAGE TEST %TEST:PART3(3,*) = 'AAA' %TEST:PART4(*,2) = 100 PRINT %TEST:PART3(3,4) PRINT %TEST:PART4(2,2) END

Example 4

The asterisk is not valid on the right side of a User Language assignment statement. The following statement is invalid and causes a compilation error:

%X = %ARRAY.ITEM(*,*,*)

Using Large Object fields with a very large array

If you have a very large array that is densely populated and not a preallocated field, you may improve performance by storing this array of data in a Large Object field.

When an array of data is used as a field that is not preallocated, then each field reference includes the overhead of walking through the record to find that fieldname(fieldoccurrence) value.

With a Large Object field, you can directly address each item using the <offset>,<length> syntax available for Large Object fields.

There is one Table B access to retrieve the Large Object descriptor, and one Table E access to read the page that your data resides on, no matter how far into the object the data resides.

There may be a substantial CPU reduction for applications that reference large arrays as Large Object data instead of holding each array entry in a field occurrence.

Cautionary usage note: Disk space utilization: Each Large Object field requires the total Large Object length rounded up to the next 6184 bytes of space.This is because Large Object data is a collection of Table E pages; you cannot allocate just part of a page.

Defining reserved space

The format of the entire block does not have to be specified in an image definition. When items are not contiguous, space must be reserved to correctly position the items.

Space is reserved automatically by an AT clause that places an item beyond the end of the last defined item.

SKIP statement

Space is reserved explicitly by using the SKIP statement. The space reserved by a SKIP statement can be initialized by a PREPARE statement but cannot be accessed.

Syntax

The format of the SKIP statement for reserving space is:

[itemname IS] SKIP n POSITION[S] [INITIAL {NULL | character | BLANK}]

Where:

  • The itemname IS clause (optional) names a reserved area that can be referred to by an AFTER or AT clause.
  • n is the number of bytes to be reserved. A maximum of 32767 bytes can be reserved.
  • The INITIAL clause indicates the character with which the area is filled by PREPARE and IDENTIFY statements. Options are as follows:
    • character — a single quoted character, a decimal number from 1 to 255, or a hexadecimal value expressed as X'hh'
    • BLANK — white spaces
    • NULL — binary zeros

    If the INITIAL clause is omitted, NULL is the default.

Example

This sample SKIP statement reserves two bytes before the next image item:

SKIP 2 POSITIONS

DEFAULT TYPE and DEFAULT SKIP statements

You can provide default values for image item options to eliminate repetition of these options on each item definition, using:

  • DEFAULT TYPE
  • DEFAULT SKIP

DEFAULT TYPE statement

The DEFAULT TYPE statement lets you set default option values for each item type. The options specified on a DEFAULT TYPE statement for an item type are applied to each item of that type defined between the default statement and the next default statement of the same item type.

Syntax

The format of the DEFAULT TYPE statement is:

DEFAULT [TYPE] type options

Where:

  • The optional TYPE keyword specifies a default data type for any item definition that does not explicitly define the data type. Without the TYPE keyword, the statement defines the default option values for an item type without defining the default item type.
  • type specifies the data type of the item. Valid values are STRING, BINARY, FLOAT, PACKED, ZONED, or EFORMAT.
  • options specifies any of the options that are valid for the item type except for the TO, AFTER, AT, and OCCURS clauses.

DEFAULT SKIP statement

The DEFAULT SKIP statement specifies the default length or initial value for a SKIP statement or an implied skip. It can appear anywhere in an image definition and remains in effect until the next DEFAULT SKIP statement.

Syntax

The format of the DEFAULT SKIP statement is:

DEFAULT SKIP n POSITION[S] [INITIAL {NULL | 'character' | BLANK}]

Where:

  • n is a positive integer that specifies the number of bytes to be reserved. A maximum of 32767 bytes can be reserved.
  • The INITIAL clause indicates the fill character for PREPARE and IDENTIFY statements. Options are as follows:
    • character — a single quoted character, a decimal number from 1 to 255, or a hexadecimal value expressed as X'hh'
    • BLANK — white space
    • NULL — binary zeros

    If the INITIAL clause is omitted, NULL is the default.

Example of DEFAULT statements

The following examples show how an image can be described without and then with DEFAULT statements.

Without DEFAULT statements

IMAGE SALES SALES.YEAR.TOTAL IS PACKED DIGITS 7 DP 2 SALES.MONTH.TOTAL IS PACKED DIGITS 7 DP 2 SALES.REP.NO IS PACKED DIGITS 5 SALES.REP.NAME IS STRING LEN 20 SALES.REP.ADDRESS.1 IS STRING LEN 20 SALES.REP.ADDRESS.2 IS STRING LEN 20 END IMAGE

With DEFAULT statements

IMAGE SALES DEFAULT TYPE STRING LEN 20 DEFAULT PACKED DIGITS 7 DP 2 * THE FOLLOWING TWO ITEMS DEFAULT TO DIGITS 7 DP 2 SALES.YEAR.TOTAL IS PACKED SALES.MONTH.TOTAL IS PACKED * DP 0 IS NECESSARY ON THE NEXT LINE IN ORDER TO AVOID * THE DEFAULT OF 2 SALES.REP.NO IS PACKED DIGITS 5 DP 0 * THE FOLLOWING 3 ITEMS DEFAULT TO STRING LEN 20 SALES.REP.NAME SALES.REP.ADDRESS.1 SALES.REP.ADDRESS.2 END IMAGE

Processing images

Once a block is defined, you can use the following statements to process external records and to manipulate a block of storage.

Statement Action undertaken
CLOSE Closes a sequential file, VSAM file, or terminal opened by the request.
IDENTIFY Defines an active image and establishes the length for items or array occurrences defined as UNKNOWN.
OPEN Opens a sequential file, VSAM file, or terminal for processing.
POSITION Specifies the next record to be read sequentially in a VSAM KSDS file.
PREPARE Initializes an image.
READ IMAGE Reads a record from a sequential file, VSAM file, or terminal.
RELEASE POSITION Terminates the browse operation established by a POSITION statement.
WRITE IMAGE Writes a record to a sequential file or to a terminal.

Key field for VSAM files

When the VSAM key is not in character format, special handling is required to supply the key in the format required by VSAM. If the key is supplied as a %variable or image item that has a numeric type, the READ IMAGE and POSITION statements attempt to convert the numeric value to string.

The suggested technique to resolve this problem is to define the image of the record with the key field defined in the format expected by VSAM and redefined as a string of the same length. The key value is moved to the key item and the string item name is provided in the READ or POSITION statement.

An example of this technique for a VSAM file that has a 4-byte binary key is illustrated below:

IMAGE VSAM.REC KEY IS BINARY LEN 4 KEY.STR IS STRING LEN 4 AT KEY . (additional items) . END IMAGE OPEN DATASET VSAMFILE IF $STATUS NE 0 THEN PRINT $ERRMSG STOP END IF %KEYVAL = $READ('KEY VALUE = ') PREPARE VSAM.REC %VSAM.REC:KEY = %KEYVAL READ IMAGE VSAM.REC FROM VSAMFILE KEY EQ %VSAM.REC:KEY.STR . . .

Close statement

The Close statement lets the request close a sequential file, VSAM file, or a terminal opened by the request.

Syntax

The format of the Close statement is:

Close {Dataset {ext-filename | %variable} | External {ext-filename | %variable} | [External] Terminal}

Where:

  • You must specify either the Dataset, External, or Terminal keyword.
  • The Dataset keyword specifies that the entity to be closed is a non-Model 204 file, that is, a sequential or VSAM file.
  • The External keyword specifies that the entity to be closed is a non-Model 204 file, that is, a sequential or VSAM file, or a terminal.
  • ext-filename specifies the name of the sequential or VSAM file to close, that is, the name used in the Open statement. Also, a %variable can provide the file name.
  • Terminal specifies that the terminal currently opened by the Open statement should be closed. Also, a %variable can supply the word Terminal.

Closing a Model 204 file

The Close statement can be used only for closing external files or terminals. To close a Model 204 file, you may use the $Close function within a User Language request, or the CLOSE command outside a request.

IDENTIFY statement

The IDENTIFY statement establishes:

  • Active image, if multiple images define the same block.
  • Length of items that were defined as UNKNOWN.
  • Number of occurrences for arrays that were defined as UNKNOWN.

Syntax

The complete syntax for the IDENTIFY statement follows. The form of the IDENTIFY statement used to perform each of these activities is then discussed in detail.

IDENTIFY {[IMAGE] imagename | %imagename:itemname LEN {n | %variable} | {%imagename:arrayname | %imagename:itemname} OCCURS {n | %variable}}

Where:

  • imagename refers to an image that was previously described in an image definition.
  • %imagename:itemname is an item that was defined with LEN UNKNOWN or OCCURS UNKNOWN.
  • The LEN clause specifies the length in bytes of the item or a %variable that contains the length. The length cannot exceed 255 bytes.
  • %imagename:arrayname is an array that was defined with OCCURS UNKNOWN.
  • The OCCURS clause specifies the number of occurrences of the item or a %variable that contains the number. The number of occurrences cannot exceed 32767.

Establishing an active image

Use the following form of the IDENTIFY statement to switch the active image to the named imaged, when multiple images define the same block:

IDENTIFY [IMAGE] imagename

The IDENTIFY statement also initializes the items, if any, that were not initialized by a previous READ IMAGE or PREPARE statement.

Note: Use the IDENTIFY statement instead of a PREPARE statement for requests in which you want to maintain data passed in an image.

Use with global images

When used with global images, the IDENTIFY IMAGE statement, can cause request termination due to either:

The IDENTIFY IMAGE statement does not refresh a global image, if a copy of that image is already in GTBL. The IDENTIFY IMAGE statement simply makes the specified image active. See Images and screen processing for a diagram showing the structure of GTBL followed by a discussion of performance considerations with respect to the definition of global objects.

Establishing lengths for UNKNOWN items

Use the following form of the IDENTIFY statement to set the length for items defined with LEN UNKNOWN:

IDENTIFY %imaginename:itemname LEN {n | %variable}

The location of an item is established when the length of every preceding variable length item and array is established. The length cannot be changed after it is defined by an IDENTIFY statement. If you must enlarge an array after the length is established, copy the image to another image where the array is larger using assignment statements.

Establishing occurrences for UNKNOWN arrays

Use the following form of the IDENTIFY statement to set the number of occurrences for arrays or items defined with OCCURS UNKNOWN:

IDENTIFY {%imagename:arrayname | %imagename:itemname} OCCURS {n | %variable}

You cannot change the number of occurrences after they are defined by an IDENTIFY statement. If you issue an IDENTIFY statement for an item whose length was previously set by an IDENTIFY statement, the request is cancelled.

You must issue a PREPARE statement before another IDENTIFY statement can be issued on the same item. If you need to enlarge an array after the number of occurrences is established, you must copy the image to another image where the array is larger using assignment.

MODIFY BUFFER statement

Function

Manages the Universal Buffer size and can also keep messages or overwrite them with a fill character.

Syntax

MODIFY BUFFER [SIZE=n | %variable [PRESERVE | NOPRESERVE]] [FILL [X'nn' | C'x'] | CLEAR]

Where:

  • BUFFER (formerly and still accepted as MQ_BUFFER) specifies the Universal Buffer area.
  • SIZE specifies the number of bytes allocated for the BUFFER area. If the value of the SIZE option enlarges or shrinks the current buffer, the buffer contents are overwritten.
  • PRESERVE specifies to retain the buffer contents. If a storage allocation error occurs, the value of 8 is set in the $STATUS return code (which is the standard WebSphere MQ value for this error).

    If the data was truncated when the buffer was shrunk, then the value of 14 for data truncation is set in $STATUS, although the operation succeeds.

  • CLEAR option, the default, specifies to overwrite the buffer with X'00'.
  • FILL option specifies a fill-character to use; for example, X'40' fills with blanks. The FILL option can also be a decimal number and/or the equals sign (=), or it can be an alpha character (C) and/or the equals sign. If a value is not specified after the keyword FILL, the default value is the CLEAR option.

    If the FILL or CLEAR option is specified, the behavior of MODIFY BUFFER statement depends on what other options are used:

    If... Then...
    FILL/CLEAR, SIZE, and NOPRESERVE are specified, or FILL is specified without SIZE Entire buffer is filled with the fill character.
    FILL/CLEAR, SIZE, and PRESERVE are specified Fill character is used to fill the new portion of the buffer after the preserved data only if the buffer size is increased.

Usage

The MODIFY BUFFER statement requires that you specify at least one option.

When you overwrite the contents of BUFFER area, the value of $BUFFER_USED is set to zero and the value of $Buffer_Position is set to one. See $BUFFER SIZE and $BUFFER_USED.

If you exceed the 2-gigabyte limit on the size of BUFFER, $STATUS returns a value of 34. A negative number or a number less than UBUFSZ is changed to UBUFSZ.

OPEN statement

The OPEN statement opens a sequential file, VSAM file, or terminal for processing.

DEFINE DATASET required

Before a VSAM file or a DOS sequential file can be opened, it must previously have been defined using the DEFINE DATASET command.

Syntax

The format of the OPEN statement is:

OPEN {[DATASET | EXTERNAL] {ext-filename | %variable} | [EXTERNAL] {TERMINAL | %variable}} FOR {INPUT [OUTPUT] | OUTPUT [INPUT] | INOUT} [PASSWORD {value | %variable}]

Where:

  • Either the DATASET or EXTERNAL keyword must be specified to open a sequential (non-Model 204) file. DATASET and EXTERNAL should not be specified for opening Model 204 files.
  • ext-filename specifies the name of external file (that is, the sequential or VSAM file) to be opened. The external file name is the name specified in the DEFINE DATASET command or, for sequential files, the OS DDNAME or CMS FILEDEF. You can provide the external file name can be provided in a %variable.
  • TERMINAL specifies that the entity to be opened is a terminal. The word TERMINAL can be provided in a %variable.
  • The required FOR clause specifies the type of I/O processing that is performed on the opened external file or terminal. An external file or terminal must be at least opened for INPUT to be read into an image and opened for OUTPUT to write data from an image.

    The INPUT OUTPUT, OUTPUT INPUT, and INOUT combination options are valid only for the TERMINAL keyword.

  • The PASSWORD clause is required for only password protected VSAM data sets. The clause generates an error when used with an OPEN TERMINAL statement, but is ignored in all other cases.

    With the PASSWORD clause, the password can be specified directly or can be provided as the value of a %variable. Password validation is performed during evaluation and is not checked during compilation.

Usage notes

OPEN statement in remote context

This form of the OPEN statement is not supported in remote context. Using the AT keyword with any of the keywords DATASET, EXTERNAL, or TERMINAL generates the following error message, which is not displayed on the terminal, but can be retrieved with the $ERRMSG function:

M204.1497: REMOTE SPECIFICATION CONFLICTS WITH OPEN TYPE

If the DATASET or EXTERNAL keyword is not specified and an entity is opened other than a terminal, Model 204 searches for the name of the file in the following order:

  1. Model 204 temporary groups
  2. Model 204 permanent groups
  3. Model 204 files

This search order is consistent with the search order that Model 204 uses at command level for the OPEN command.

Opening non-Model 204 data sets from within procedures

If a User Language procedure attempts to open an already open non-Model 204 data set at evaluation time, Model 204 softly restarts the user with the following counting error message:

M204.2153 DATASET name IS ALREADY OPEN

Clearing messages

An OPEN statement automatically clears $FSTERR and $ERRMSG. You can also clear the messages accessed by $FSTERR and $ERRMSG, using the $ERRCLR function; for more details, see $ERRCLR.

POSITION statement

The POSITION statement specifies the next record to be read sequentially in a VSAM KSDS file. An established position is used by the READ NEXT statement to locate the next record to be returned. A new position can be established at any time by executing another POSITION statement.

This POSITION statement is not to be confused with the POSITION statement used to recall a position in a found set or list which has been saved using the REMEMBER option during FOR loop processing. See POSITION statement.

Syntax

The format of the POSITION statement is:

POSITION {ext-filename | %variable} AT KEY operator {value | %variable}

Where:

  • ext-filename is the name of the VSAM file specified in the OPEN statement. The name can be provided as the value of a %variable.

    If ext-filename is provided as a literal, it cannot be the name of a found set or list.

  • operator specifies that the key of the record to be retrieved must be equal to or greater than or equal to the specified value. Valid operators are: =, >=, EQ, or GE.
  • value specifies the key at or beyond which the file is positioned for subsequent reads. The key can be provided as the value of a %variable.

    If value is a null string, a key of binary zeros is substituted. The first record in the file is returned if the operator is >= or GE. If the operator is = or EQ, a record is found only if it has a key of all binary zeros.

    If the length of value is less than the length of the VSAM key, the key is treated as generic. A generic key search is satisfied when the value matches the same number of characters at the beginning of the VSAM key. The portion of the VSAM key that is longer than the value is ignored in the comparison.

    If the VSAM key is not a character string, special handling is required. For information on how to specify the key when the key is not a string, refer to Key field for VSAM files.

PREPARE statement

The PREPARE statement initializes an image and makes it the active image. This is required when image items are accessed prior to reading an external record into the image. PREPARE initializes the block associated with the image with the values specified in the INITIAL clauses of the item definitions or DEFAULT statements.

Previous identifications of lengths of items defined as length UNKNOWN or number of occurrences of arrays defined with OCCURS UNKNOWN are lost. The IDENTIFY statement must be executed again to establish length or number of occurrences.

Syntax

The format of the PREPARE statement is:

PREPARE [IMAGE] imagename

where imagename refers to an image that was previously described in an image definition. The keyword IMAGE is required if imagename is IMAGE, MENU, or SCREEN.

Use with global images

The PREPARE IMAGE statement, when used with global images, can cause request termination due to either:

READ IMAGE statement

Purpose

The READ IMAGE statement reads a record from a sequential or VSAM file or terminal into the image and sets the image as the active image. Or, the READ IMAGE statement reads the contents of the Universal Buffer.

Syntax

READ [IMAGE] imagename FROM [BUFFER [POSITION={%pvariable | n}] {MAXLEN={%lvariable | n}]] | [{ext-filename | TERMINAL | %variable} [PROMPT {'text' | %variable}] [NEXT | KEY operator {value | %variable}]]

Where:

  • imagename is an image that was previously described in an image definition. The keyword IMAGE is required if imagename is IMAGE, MENU, or SCREEN. imagename also specifies a message to read in the Universal Buffer area.
  • The FROM clause determines which use of the READ IMAGE statement to employ:
    • Reading Large Object data from the Universal Buffer
    • Reading from a sequential file or the terminal
  • BUFFER (formerly, and still accepted as MQ_BUFFER) specifies the Universal Buffer area.
  • POSITION must be in the range 1-16,777,216. If not, the operation returns $STATUS=10 and $STATUSD=20 return codes. %pvariable or n specifies where in the buffer to begin reading.

    If POSITION=%pvariable is specified and %pvariable is greater than $BUFFER_USED, the operation returns $STATUS=10 and $STATUSD=20.

    The starting position in the buffer is determined by POSITION=%pvar, if that was specified; $BUFFER_POSITION, otherwise.

    The ending position in the buffer is determined by the lowest of starting position, plus %lvariable, if MAXLEN=%lvariable was specified as the value of $BUFFER_USED.

  • MAXLEN=%lvariable specifies the maximum number of bytes to copy into the image. The actual number copied might be less than that, either because the number of bytes available in the BUFFER area (from the starting position) is less, or because the size of the image is less.

    MAXLEN must be in the range 1-32,767. If not, the operation returns $STATUS=10 and $STATUSD=19.

  • ext-filename specifies that records are read from a previously opened sequential or VSAM file. The name of the file can be provided as the value of a %variable.
  • TERMINAL specifies that records are read from the terminal. The word TERMINAL can be provided as the value of a %variable.
  • The optional PROMPT clause is used with only the TERMINAL option. It specifies to display a prompt sign before the READ is performed. Prompting is especially useful for synchronizing communication between the User Language request and Host Language program.

    The PROMPT string can be as many as 255 characters. The string can be provided as a string type %variable.

  • The NEXT option reads the next record in the file. NEXT is the default, if the KEY clause is omitted. A READ IMAGE statement with the NEXT option can be executed only following an OPEN, POSITION, or READ NEXT statement.
  • The KEY clause identifies the record to read. The KEY clause is valid only for VSAM files and the value is converted to a string. A READ IMAGE statement with the KEY clause automatically performs a RELEASE POSITION.

    Key clause options are operator and value:

    • operator specifies that the key of the record to be retrieved must be equal to or greater than or equal to the specified value. Valid operators are: =, >=, EQ, or GE.
    • value is the key that locates the record. It can be supplied in a %variable.

      If the value is a null string, a key of binary zeros is substituted. The first record in the file is returned, if the operator is >= or GE. If the operator is = or EQ, a record is found only if it has a key of all binary zeros. If the length of the value is less than the length of the VSAM key, the key is treated as generic. A generic key search is satisfied when the value matches the same number of characters at the beginning of the VSAM key. The portion of the VSAM key that is longer than the value is ignored in the comparison.

    If the VSAM key is not a character string, special handling is required. For information on how to specify the key when the key is not a string, refer to Key field for VSAM files.

Usage

This statement is valid only if the file or terminal from which the record is read is currently open for INPUT, INPUT OUTPUT, or INOUT. READ IMAGE processing reads data until the Universal Buffer is exhausted, or the image is filled.

The part of the message selected is copied from BUFFER area to the image:

  • Contents of the BUFFER area are unchanged.
  • $BUFFER_USED is unchanged.
  • $BUFFER_POSITION is set to the byte after the last byte copied.
  • No error indication is given, if the image is not big enough to hold the data.

BUFFER area positioning

If POSITION is specified:

  • Numeric value, expressed as either a constant or variable, indicates where in the buffer to begin reading; the count starts from 1.
  • Beyond the end of the data, then the image is unchanged; READLEN is set to 0.
  • If the value is nonnumeric, less than one, or beyond the end of the data, then the statement fails with a nonzero $STATUS value.

If the POSITION option is not specified:

  • Data is extracted from the buffer at the point where the last READ left off, or from the beginning of the buffer if this is the first READ after any other statement (including WebSphere MQ statements).
  • Once the buffer has been emptied, subsequent READ statements that do not specify POSITION set READLEN to 0, and leave the target image unchanged.

After a READ IMAGE statement is issued, use the value of READLEN to determine how many bytes were actually copied. If no bytes were copied, READLEN=0.

The bytes in the image at offsets higher than the READLEN value are unchanged.

To determine the number of bytes remaining, use the following formula:

bytes remaining = ($BUFFER_USED - $BUFFER_POSITION + 1)

Record positioning

If no position has been set prior to a READ NEXT, the position is assumed to be at the beginning of the file.

The record is positioned in the image according to the following rules:

  • If the record is longer than the image, the record is truncated.
  • If the record is smaller than the image, items beyond the end of the data are filled with the INITIAL value. An item that is partially filled by the input data is filled with the pad character for STRING and EFORMAT items and with binary zeros for BINARY, PACKED, ZONED, and FLOAT items.
  • When there are arrays with depending variables, each such array is filled with the number of elements specified in the depending variable. The remainder of the array is initialized according to the INITIAL clauses. The remaining data is move to the image following the array.
  • If the length of the image is unknown because items or arrays have length or number of occurrences specified as UNKNOWN, the block is filled with as much of the external record as fits in the remaining physical buffer space.

Length of the external record

The length of the external record is stored in the variable %imagename:READLEN.

Previous identifications of lengths of items defined as length UNKNOWN or number of occurrences of arrays defined with OCCURS UNKNOWN are lost. The IDENTIFY statement must be executed again to establish length or number of occurrences.

RELEASE POSITION statement

The RELEASE POSITION statement terminates a browse operation established by a POSITION statement.

Execution of a RELEASE POSITION statement releases the VSAM string that maintains the current position in the file. The number of these strings is limited, and freeing the string as soon as the browse is finished allows other users to access the file.

Note: A POSITION statement automatically is released by another POSITION statement, a READ IMAGE statement with a KEY clause, a CLOSE statement, or the end of the request.

Syntax

The format of the RELEASE POSITION statement is:

RELEASE POSITION {ext-filename | %variable}

Where:

ext-filename is the name of the external file used in the POSITION statement. A %variable also can be used to supply the external file name.

WRITE IMAGE statement

Purpose

The WRITE IMAGE statement loads data into the Universal Buffer or writes an active image to a sequential file or to the terminal.

Syntax

The format of the WRITE IMAGE statement is:

WRITE [IMAGE] imagename ON [BUFFER [POSITION=%pvariable | n] [MAXLEN={%lvariable | n}]] | {seq-filename | TERMINAL | %variable}

Where:

  • imagename specifies a message to place in the message buffer.
  • The ON clause determines which use of the WRITE IMAGE statement to employ: writing to a sequential file or the terminal or writing Large Object data to the Universal Buffer.
  • BUFFER (formerly, and still accepted as MQ_BUFFER) specifies the Universal Buffer area.
  • %pvariable or n specifies where in the buffer to start the placement.
  • POSITION must be in the range 1-16,777,216. If not, the operation returns $STATUS=10 and $STATUSD=20.

    The starting position in the buffer is determined by:

    • POSITION=%pvariable, if that was specified.
    • $BUFFER_POSITION, otherwise.
  • MAXLEN=%lvariable specifies the maximum number of bytes to copy from the image. The actual number copied is less than %lvariable, if the size of the image is less.

    MAXLEN must be in the range 1-32,767. If not, the operation returns $STATUS=10 and $STATUSD=19. The amount of data to copy is determined by:

    If MAXLEN=%lvar is Then copy...
    Not specified Current length of the image.
    Specified Lesser of %lvariable and the current length of the image.
  • seq-filename specifies the name of the sequential file to which the image should be written. A %variable also can be used to supply the name of the sequential file.
  • TERMINAL specifies that the image should be written to the terminal. A %variable also can be used to supply the word TERMINAL.

    If you specify the TERMINAL option on the WRITE IMAGE statement, data type translation is not performed for the terminal output.

Usage

The WRITE IMAGE statement is valid only if the file or terminal from which the record is read currently is open for OUTPUT, OUTPUT INPUT, or INOUT values.

Note: When the WRITE IMAGE statement is used for a depending array, unused occurrences of the array are eliminated from the output.

If an MQPUT or MQPUT1 statement is issued with the BUFFER option, the buffer must contain a message, otherwise the operation fails with a nonzero $STATUS value.

If the last WebSphere MQ operation was a successful put or get, then an MQPUT or MQPUT1 statement with the BUFFER options puts the message most recently processed. In all other cases, at least one WRITE IMAGE imagename ON BUFFER statement must have been issued.

Note: Issue an MQPUT statement with the BUFFER option after a WRITE IMAGE imagename ON BUFFER statement, otherwise $STATUS indicates there is no data in the buffer.

Image positioning

The data in the image is loaded into the buffer. Where the data is placed in the buffer depends on whether the POSITION option was specified.

If POSITION was not specified:

  • On the first such WRITE IMAGE after any other User Language statement or WebSphere MQ statement, the data is loaded starting in the first-byte position in the buffer.
  • On subsequent WRITE IMAGE statements, data is loaded immediately following the data from the most recent WRITE.

If POSITION is specified as:

  • Numeric value, expressed as either a constant or variable that indicates where in the buffer to begin to place the data, then the count starts from 1.
  • Nonnumeric, less than one, or larger than the current size of the buffer, then the statement fails with a nonzero $STATUS value.

The ending position in the buffer is determined by the starting position, plus the amount of data to copy.

If the size of the user's BUFFER area is less than the ending position, the existing BUFFER area is expanded to a size equal to the ending position (data within the BUFFER area is preserved).

The data is copied from the image to the BUFFER area:

  • $BUFFER_POSITION is set to the byte after the last byte copied.
  • $BUFFER_USED is set according to the following rule: if data was written past the previous $BUFFER_USED point, then $BUFFER_USED is the point written to by the WRITE IMAGE; otherwise, it is unchanged.

Error handling

Error conditions encountered during the processing of image I/O statements — CLOSE, OPEN, POSITION, READ IMAGE, RELEASE POSITION, and WRITE IMAGE — generate Model 204 error messages that are not displayed on the terminal.

The request should check for errors after the execution of each I/O statement by using the $STATUS function. The text of the most recently issued error message then can be retrieved by using the $ERRMSG function. Refer to $ERRCLR and $STATUS for more information.

$STATUS return codes

The values that can be returned by $STATUS are listed below:

Code Description
0 The operation was successful. A return code of 0 also clears the message buffer. Therefore, the $ERRMSG function, if called, returns a null string.
1

Either an end of file was detected by a READ NEXT statement or a matching key was not found for the criteria specified in a READ KEY or POSITION statement.

This code is only a warning; the request continues but cannot refer to the image before the next READ KEY or POSITION statement.

2

A serious error has occurred such as an OPEN statement failure or an attempt to access an unopened file. The request continues, but the statement that generated the status code has not completed successfully.

The failed statement cannot set an image active, resulting in the cancellation of the request if the image is referred to before being set active.

The error that occurred can be retrieved by using the $ERRMSG function to obtain the last counting or cancellation error message produced by Model 204.

Detecting ABEND codes in User Language

When Model 204 intercepts an ABEND, the ABEND code and reason code are saved in the user's KOMM and can be accessed by the $STATUS and $STATUSD $functions. The values of $STATUS and $STATUSD are set as follows:

$function Value Where
$STATUS System ABEND code System code is not zero
$STATUS User ABEND code User code is not zero
$STATUS 255 (X'FF') ABEND code => X'F00'
$STATUSD Concatenated values of the $STATUS values:

sss is the system ABEND code

uuu is the user ABEND code

rr is the ABEND reason code

If the ABEND is related to a communications I/O error, the SNA Communications Server (formerly VTAM), LU 6.2, or TCP/IP error routines set $STATUS and $STATUSD with the result of the Terminal I/O and so override the ABEND code information.

Note: It is possible to get an ABEND code of all zeros. Some IBM system routines terminate with an ABEND U000 when they are invoked without APF authorization.

The ABEND code is not available in the z/VSE environment.

Sample requests

This section presents three examples illustrating the use of images in a request.

Using the READ KEY facility

The following request illustrates the use of the READ KEY facility. The printed record is the one with a VSAM key equal to a user-specified value.

BEGIN IMAGE EMP.REC CODE IS STRING LEN 8 JOB.DESC IS STRING LEN 50 NUM IS STRING LEN 7 DP * END IMAGE OPEN DATASET VSAMDS1 FOR INPUT IF $STATUS NE 0 THEN PRINT $ERRMSG STOP END IF PROMPT: %KEY = $READ('ENTER KEY') IF %KEY = 'END' THEN JUMP TO EXIT END IF READ IMAGE EMP.REC FROM VSAMDS1 KEY EQ %KEY IF $STATUS EQ 1 THEN PRINT 'RECORD NOT FOUND' ELSEIF $STATUS EQ 2 THEN PRINT $ERRMSG JUMP TO EXIT ELSE PRINT 'CODE = ' WITH %EMP.REC:CODE PRINT 'JOB DESCRIPTION = ' WITH - %EMP.REC:JOB.DESC PRINT 'NUMBER = ' WITH %EMP.REC:NUM END IF JUMP TO PROMPT EXIT: CLOSE DATASET VSAMDS1 END

The preceding request could be rewritten in the manner shown in Example 2 to print information from ten successive records of the VSAM file.

Using a POSITION statement

The starting position in this example is established in the file through the use of the POSITION statement and a user-specified key.

BEGIN IMAGE EMP.REC CODE IS STRING LEN 8 JOB.DESC IS STRING LEN 50 NUM IS STRING LEN 7 DP * END IMAGE OPEN DATASET VSAMDS1 FOR INPUT IF $STATUS NE 0 THEN PRINT $ERRMSG STOP END IF PROMPT: %KEY = $READ('ENTER KEY') IF %KEY = 'END' THEN JUMP TO EXIT END IF POSITION VSAMDS1 AT KEY GE %KEY FOR %CT FROM 1 TO 10 READ IMAGE EMP.REC FROM VSAMDS1 IF $STATUS EQ 1 THEN PRINT 'END OF FILE' JUMP TO PROMPT ELSEIF $STATUS EQ 2 THEN PRINT $ERRMSG JUMP TO EXIT ELSE PRINT 'CODE = ' WITH %EMP.REC:CODE PRINT 'JOB DESCRIPTION = ' WITH - %EMP.REC:JOB.DESC PRINT 'NUMBER = ' WITH %EMP.REC:NUM END IF END FOR JUMP TO PROMPT EXIT: CLOSE DATASET VSAMDS1 END

Example

The following request reads a sequential file that contains output from a previously issued PRINT ALL INFORMATION (PAI) statement. The foundset data is now in a data set. The request also handles non-PAI lines that might be found in the sequential file as separators; see the sample output that follows. The file being processed in this request contains PAI data for a CENSUS file.

BEGIN IMAGE PAI LINE IS STRING LEN 255 FIELDNAME IS STRING AT LINE LEN UNKNOWN SKIP 3 POSITIONS VALUE IS STRING LEN UNKNOWN END IMAGE OPEN DATASET OUTTAPE2 FOR INPUT IF $STATUS EQ 1 THEN JUMP TO DONE ELSEIF $STATUS EQ 2 THEN PRINT 'OPEN ERROR: ' WITH $ERRMSG STOP END IF READ: READ PAI FROM OUTTAPE2 IF $STATUS EQ 1 THEN JUMP TO DONE ELSEIF $STATUS EQ 2 THEN PRINT 'READ ERROR: ' WITH $ERRMSG STOP END IF %A = $INDEX(%PAI:LINE,' = ')-1 IF %A GE 0 THEN %B = %PAI:READLEN-%A-3 IDENTIFY %PAI:FIELDNAME LEN %A IDENTIFY %PAI:VALUE LEN %B PRINT 'FIELD= WITH %PAI:FIELDNAME WITH ' - WITH 'VALUE= AT 35 WITH %PAI:VALUE WITH ' ELSE PRINT %PAI:LINE END IF JUMP TO READ DONE: PRINT 'END OF INPUT FILE' END

The preceding request generates output in the format illustrated below. (This is the recommended format for file reorganization, as discussed in File reorganization and table compaction.)

* FIELD='HOUSEHOLD ID' VALUE='53690' FIELD='AGE' VALUE='21' FIELD='OCCUPATION' VALUE='CLERK' FIELD='SEX' VALUE='FEMALE' FIELD='PLACE SIZE' VALUE='50000' FIELD='RELATION' VALUE='UNRELATED' FIELD='FATHERS BIRTHPLACE' VALUE='UNITED STATES' FIELD='MOTHERS BIRTHPLACE' VALUE='UNITED STATES' FIELD='BIRTHPLACE' VALUE='NORTH CENTRAL REGION' FIELD='MOTHER TONGUE' VALUE='ENGLISH' FIELD='SCHOOL' VALUE='4 YEARS HIGH SCHOOL' FIELD='ROOMS' VALUE='GROUP QUARTERS' FIELD='FAMILY SIZE' VALUE='NOT IN A FAMILY' * FIELD='HOUSEHOLD ID' VALUE='42860' FIELD='AGE' VALUE='36' FIELD='OCCUPATION' VALUE='SALESMAN' FIELD='SEX' VALUE='MALE' FIELD='PLACE SIZE' VALUE='50000' FIELD='RELATION' VALUE='HEAD' FIELD='FATHERS BIRTHPLACE' VALUE='UNITED STATES' FIELD='MOTHERS BIRTHPLACE' VALUE='UNITED STATES' FIELD='BIRTHPLACE' VALUE='SOUTHERN REGION' FIELD='MOTHER TONGUE' VALUE='ENGLISH' FIELD='SCHOOL' VALUE='1-3 YEARS COLLEGE' FIELD='ROOMS' VALUE='4' FIELD='FAMILY SIZE' VALUE='4' END OF INPUT FILE