Procedure Modules › Random Access of VSAM Files (CULLUS25) › Helpful Hints
Helpful Hints
- To avoid overwriting external-file-name-v by another user module, specify the external file name (ARG6) each time the call to CULLUS25 is issued. Reset the value before the CALL is issued.
- Failure to close a VSAM file may result in the loss of the file.
- More than one VSAM file can be accessed in a single CA Culprit run by creating a copy of CULLUS25 for each file and changing the name to be unique (CULLUS26, CULLUS27,...). Either copy the module and rename it or link edit the new version using the CULLUS25 load module.
- VSAM treats all key fields as unsigned binary strings. When testing a key field, use logical rather than arithmetic tests.
- If a key field is a not a binary string, specify a data conversion in the first argument (conversion-qv) of the CALL.
- If the retrieved VSAM record exceeds the defined receiving field length, the record is truncated to the length of the receiving field (ARG5) when read into the input buffer.
- If the length of the receiving field is longer than the retrieved record, the unused portion of the field is not initialized to blanks. The contents are unpredictable.
Example
This example shows the CA Culprit parameters required to retrieve VSAM records that have key fields corresponding to keys contained in an input file.
The following code:
- Uses INPUT parameters to define an input file containing a key field and a dummy input buffer area to receive the VSAM record.
The INPUT parameter allocates 400 bytes for the dummy buffer. Since the receiving area is defined on the CALL statement as 400 bytes, only the first 400 bytes of the VSAM record is read into the input buffer.
- Uses REC parameters to define the key field of the input record and the key field of the VSAM record.
- Tests for an end-of-file condition. When end-of-file is reached, the logic branches to statement 200, which issues a CALL to CULLUS22 to close the file (ARG1).
- Issues a CALL to CULLUS25.
- Tests for a NO RECORD FOUND condition by looking for asterisks (**) in the first two positions of KEY-FIELD2.
- Tests key field values. If the values are not equal, the VSAM record is dropped.
INPUT 80 F 4000
REC KEY-FIELD 1 2
INPUT 400 F 400 MB=D
REC KEY-FIELD2 1 2
.
.
.
017005 EOF EQ 200
017010 CALL US25 (' ' 0 KEY-FIELD 400 KEY-FIELD2)
017060 IF KEY-FIELD2 EQ '**' DROP
017070 IF KEY-FIELD NE KEY-FIELD2 DROP
017080 TAKE
017200 CALL US25 ('9')
017205 DROP
Copyright © 2014 CA.
All rights reserved.
|
|