
A data structure begins with a DCL-DS statement.
If the LIKEDS or LIKEREC keyword is not specified for the DCL-DS statement, the DCL-DS statement is followed by zero or more subfields, followed by an END-DS statement.
The first statement begins with DCL-DS, followed by the name of the data structure or *N if it does not have a name, followed by keywords, and finally a semicolon.
DCL-DS custInfo QUALIFIED;
id INT(10);
name VARCHAR(50);
city VARCHAR(50);
orders LIKEDS(order_t) DIM(100);
numOrders INT(10);
END-DS custInfo;
DCL-DS prtDs LEN(132) END-DS;
DCL-DS myfile EXT END-DS;
DCL-DS extds1 EXTNAME('MYFILE') END-DS;
DCL-DS extds2 EXT INZ(*EXTDFT) EXTNAME('MYFILE') END-DS;
DCL-DS pgm_stat PSDS;
status *STATUS;
routine *ROUTINE;
library CHAR(10) POS(81);
END-DS;
See Program Status Data Structure for a list of all the predefined subfields for a PSDS.
The name of an INFDS is specified as the parameter for the INFDS keyword of a file definition.
DCL-F myfile DISK(*EXT) INFDS(myfileInfo);
DCL-DS myfileInfo;
status *STATUS;
opcode *OPCODE;
msgid CHAR(7) POS(46);
END-DS;
See File Feedback Information for a list of all the predefined subfields for an INFDS.
DCL-DS dtaara_ds DTAARA(*AUTO) LEN(100);
name CHAR(10);
END-DS;
DCL-DS info LIKEDS(info_T);
DCL-DS inputDs LIKEREC(custFmt : *INPUT);
DCL-DS cust_info;
id INT(10);
name VARCHAR(25);
startDate DATE(*ISO);
END-DS;
DCL-DS *N;
DCL-SUBF select CHAR(10);
name CHAR(10);
DCL-SUBF address CHAR(25);
END-DS;
DCL-DS order_info QUALIFIED;
part LIKEDS(part_info_T);
quantity INT(10);
unit_price PACKED(9 : 2);
discount PACKED(7 : 2);
END-DS order_info;
DCL-DS cust_info EXTNAME('CUSTFILE');
num_orders INT(10);
earliest_order DATE(*ISO);
latest_order DATE(*ISO);
END-DS;
DCL-DS custInfo EXT;
cust_name EXTFLD('CSTNAM');
id_no EXTFLD INZ(0);
END-DS;
DCL-DS *N;
string CHAR(100);
string_array CHAR(1) DIM(100) OVERLAY(string);
END-DS;
