bdfp1m16Programming Concepts and Reference

dfdel-Delete One or More Logical Records

Use this group of functions to delete:

Format

dft_rec *dfdel(dft_fil *file, dft_opt options);
dft_rec *dfdel_acc(dft_fil *file, dft_opt access, dft_opt options, dft_xxx acc);
dft_rec *dfdel_lst(dft_fil *file, dft_opt list_type, dft_opt options,
        dft_idl *lst);
dft_rec *dfdel_nbr(dft_fil *file, dft_opt nbr_type, dft_opt options,
        dft_xxx nbr);
dft_rec *dfdel_acc_lst(dft_fil *file, dft_opt list_type, dft_opt access,
        dft_opt options, dft_xxx acc, *dft_idl lst);
dft_rec *dfdel_acc_nbr(dft_fil *file, dft_opt nbr_type, dft_opt access,
        dft_opt options, dft_xxx acc, dft_xxx nbr);
dft_rec *dfdel_lst_nbr(dft_fil *file, dft_opt list_type, dft_opt nbr_type,
        dft_opt options, dft_idl *lst, dft_xxx nbr);
dft_rec *dfdel_acc_lst_nbr(dft_fil *file, dft_opt list_type,
        dft_opt nbr_type, dft_opt access, dft_opt options,
        dft_xxx acc, dft_idl *lst, dft_xxx nbr);
dft_rec *dfdel_sub(dft_fil *file, dft_opt options,
        dft_sno sub, dft_qty qty);



acc
is an ordinal number, a file address, or a pointer to an algorithm string that specifies the subfile you want to access. The type for this parameter is determined by the value you specify for the access parameter.

access
is the method you want to use to access the subfile. Use one of the following values:

DFDEL_ALG
specifies that you are providing a pointer to an algorithm argument in the acc parameter. The acc parameter is of type dft_alg.

The TPFDF product uses the algorithm argument to determine the subfile (ordinal number) that is to be accessed. Specify the algorithm argument based on the type of algorithm that is defined in the DSECT or DBDEF macro for the file. If the DSECT or DBDEF macro defines the #TPFDB04 or the #TPFDB0D algorithm, do not use this parameter.

If the subfile you are accessing is contained in a detail file or intermediate index file defined with the #TPFDBFF algorithm, the TPFDF product uses the algorithm argument to locate the subfile. See TPFDF Database Administration for more information about how the TPFDF product uses the algorithm argument to locate the subfile.

DFDEL_FADDR
specifies that you are providing a file address in the acc parameter. A file address is in integer format. The acc parameter is of type dft_fad.

DFDEL_ORD
specifies that you are providing an ordinal number in the acc parameter. Ordinal numbers in a file start at zero and are in integer format. The acc parameter is of type dft_ord.

If the file is partitioned or interleaved, specify the relative ordinal number within the partition or interleave. If the file is not partitioned or interleaved, specify the file address compute program (FACE) ordinal number.

file
is a pointer to the base address of the SW00SR slot (defined in c$sw00sr.h) of the subfile that you want to access and is returned by the dfopn function.

list_type
specifies which files to delete. Use one of the following values:

DFDEL_INCLUDE
deletes only the files listed in the structure pointed to by the lst parameter. This is the default value.

DFDEL_EXCLUDE
deletes all files except those listed in the structure pointed to by the lst parameter.

lst
is a pointer to a list of up to 10 subfiles to be included or excluded in the delete action when the DFDEL_INCLUDE or DFDEL_EXCLUDE value of the list_type parameter is specified.

The lst parameter is provided so that you can delete, or not delete, subfiles that are referenced from the LREC that you are deleting.

To delete LRECs in all the referenced subfiles, specify zero as the number of file identifiers and provide one file identifier consisting of a string of 2 space characters. For example:

  struct id_list ids = {0,"  "};

nbr
is an LREC number (type dft_nbr) or a pointer to a list (type dft_rcl) of LRECs to be deleted. The following is deleted based on the value of the nbr_type parameter:

Notes:

  1. If you use the #TPFDB0D algorithm, you must specify a specific LREC number for the value of nbr.

  2. LRECs are numbered in increasing order from the start of the subfile (the first LREC in the prime block has sequence number 1).

  3. If you specify this parameter with active keys, only those LRECs that match the key conditions are included in the sequence numbering; LRECs that do not match are ignored.

  4. In functions that do not include the nbr_type parameter, the value of nbr is a specific LREC number.

