Figure 20 is an example of a program that defines and loads a workstation VSAM sequential data set. You can also use this program to process a DDM or SFS file by modifying the AMTHD specification.
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) */ /* */ /* REMARKS: Restrict test to ASCII format. */ /* */ /********************************************************************/ CREATE: proc options(main); put skip list('START ISAM1 TEST'); 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); put skip list('END ISAM1 TEST'); end CREATE; The input data for this program might look like this: Fred 69 M Andy 70 M Susan 72 F