Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example 23 z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
This example illustrates how you can create VB output records with comma separated values from VB input records containing fields in fixed positions. The 84-byte VB input records might look like this (4-byte RDW followed
by data):
Note that the data has three fields in fixed positions. The first field is a character string. The second field is a numeric value. The third field is another character string. (In the previous example, the character strings were surrounded by apostrophes; in this example the apostrophes must be added around the character strings.) The 84-byte VB output records are in the form of comma separated
values as follows:
We use OUTFIL IFTHEN to ensure that short records are padded on the right with blanks. (OUTFIL BUILD would terminate due to the short records.) WHEN=INIT reformats every record. OVERLAY surrounds the character strings with apostrophes. BUILD builds the output records with comma separated values. We use JFY to surround the character strings with apostrophes without
removing embedded blanks (for example, John Lewis is changed to 'John
Lewis'). After the first IFTHEN, the records look like this:
We then use SQZ to squeeze out the blanks between the fields, shift the remaining characters to the left and insert commas between the fields. SHIFT=LEFT shifts the characters to the left. PAIR=APOST ensures that blanks within paired apostrophes are not squeezed out (for example, we want to keep the blank in the 'John Lewis' field.) MID=C',' inserts a comma for each group of blanks removed between the fields (for example, between 'John Lewis' and -12.83). Finally, we use VLRTIM=C' ' to remove trailing blanks at the end of each VB record by adjusting its length appropriately. |
Copyright IBM Corporation 1990, 2014
|