nbr_type
specifies the type of value that you are providing in the nbr parameter. Use one of the following values:

DFDEL_LIST
specifies that you are providing a pointer to a list of LREC numbers (type dft_rcl).

DFDEL_LRECNBR
specifies that you are providing the sequence number of a single LREC (type dft_nbr).

options
are the processing options for this function. Use the following values:

DFDEL_ALL
deletes every LREC in the open subfile that you have specified. If you currently have keys active, the function deletes only the LRECs that match the keys.

If you delete LRECs from a fixed file using the DFDEL_ALL value, the function writes the empty prime block to DASD after deleting the LRECs (the block header and optional trailer are not deleted). Any blocks previously chained to the prime block are released. It releases any blocks previously chained to the prime block.

If you delete all the LRECs from a pool subfile, the function releases both prime and overflow blocks. However, if you delete all the LRECs from a pool subfile and add an LREC before you close the subfile, the prime block is not released.

For B+Tree files, if no keys are specified, DFDEL_ALL releases the index blocks as well as the data blocks.

If the subfile was opened in detac mode, you cannot recover the subfile using the dfcls function with DFCLS_ABORT.

If you combine this value with a lst parameter, the TPFDF product deletes only the LRECs in the lst parameter.

If you specify keys in addition to DFDEL_ALL, this function deletes all the LRECs in the open subfile that match these keys. If you also specify the DFDEL_FULLFILE value, the dfdel function deletes all the LRECs that match the keys in an entire file. In this case, the blocks are not released, whether they are fixed or pool, because some LRECs can remain in a file after deletion.

You can use the DFDEL_ALG value on the access parameter with the DFDEL_ALL value to delete LRECs from an indexed detail file. The DBDEL macro deletes the index entry for the subfile and releases the indexed subfile if it is in pool.

DFDEL_ALL_DOWNWARD
deletes all LRECs from (and including) the current LREC to the last LREC in the subfile. If you currently have keys active, the function deletes only the LRECs that match the keys.

DFDEL_ALL_UPWARD
deletes all LRECs from (but not including) the current LREC to the first LREC in the subfile. If you currently have keys active, the function deletes only the LRECs that match the keys.

DFDEL_BEGIN
specifies that you want to start at the beginning of the file when searching for LRECs to delete.

DFDEL_FULLFILE
deletes an LREC from every subfile of the file.

If you combine this value with the DFDEL_ALL value, the function deletes every LREC in every subfile of the file. You can delete LRECs in certain subfiles only by specifying the beg and end parameters with the dfadr function.

DFDEL_INITIALIZE
empties the entire subfile apart from the standard TPFDF header in the prime block. It releases any blocks previously chained to the prime block.

DFDEL_LAST
deletes the last LREC of the subfile. (If you have set keys, the function only deletes LRECs with matching keys.)

DFDEL_NEXT
deletes the next LREC in sequence from a file. (If you have set keys, the function only deletes LRECs with matching keys.)

DFDEL_NODUMP
specifies that you do not want the TPFDF product to issue any of the following system errors while processing this function:
  • DB0100
  • DB0102
  • DB0117
  • DB0123
  • DB0138
  • DB0140.

See Messages (System Error, Online, Offline) and Master Glossary for more information about these system errors.

Note:
Using the DFDEL_NODUMP value is not recommended because it can prevent system errors from being issued that indicate a critical problem.

DFDEL_NOKEY
deactivates any currently active keys.

Notes:

  1. If the file is not open when you specify the DFDEL_NOKEY value, the dfdel function opens the file and deletes the first LREC.

  2. If the file is open when you specify the DFDEL_NOKEY value, the dfdel function deletes the current LREC.

0
specifies that you do not want to use any processing options.

qty
is the number of subLRECs you want to delete.

sub
is the sequence number of the first subLREC in the extended LREC that you want to delete.

Entry Requirements

Before using the dfdel_sub function, you must use a dfred function to locate the extended LREC from which you want to delete the subLREC.

Normal Return

Error Return

Programming Considerations

Examples

Related Functions