workdef CSV file Header

 4 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Srini Rao
Veteran Member Send Private Message
Posts: 149
Veteran Member
Hello, Is their a way to create a mixed case header for csv file using workdef. My vendor wants the field name as "BatchNumber" but when I can't declare the field name in mixed case in workdef. Thanks
Donna Wirt
Basic Member Send Private Message
Posts: 17
Basic Member
Read the "Description" below.  I believe this is what you need.

800-OVRDESCCSV

Name

800-OVRDESCCSV-

Description

This API overrides the Field Header Name, Type, or both for one field in the specified file.

Both name and type can be changed in the same call. Once a field name has been changed, any future

call to this routine for that field must use the new name. The name of the Working Storage field in the

files REC area remains unchanged.

Any overrides must be done before the first write or read call to the file is made.

Srini Rao
Veteran Member Send Private Message
Posts: 149
Veteran Member
Thanks Donna, Let me try using the 800-OVRDESCCSV.
Ragu Raghavan
Veteran Member Send Private Message
Posts: 477
Veteran Member
what I usually do is: 1. define the csv file in workdef without headers 2.define another tape file. Define the custom headers in WS. Write a single line with these headers to the tape file 3. at the end of the program, do a CALL "system" and do a "cat hdrfile csvfile > file_with_hdr"
jaherb
Veteran Member Send Private Message
Posts: 164
Veteran Member
If you wish the header name to be "BatchNumber" as you indicated, all you need to do is define the field in your csv file as "BATCH-NUMBER"   The csv logic will remove the "-" and mix the case of the letters to where the first letter is upper case and the rest is lower. If you need to get more complex than that in your field names, it is best to turn off the headers and then create a seperate text file with the way you wish to see the headers.  In your logic, after you close the file, execute a "cat" command to concatenate the header file with the detail csv file.   I have the situation here, where I need to provide 2 header rows on each files for one of our interfaces.  It is a simple process to accomplish.