UFO provides an automatic access feature that performs file I/O. Automatic access is the native UFO access strategy. Files are automatically read, updated, and written at specific places in the UFO cycle.
There are several areas in the UFO application that must be set up properly in order for the correct data to be retrieved via automatic access. If not coded correctly, your application may fetch the wrong records.
Below is a checklist to help you debug an application that is not returning the desired results:
- Determine whether a valid keygroup has been defined on the DD (for both Mode=1 and Mode=2). If not, UFO will not be able to retrieve a specific or generic key. Without a keygroup, UFO will be unable to interpret input as a key value.
- If a valid keygroup has been defined, make sure that the LENGTH and START values coded for the keygroup header match the key length and key location defined for the file. If they do not match, neither browse nor retrieval operations will function properly. Records will be skipped and incorrect records will be retrieved.
- Make sure the fields that are part of the keygroup match the structure of the keys in the file exactly.
- For a field in a keygroup that is packed decimal, determine which sign is required for the positive numbers: "C" or "F". For a "C" sign, the field type code must be "S". For "F" sign, "P" is required.
- For Mode=2 DDs, make sure the AUTOMATIC ACCESS SEQUENCE specification on the DDXF has been completed. If not, automatic access records will not be retrieved.
- If a work field is defined as a field in a keygroup, an application procedure (PDS) must move the key value from the record read into the work field at the PRD exit point. Otherwise, during a browse operation, the value of the work field will not change and the same record will be retrieved.
- If browsing through a VSAM file that is retrieved via an alternative index with non-unique keys, specify an access method type "A" rather than "K". If "K" is specified, no more than a screen full of records with the same key can be retrieved. In this situation, any attempt thereafter to browse forward will only retrieve the same record or group of records.
- If multiple fields make up the keygroup and the wrong record is retrieved on the initial entry, check the parameters provided. Each field of the keygroup requires a separate parameter. For example, for an application that expects two key values to be supplied on the initial entry, the wrong record will be retrieved using the:
UFO EXEC myapp keyvalue1keyvalue2
Instead, each parameter should be separated with a blank. For example:
UFO EXEC myapp keyvalue1 keyvalue2
- If the application procedure (PDS) uses the DISPLAY function to transfer from one DD to another, then make sure that both DDs use the same automatic access files with the same file numbers. This also applies if you post /NEWSCR to /RETURN.