Objective
This example updates customer numbers by replacing the rows in the NEW-CUSTOMERS table with data read in from a sequential file. Note that the type 5 parameters must match the column definitions for the CUSTOMER-LIST table.
Parameters
IN 80 defines an 80-byte sequential file containing the new customer numbers.
05OUTPUT TABLE=NEW- CUSTOMERS TYPE=REPLACE USER=DOC1 PW=DOC1 * CATALOG=ASFDICT
OUTPUT identifies the OUTPUT parameter, which includes the REPLACE instruction.
TABLE=NEW-CUSTOMERS names the table in which data is replaced.
TYPE=REPLACE replaces existing table rows with new data.
0551*001 CUST-NUMBER 0551*002 CUST-NAME 0551*003 CUST-ADDRESS
1, 2, and 3 define three table columns.
Complete Code
col. 2 ▼ IN 80 REC CUST-NUMBER 1 5 2 REC CUST-NAME 6 20 REC CUST-ADDRESS 26 42 05OUTPUT TABLE=NEW-CUSTOMERS TYPE=REPLACE USER=DOC1 PW=DOC1 * CATALOG=ASFDICT 0551*001 CUST-NUMBER 0551*002 CUST-NAME 0551*003 CUST-ADDRESS
Results
Previous contents of NEW-CUSTOMER:
25060SUSAN ARMITAGE 56725 OAK STREET PITTSFIELD MA02956 27056ALLEN KOHN 22651 POLK STREET SAN FRANCISCO CA09809 39557HENRY TRUMBLE 2102 WASHINGTON ST BROOKLINE MA02147 30415MARY SMYTH 5999 SANDY LANE LONG BEACH CA09743 33480VICKY KNIGHT 5678 PINE ROAD PORTLAND ME06895 69879BRUNO THOR 22002 PEACHS AVE FRESNO CA96543 99983ELLEN SANDS 1 APPLE ORCHARD BISCOE NC64321
The contents of NEW-CUSTOMERS after REPLACE:
New data │ ▼ 251 SUSAN ARMITAGE 56725 OAK STREET PITTSFIELD MA02956 272 ALLEN KOHN 22651 POLK STREET SAN FRANCISCO CA09809 393 HENRY TRUMBLE 2102 WASHINGTON ST BROOKLINE MA02147 304 MARY SMYTH 5999 SANDY LANE LONG BEACH CA09743 335 VICKY KNIGHT 5678 PINE ROAD PORTLAND ME06895 696 BRUNO THOR 22002 PEACH AVE FRESNO CA96543 997 ELLEN SANDS 1 APPLE ORCHARD BISCOE NC64321
|
Copyright © 2014 CA.
All rights reserved.
|
|