INSERT (edit only)


The INSERT command enables you to insert a single occurrence of any segment type into a database.

image2021-8-12_12-37-30.png

If you do not specify a SEGMENT-NAME operand with the INSERT command, File-AID for IMS inserts a new occurrence of the current segment type.

If you do specify a SEGMENT-NAME operand, it must be one of the segment types in the primary DBD. When specified, the RCD-TYPE-VALUE-1 operand must occur in the operand list before the RCD-TYPE-VALUE-2 operand. The RCD-TYPE-VALUE operands can optionally be delimited by apostrophes or quotation marks. The format X’nnnn...’ can be used to enter the HEX representation of rcd-type-values.

Once File-AID for IMS completes its initial validation of the INSERT command, the Key Specification screen is displayed. On this screen, you can specify the fully concatenated key of the new segment that is to be inserted along with the new segment’s data fields (see Key Specification). When you leave the KEY Specification screen, the new segment is inserted, and you are returned to the Formatted screen with the new segment as the current segment.

Inserted segments are initialized on the Key Specification screen, field by field, based on the appropriate segment layout. Alphanumeric fields are initialized with blanks (HEX 40s). Numeric fields are initialized with zero in the appropriate format (for example, packed zero, binary zero, etc.). Unicode character fields are initialized with blanks (hex '0020's) and Unicode numeric fields are initialized with zeros (hex '0030's).

COBOL

The half-byte that contains the sign in packed decimal fields, without the SIGN...SEPARATE CHARACTER clause, is set to C for signed fields and F for unsigned fields. The sign character in zoned decimal fields with the SIGN...SEPARATE CHARACTER clause is set to +. COMP-1, COMP-2, and index fields are initialized with HEX zeros. Unicode numeric fields containing a sign must have the "SIGN...SEPARATE CHARACTER" clause and is set to "+" (hex '002B').

PL/I

The half-byte that contains the sign in packed decimal fields and zoned decimal fields without the S picture character is set to C. The sign character in zoned decimal fields with the S picture character is set to +. Float Binary, Float Decimal, Pointer, and BIT fields are initialized with HEX zeros.

The segment layout used in the initialization process is determined by the type of segment you are inserting. A segment defined by a single segment layout is referred to as a single record type segment. A segment defined by multiple segment layouts is referred to as a multiple record type segment.

When you insert a single record type segment, you cannot specify RCD-TYPE-VALUE-1 and 2 operands. The single segment layout specified in the segment/layout cross-reference for the segment being inserted is used to initialize the new segment. If a segment layout is not specified in the segment/layout XREF for the segment being inserted, the non-key field data in the segment is initialized with blanks (HEX 40s).

When you insert a multiple record type segment, the specification of the INSERT command operands is determined by your current segment position, as follows:

  • When positioned on an occurrence of the segment type that you want to insert, you need not specify any INSERT command operands. File-AID for IMS initializes the new segment on the KEY Specification screen using the segment layout for the current segment. The rcd-type-value-1 and 2 field values from the current segment are copied into the new segment and the new segment is inserted. The newly inserted segment becomes the new current segment.
  • If you do specify RCD-TYPE-VALUE-1 and 2 operands, File-AID for IMS verifies that the operands are valid values specified in the segment/layout XREF. File-AID for IMS initializes the new segment on the Key Specification screen based on the segment layout specified in the segment/layout XREF. The rcd-type-value-1 and 2 values you enter are pre-formatted into the new segment. The new segment is inserted into the database and becomes the new current segment.
  • If the RCD-TYPE-VALUE-1 and 2 operands you specify do not exist in the segment/layout XREF but a default or other segment layout was specified in the XREF, the default segment layout is used to initialize the new segment on the Key Specification screen. The rcd-type-value-1 and 2 values you enter are preformatted into the new segment. The new segment is inserted in the database and becomes the new current segment.
  • When your current position is on any segment type other than the one you want to insert, you must enter the SEGMENT-NAME operand. Anytime you enter the SEGMENT-NAME operand for a multiple record type segment while in formatted mode you must also enter RCD-TYPE-VALUE-1 and 2 operand values. File-AID for IMS then initializes the new segment on the Key Specification screen based on the segment layout specified in the segment/layout XREF and pre-formats the rcd-type-value-1 and 2 field values as described above, inserts the segment, and positions on it.

Important

Although the RCD-TYPE-VALUE-1 and 2 operands were described together in the preceding paragraphs, you can have multiple record type segments that are defined with only rcd-type-value-1 values. See Segment/Layout Cross-Reference for a complete explanation of the use of record type values.

