Figure 19 is an example of a program that defines and loads a workstation VSAM sequential data set.
The PL/I program writes the data set using a SEQUENTIAL OUTPUT file and a WRITE FROM statement.
The sequential record values of the records could have been obtained during the writing for subsequent use as keys in a KEYED file. To do this, a suitable variable would have to be declared to hold the key and the WRITE...KEYTO statement used. For example:
dcl Chars char(7); /*DDM uses 4; BTRIEVE and ISAM use 7 as shown */
write file(Famfile) from (String)
keyto(Chars);
dcl Chars char(4); /* DDM uses 4 */
write file(Famfile) from (String)
keyto(Chars);
The keys would not normally be printable, but could be retained for subsequent use.
/********************************************************************/
/* */
/* */
/* DESCRIPTION */
/* Define and load an ISAM sequential data set. */
/* */
/* */
/* USAGE */
/* The following commands are required to establish */
/* the environment variables to run this program: */
/* */
/* SET DD:IN=ISAM1.INP,RECSIZE(38) */
/* SET DD:FAMFILE=ISAM1.OUT,AMTHD(ISAM),RECSIZE(38) */
/* */
/********************************************************************/
CREATE: proc options(main);
dcl
FamFile file sequential output
env(organization(consecutive)),
In file record input,
Eof bit(1) init('0'b),
i fixed(15),
String char(38);
on endfile(In) Eof = '1'b;
read file(In) into (String);
do i=1 by 1 while (¬Eof);
put file(sysprint) skip edit (String) (a);
write file(FamFile) from (String);
read file(In) into (String);
end;
put skip edit(i-1,' records processed ')(a);
end CREATE;
The input data for this program might look like this:
Fred 69 M
Andy 70 M
Susan 72 F