In this example, an edited data set containing double-byte character
set data is created. Shift-out/shift-in characters (< and >) are
inserted to enclose the DBCS strings.
//DBLBYTE JOB ...
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSN=INPUT,DISP=(OLD,KEEP),UNIT=disk
//SYSUT2 DD DSN=OUTPUT,UNIT=disk,DISP=(NEW,CATLG),
// DCB=(LRECL=80,BLKSIZE=3200,RECFM=FB),SPACE=(TRK,(1,1))
//SYSIN DD *
GENERATE MAXFLDS=4,MAXLITS=9,DBCS=YES
RECORD FIELD=(20,1,,1),FIELD=(16,33,VC,21),
FIELD=(30,50,VC,39),FIELD=(9,'*********',,72)
/*
The control statements are as follows.
- SYSUT1 DD defines the input data set, INPUT, which resides on
a disk volume.
- SYSUT2 DD defines the output data set, OUTPUT, which will reside
on a disk volume.
- SYSIN DD defines the control data set, which follows in the input
stream.
- GENERATE indicates that a maximum of four FIELD parameters and
nine literal characters will appear on subsequent RECORD statements,
and that the input data set contains DBCS data.
- RECORD specifies how input records will be edited before being
placed in the output data set. The first FIELD parameter indicates
that the first 20 positions (bytes) of the input records are to be
placed in the first 20 positions of the output records.
- The second FIELD parameter indicates that data in positions 33
through 48 are to be checked to ensure that they are valid DBCS data,
and that shift-out/shift-in characters are to be inserted around this
field. For DBCS data to be valid, each byte of the 2-byte characters
must have a hexadecimal value between X'41' and X'FE',
or the 2-byte character must be a DBCS space (X'4040'). Once
the checking and inserting are completed, this field is to be copied
to the output records beginning at position 21.
- The third FIELD parameter operates on the 30-byte field beginning
at position 50 in the input records. This field is checked for valid
DBCS data, and shift-out/shift-in characters are inserted around the
field. The resulting field is copied to the output records beginning
at position 39.
Notice that in specifying the output locations in the FIELD parameter,
you have to account for the additional positions that the SO/SI characters
will use. For instance, the eight-character (16-byte) DBCS string
beginning at position 21 does not end at position 36, but at 38.
The SO/SI characters are single-byte characters, so the pair will
take up two positions.
The final FIELD parameter clears out the final positions of the
output records with asterisks.