Information
Space announcement: BMC provides limited support for this version of the product. As a result, BMC no longer accepts comments in this space. If you encounter problems with the product version or the space, contact BMC Support.

INSERT


The INSERT primary command provides the capability to insert an occurrence of the specified segment into a database. CHILD is not a valid object keyword with INSERT. Multiple INSERT primary commands can be specified in a single execution.

image2021-3-11_11-51-54.png

MAXIMUM

Defines the number of segments to insert. See MAXIMUM Keyword for a complete description of this keyword.

number Number of segments to insert. Valid only with segments that have non-unique keys or are unkeyed.

If specified on non-unique segments:

  • MAX can specify a number greater than 1.
  • The segments with the same data values are inserted the specified number of times.

If specified on keyed unique segments, MAX cannot specify a number greater than 1.

SET

Defines the initial values for specific segment fields to be inserted through the specification of COBOL, PL/I, or DBD field names. See SET Keyword for a complete description and examples of how to use the SET keyword.

For information about the processing of variable length segments, see Variable Length Segments.

Examples

The following INSERT statement inserts a customer segment into the customer database. Fields not supplied in the SET keyword are initialized to the default value for the field type.

TYPE   RUN;
PSB    PCB=4 XREF=CUSTXREF;
TITLE  LINE01=’INSERT NEW CUSTOMER WITH CUSTOMER NUMBER 11573’;
INSERT SEGMENT=CUSTOMER
         SET=(CUST-NUMBER=11573,
              CUST-NAME=’PARADISE VALLEY CONSTRUCTION, INC.’,
              CUST-STATUS=A,
              CUST-SALES-ZONE=8,
              CUST-SALES-REGION=22,
              CUST-TOTAL-SALES=1234500,
              CUST-PRODUC-IND=X’B3’); 

The following statement inserts one customer segment and a customer address segment using the input PDS member ISRTCUST.

TYPE   RUN;
PSB    PCB=2 XREF=CUSTXRF2 LANG=PLI;
TITLE  LINE01=’INSERT NEW CUSTOMER AND CUSTOMER ADDRESS’;
SET    INPUT=ISRTCUST;
INSERT SEGMENT=CUSTOMER MAX=1
         SET=(CUST_NUMBER=INPUT(10,6,C),
              CUST_NAME=INPUT(16,32,C),
              CUST_SALES_INFO=INPUT(48,52,C))
       SEGMENT=CUSTADDR
         SET=(CUST_ADDR_KEY=INPUT(100,4,C),
              CUST_ADDR_ADDRESS=INPUT(104,40,C)); 

The following statements delete customer 10529 and all its children and then inserts the customer segment.

TYPE   RUN;
PSB    DBNAME=CUSTPDBD;
TITLE  LINE01=’DELETE CUSTOMER 10529 AND THEN REINSERT CUSTOMER 10529’;
SELECT SEGMENT=CUSTOMER
         WHERE CUST-NUMBER=10529
  DELETE SEGMENT=CUSTOMER
INSERT SEGMENT=CUSTOMER OPTION=PATH
         SET=(CUST-NUMBER =10529,
              CUST-NAME=’ALL-STAR CARPET CLEANING’);

Related topics

 

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

BMC Compuware File-AID for IMS 21.01