The segment layout used to initialize a segment can also affect the length assigned to the segment. When inserting a fixed length segment, the length assigned is always the length defined for the segment in the DBD. If the segment layout assigned to the fixed length segment is shorter than the segment, the message LAYOUT TOO SHORT is displayed, and the segment is not inserted. If the segment layout is longer than the segment, the message LAYOUT TOO LONG is displayed, and the segment is not inserted.

When inserting a variable length segment, the associated segment layout is validated to verify that its length is within the segment length range defined in the DBD. If the layout is shorter than the minimum segment length or longer than the maximum segment length, the insert is not performed. If the segment layout length is valid, its length is assigned to the inserted segment.

Inserting a Single Record Type Segment (Unformatted Mode)

In Unformatted mode, the INSERT command works the same as described on here for a single record type segment (one defined by a single segment layout), except that an unformatted insert is performed. In an unformatted insert, all nonkey field data is initialized with blanks (HEX 40s) on the Key Specification screen.

When inserting a fixed length single record type segment, the length assigned is always the length defined for the segment in the DBD.

When inserting a variable length single record type segment, the length assigned is always the minimum length defined for the segment. The existence or validity of a segment layout for a single record type segment has no impact in Unformatted mode.

Inserting a Multiple Record Type Segment (Unformatted Mode)

When inserting a multiple record type segment (one defined by multiple segment layouts) in Unformatted mode, specification of the INSERT command operands is determined by your current segment position, as follows:

  • When positioned on an occurrence of the segment type that you want to insert, you need not specify any INSERT command operands. File-AID for IMSperforms an unformatted insert. Because the new segment contains blanks instead of valid record type values (unless you defined blanks as valid record type values in the segment/layout XREF or entered valid record type values on the Key Specification screen), no segment layout is associated with the new segment. If you switch to Formatted mode while positioned on this segment, a blank screen body with an error message is displayed.
  • If you do specify RCD-TYPE-VALUE-1 and 2 operands, File-AID for IMS verifies that the operands are valid values specified in the segment/layout XREF. File-AID for IMS initializes the new segment on the Key Specification screen based on the segment layout specified in the segment/layout XREF. The record type values you enter are pre-formatted into the new segment before the segment is inserted.
  • If the RCD-TYPE-VALUE-1 and 2 operands you specify do not exist in the segment/layout XREF but a default (or other) segment layout has been specified in the XREF, File-AID for IMS uses the default segment layout to initialize the new segment on the Key Specification screen. The record type values you enter are pre-formatted into the new segment before the segment is inserted.
  • When your current position is on any segment type other than the segment type you want to insert, you must enter the SEGMENT-NAME operand. Specification of the RCD-TYPE-VALUE-1 and 2 operands is optional.File-AID for IMS performs the insert in the same way described above, whether or not record type value operands are entered.

Important

Although the RCD-TYPE-VALUE-1 and 2 operands were described together in the preceding paragraphs, you can have multiple record type segments that are defined with only rcd-type-value-1 values. See Segment/Layout Cross-Reference for a complete explanation of the use of record type values.

When inserting a fixed length multiple record type segment, the length assigned is always the length defined for the segment in the DBD. Because formatted inserting is performed for a multiple record type segment while in Unformatted mode, the associated segment layout must pass validation before the insert is completed. If the layout is shorter than the segment, the error message LAYOUT TOO SHORT is displayed. If the layout is longer than the segment, the error message LAYOUT TOO LONG is displayed. In both instances, the insert is not performed.

When inserting a variable length multiple record type segment, the length assigned depends on the segment layout associated with the segment. The segment layout is validated to verify that its length is within the segment length range. If the layout is shorter than the minimum segment length or longer than the maximum segment length, the insert is not performed. If the layout length is valid, its length is assigned to the new segment occurrence.

Additional information on how variable length segments can be edited in Unformatted mode is presented on here.

Adding DBDs to Segment/Layout XREF

During insert processing all segments defined in the DBD are added to the XREF. The newly inserted DBD is added in alphabetical order by DBD name and the XREF Segment List screen is automatically scrolled to the inserted DBD. The segment names defined in the DBD are prefilled in the Segment field of the screen. Because concatenated and logical child segments are automatically identified during insert processing, *CONCAT* or *LCHILD* is displayed in the Member field for those segments. Otherwise, the segment names defined in the DBD are prefilled in the Member field. How to specify segment layout information for concatenated and logical child segments and segments with multiple formats is described in Segment/Layout Cross-Reference.

You must define only one DBD member per XREF member that matches the XREF member name with the DBD member name.

image2021-8-12_12-39-47.png

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*