![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: I am writing a basic C Program in which I want to open an input file and determine its record attributes, record format, and RMS attributes so that, later in the program, I can open a separate output file using the same attributes. I have reviewed details in the DEC C User's Guide regarding RMS Run-Time Processing Functions like sys$open and initializing the various file and record access blocks. However, I need to know if there is a way to identify those attributes within a C prog ram upon identifying and/or opening an existing input file rather than just initializing these values for a newly created output file. Thanks! The Answer is : Create the RMS FAB, RAB, and XABSUM structures for the source file, and initialize these structures appropriately. (In most cases, initialization involves using the provided initialization structures, and setting the filename and the default name.) Call sys$open and sys$connect. If an indexed file, deterimine the number of keys present using the contents of the XABSUM block, and allocate and chain the appropriate number of XABKEY blocks off the XAB chain. Call sys$display to fill in the XABKEY blocks. Process the file as required. Replicate the FAB, RAB, and XABKEY structures for the new file, changing the filename and/or default name. Zero the ISI and IFI fields. Clone the contents of the FAB, RAB, and XABs, then open (or create) the new file using sys$create or sys$open with the CIF option. -- The callable convert API can be used to copy a file, if that is the goal here. In general, you should specify only the filename in the filename field in the FAB, and you should specify the device, directory, and file extension in the FAB default name field. -- Alternatively, see the RMS extensions to Compaq C. For details of these RMS extensions, see the Compaq C documentation, and particularly the User's Guide and see the Compaq C reference documentation for the creat call. The stat, fstat, and the Compaq C acc callback extensions can serve usefully within C applications, and can avoid requiring directly and explicitly embedding RMS calls in C applications. -- One of the most useful (and subtle) means of performing file creation operations on OpenVMS is via the FDL mechanism -- a command-level FDL mechanism and various FDL callable routines both exist in OpenVMS. The OpenVMS Wizard makes regular use of the fdl$create call for file creation operations.
|