ID Subcommand (REPEATING DATA command)
ID
compares the
value of an identification variable across records of the same input case. ID
can be used only when CONTINUED
is
specified. The identification variable must be defined on a DATA
LIST
command and must be recorded on all records in the file.
- The
ID
subcommand has two specifications: the location of the variable on the continuation records and the name of the variable (as specified on theDATA LIST
command). The specifications must be separated from each other by an equals sign. - The format specified on the
ID
subcommand must be the same as the format specified for the variable onDATA LIST
. However, the location can be different on the continuation records. - If the values of the identification variable are not the same on all records for a single input case, the program displays an error message and stops reading data.
Example
INPUT PROGRAM.
DATA LIST / ORDERID 1-5 NITEMS 7-8.
REPEATING DATA STARTS=10-50 /OCCURS=NITEMS
/CONTINUED=7 /ID=1-5=ORDERID
/DATA=ITEM 1-9 (A) QUANTITY 11-13 PRICE 15-20 (2).
END INPUT PROGRAM.
BEGIN DATA
10020 04 45-923-89 001 25.9923-899-56 100 101.99
10020 63-780-32 025 13.9554-756-90 005 56.75
20030 03 45-781-43 010 10.9789-236-54 075 105.95
20030 32-569-38 015 75.00
END DATA.
LIST.
- The order number in the data is recorded in columns 1–5 of each record.
- ORDERID is defined on
the
DATA LIST
command as a five-column integer variable. The first specification on theID
subcommand must therefore specify a five-column integer variable. The location of the variable can be different on continuation records.