CONTINUED Subcommand (REPEATING DATA command)

CONTINUED indicates that the repeating groups are contained on more than one record for each input case.

  • Each repeating group must be fully recorded on a single record: a repeating group cannot be split across records.
  • The repeating groups must begin in the same column on all continuation records.
  • If CONTINUED is specified without beginning and ending columns, the program assumes that the repeating groups begin in column 1 of continuation records and searches for repeating groups by scanning to the end of the record or to the value specified by OCCURS. See the topic Operations (REPEATING DATA command) for more information.
  • If the repeating groups on continuation records do not begin in column 1, CONTINUED must specify the column in which the repeating groups begin.
  • If there is room on the logical record length for more repeating groups than are contained on the first record of each input case, the STARTS subcommand must indicate an ending column for the records. The ending column on STARTS applies only to the first record of each input case.
  • If there is room on the logical record length for more repeating groups than are contained on the continuation records of each input case, the CONTINUED subcommand must indicate an ending column. The ending column on CONTINUED applies to all continuation records.

Basic Example

* This example assumes the logical record length is 80. 
 
INPUT PROGRAM.
DATA LIST / ORDERID 1-5 NITEMS 7-8.
REPEATING DATA STARTS=10 /OCCURS=NITEMS /CONTINUED=7
 /DATA=ITEM 1-9 (A) QUANTITY 11-13 PRICE (DOLLAR7.2,1X).
END INPUT PROGRAM.
 
BEGIN DATA
10020 07 01-923-89 001  25.99 02-899-56 100 101.99 03-574-54 064  61.29
10020 04-780-32 025  13.95 05-756-90 005  56.75 06-323-47 003  23.74
10020 07-350-95 014  11.46
20030 04 01-781-43 010  10.97 02-236-54 075 105.95 03-655-83 054  22.99
20030 04-569-38 015  75.00
END DATA.
LIST.
  • Data are extracted from a mail-order file. Each input case represents one complete order. The data show two complete orders recorded on a total of five records.
  • The order number is recorded in columns 1 through 5 of each record. The first three records contain information for order 10020; the next two records contain information for order 20030. The second field of numbers on the first record of each order indicates the total number of items ordered. The repeating groups begin in column 10 on the first record and in column 7 on continuation records. Each repeating data group represents one item ordered and contains three variables—the item inventory number, the quantity ordered, and the price.
  • DATA LIST defines variables ORDERID and NITEMS on the first record of each input case.
  • STARTS on REPEATING DATA indicates that the repeating groups on the first record of each input case begin in column 10.
  • OCCURS indicates that the total number of repeating groups for each input case is the value of NITEMS.
  • CONTINUED must be used because the repeating groups are continued on more than one record for each input case. CONTINUED specifies a beginning column because the repeating groups begin in column 7 rather than in column 1 on the continuation records.
  • DATA defines variables ITEM, QUANTITY, and PRICE for each repeating data group. ITEM is in positions 1–9, QUANTITY is in positions 11–13, and PRICE is in positions 14–20 and is followed by one blank column. The length of the repeating groups is therefore 21 columns. The LIST output is shown below.
ORDERID NITEMS ITEM      QUANTITY      PRICE
 
 10020     7   01-923-89      1       $25.99
 10020     7   02-899-56    100      $101.99
 10020     7   03-574-54     64       $61.29
 10020     7   04-780-32     25       $13.95
 10020     7   05-756-90      5       $56.75
 10020     7   06-323-47      3       $23.74
 10020     7   07-350-95     14       $11.46
 20030     4   01-781-43     10       $10.97
 20030     4   02-236-54     75      $105.95
 20030     4   03-655-83     54       $22.99
 20030     4   04-569-38     15       $75.00
 
NUMBER OF CASES READ =      11    NUMBER OF CASES LISTED =      11

Specifying an Ending Column on the STARTS Subcommand

* This example assumes the logical record length is 80.
 
INPUT PROGRAM.
DATA LIST / ORDERID 1-5 NITEMS 7-8.
REPEATING DATA STARTS=10-55 /OCCURS=NITEMS /CONTINUED=7
 /DATA=ITEM 1-9 (A) QUANTITY 11-13 PRICE (DOLLAR7.2,1X).
END INPUT PROGRAM.
 
BEGIN DATA
10020 07 01-923-89 001  25.99 02-899-56 100 101.99
10020 03-574-54 064  61.29 04-780-32 025  13.95 05-756-90 005  56.75
10020 06-323-47 003  23.74 07-350-95 014  11.46
20030 04 01-781-43 010  10.97 02-236-54 075 105.95
20030 03-655-83 054  22.99 04-569-38 015  75.00
END DATA.
LIST.
  • Data are the same as in the previous example; however, records are entered differently. The first record for each input case contains only two repeating groups.
  • DATA LIST defines variables ORDERID and NITEMS in columns 1–8 on the first record of each input case. Column 9 is blank. DATA defines variables ITEM, QUANTITY, and PRICE in positions 1–20 of each repeating group, followed by a blank. Thus, each repeating group is 21 columns wide. The length of the first record of each input case is therefore 51 columns: 21 columns for each of two repeating groups, plus the eight columns defined on DATA LIST, plus column 9, which is blank. The operating system’s logical record length is 80, which allows room for one more repeating group on the first record of each input case. STARTS must therefore specify an ending column that does not provide enough columns for another repeating group; otherwise, the program creates an output case with missing values for the variables specified on DATA.
  • STARTS specifies that the program is to scan only columns 10–55 of the first record of each input case looking for repeating data groups. It will scan continuation records beginning in column 7 until the value specified on the OCCURS subcommand is reached.

Specifying an Ending Column on the CONTINUED Subcommand

* This example assumes the logical record length is 80.
 
INPUT PROGRAM.
DATA LIST / ORDERID 1-5 NITEMS 7-8.
REPEATING DATA STARTS=10-55 /OCCURS=NITEMS /CONTINUED=7-55
 /DATA=ITEM 1-9 (A) QUANTITY 11-13 PRICE (DOLLAR7.2,1X).
END INPUT PROGRAM.
 
BEGIN DATA
10020 07 01-923-89 001  25.99 02-899-56 100 101.99
10020 03-574-54 064  61.29 04-780-32 025  13.95
10020 05-756-90 005  56.75 06-323-47 003  23.74
10020 07-350-95 014  11.46
20030 04 01-781-43 010  10.97 89-236-54 075 105.95
20030 03-655-83 054  22.99 04-569-38 015  75.00
END DATA.
LIST.
  • The data are the same as in the previous two examples, but records are entered differently. The first record and the continuation records for each input case store only two repeating groups each.
  • The operating system’s logical record length is 80, which allows room for more repeating groups on all records.
  • STARTS specifies that the program is to scan only columns 10-55 of the first record of each input case looking for repeating data groups.
  • CONTINUED specifies that the program is to scan only columns 7–55 of all continuation records.