How to create, write, and read to files without a program
Estimated Reading Time: 1 MinutesQuestion:
Does isCOBOL provide a method to create an indexed file with a given structure and name, read a file by key and return the record value, and write records into a file?
Answer:
Yes, by using jutil, ctutil, and Gife utilities
-
To create indexed files with a given structure and name.
-
If you are using the JISAM file handler, use the jutil utility to create a new empty file by passing an image string (-jutil -makeimage), or by interacting with the utility to provide the image information (jutil -gen)
You can also extract records from an indexed file to a text file, and load them to the new file using jutil -unload, unloadtext, -load and -loadtext - If you are using c-treeRTG, use the ctutil utility. This utility has the same features of jutil, but works on the ctree file system.
-
If you are using the JISAM file handler, use the jutil utility to create a new empty file by passing an image string (-jutil -makeimage), or by interacting with the utility to provide the image information (jutil -gen)
-
To read a file by key and review, edit or write records.
Use the GIFE utility. This utility will open an indexed or relative file using any file handler.
You can view and edit the data in raw format (each record as one string), or as values of the file description if you have an extended file description (created with the -efd compile switch). -
Read, edit and write records without knowing the data fields.
isCOBOL also provides the I$IO library routine to give low-level access to indexed files without the need of an FD or Select.
For more information about how to use this, please read the section on I$IO in our Appendices documentation.
You can also see I$IO used in a sample program called "IIO.cbl" in our sample directory, under the "issamples" section.