Examples of the DATA keyword
For the following examples, assume the following fields
in the file
- CHAR37 is an alphanumeric field with EBCDIC CCSID 37.
- CHAR1208 is an alphanumeric field with UTF-8 CCSID 1208.
- GRAPH835 is a graphic field with DBCS CCSID 835.
- GRAPH834 is a graphic field with DBCS CCSID 834.
Assume the following data structures.
- Each alphanumeric subfield in data structure custExactIn will have the same CCSID as the field in the file.
- Each alphanumeric subfield in data structure custNoexactIn will have CCSID(*JOBRUN).
- Each graphic subfield in both data structures will have the same CCSID as the field in the file.
DCL-DS custExactIn LIKEREC(custRec:*INPUT) CCSID(*EXACT);
DCL-DS custNoexactIn LIKEREC(custRec:*INPUT) CCSID(*NOEXACT);
DATA(*CVT) is specified for the file and the job CCSID is 937
The DBCS CCSID related to CCSID 937 is 835.
DCL-F custFile USAGE(*UPDATE) DATA(*CVT);
READ custFile custExactIn;
READ custFile custNoexactIn;
- For both READ operations, database converts the alphanumeric data in the file to CCSID 937 in the input buffer, and the graphic data in the file to CCSID 835 in the input buffer.
- For the first READ operation, the following conversions
are done between the data in the input buffer and the
subfields in the custExactIn data structure.
- For subfield CHAR37, the data is converted from CCSID 937 to CCSID 37.
- For subfield CHAR1208, the data is converted from CCSID 937 to CCSID 1208.
- For subfield GRAPH835, no CCSID conversion is needed since the data in the buffer and the data in the subfield both have CCSID 835.
- For subfield GRAPH834, the data is converted from CCSID 835 to CCSID 834.
- For the second READ operation, no CCSID conversions are necessary for the alphanumeric subfields because the data for each field in the input buffer has the same CCSID as the matching subfield in the custNoexactIn data structure. For subfield GRAPH834, the data is converted from CCSID 835 to CCSID 834.
DATA(*CVT) is specified for the file and the job CCSID is 65535
Assume that the default job CCSID is 937. This is the CCSID that is assumed for alphanumeric program fields with CCSID(*JOBRUN).
DCL-F custFile USAGE(*UPDATE) DATA(*CVT);
READ custFile custExactIn;
READ custFile custNoexactIn;
- For both READ operations, no conversion is done between the data in the file and the input buffer. The fields in the input buffer have the same CCSID as the fields in the file.
- For the first READ operation, no CCSID conversions are necessary because the data for each field in the input buffer has the same CCSID as the matching subfield in the custExactIn data structure.
- For the second READ operation, the following conversions
are done between the data in the input buffer and the
subfields in the custNoxactIn data structure.
- For subfield CHAR37, the data is converted from CCSID 37 to job CCSID CCSID 937.
- For subfield CHAR1208, the data is converted from CCSID 1208 to job CCSID 937.
- For subfield GRAPH835, no CCSID conversion is needed since the data in the buffer and the data in the subfield both have CCSID 835.
- For subfield GRAPH834, no CCSID conversion is needed since the data in the buffer and the data in the subfield both have CCSID 834.
DATA(*NOCVT) is specified for the file
Assume that the job CCSID or default job CCSID is 937. This is the CCSID that is assumed for alphanumeric program fields with CCSID(*JOBRUN).
The READ operations are identical to those of the previous scenario where the job CCSID is 65535.