bdfp1m25Programming Concepts and Reference

DBDEL-Delete One or More Logical Records

Use this macro to delete:

Format




Notes:

  1. See Specifying File Organization with Keyn Parameters for information about the rules for using the KEYn parameters and file organization parameters together.




REF=dsectvv
specifies the file or subfile that you want to access, where dsectvv is the DSECT name and an optional 2-character version.

REF=refname
specifies the file or subfile that you want to access, where refname is a label that references the DSECT name in one of the following formats:

refname
is the label of an 8-byte field that contains the 6-byte DSECT name and an optional 2-character version.

A/refname
is the label of a 4-byte field that contains the storage address of the DSECT name and an optional 2-character version.

FILE=dsect
specifies the file or subfile that you want to access, where dsect is the DSECT name.

R3=address
specifies the location of the SW00SR slot for this subfile, where address is the label of a field that contains the address of the SW00SR slot. Register 3 will be loaded with this address.
Note:
Do not use this parameter; it is provided only for migration purposes. Use the REF parameter to specify the file that you want to access.

ALG=algarg
identifies the subfile that you want to access, where algarg specifies an algorithm argument.

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.

Specify algarg as one of the following:

Note:
Do not modify the area of storage containing the algorithm argument until the subfile is closed.

FADDR=faddr
identifies the subfile that you want to access, where faddr is one of the following:

faddr
is the label of a 4-byte field that contains the file address of the prime block of the subfile.

A/faddr
is the label of a 4-byte field that contains the storage address of the file address of the prime block of the subfile.

ORD=ordnum
identifies the subfile that you want to access, where ordnum is one of the following:

ordnum
is the label of a 4-byte field that contains the ordinal number of the subfile.

A/ordnum
is the label of a 4-byte field that contains the storage address of the ordinal number of the subfile.

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.

ALL
deletes every LREC in the open subfile specified by the REF parameter. If you opened the subfile using KEYn parameters, the DBDEL macro deletes only the LRECs that match these keys.

If you delete all the LRECs from a fixed file, the DBDEL macro 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 are released.

If you delete all the LRECs from a pool subfile, the DBDEL macro 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, the DBDEL macro with the ALL parameter 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 DBCLS macro with the ABORT parameter specified.

If you specify the FULLFILE parameter in addition to the ALL parameter, the DBDEL macro deletes every LREC in every subfile of the file. You can delete LRECs in certain subfiles only by specifying the BEGORD and ENDORD parameters with the DBOPN or DBADR macros.

If you specify KEYn parameters in addition to ALL, DBDEL deletes all the LRECs in the open subfile that match these keys. If you also specify the FULLFILE parameter, the DBDEL macro 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 ALG parameter with the ALL parameter 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.

INITIALISE
empties an entire subfile, apart from the standard TPFDF header in the prime block. The TPFDF product initializes the subfile (it deletes all LRECs, but leaves the empty prime block) and releases any blocks previously chained to the prime block.
Note:
If you specify the INITIALISE parameter with the ALL and KEYn parameters, the INITIALISE parameter is ignored.

DOWNWARD
deletes all LRECs from (and including) the current LREC to the last LREC in the subfile. If you opened the subfile using KEYn parameters, the DBDEL macro deletes only the LRECs that match these keys.

UPWARD
deletes all LRECs from (but not including) the current LREC to the first LREC in the subfile. If you opened the subfile using KEYn parameters, the DBDEL macro deletes only the LRECs that match these keys.

BEGIN
searches from the beginning of the subfile for LRECs to delete.

CHKA=rcc
checks the record code check (RCC) value in each block, where rcc is the label of a 1-byte field that contains the RCC character.

NOCHK
specifies that you do not want to check the record code check (RCC) value of the blocks.

ERROR=spmlbl
branches to the specified location if a serious error is detected when processing the macro, where spmlbl is a TPFDF structured program macro (SPM) label defined with the #LOCA macro. See TPFDF and TPF Structured Programming Macros for more information about the #LOCA macro. See Identifying Return Indicators and Errors for more information about serious errors.

ERRORA=asmlbl
branches to the specified location if a serious error is detected when processing the macro, where asmlbl is an assembler label. See Identifying Return Indicators and Errors for more information about serious errors.

EXCLUDE
prevents the deletion of specific subfiles that are referenced from the LREC that is being deleted.

INCLUDE
deletes specific subfiles that are referenced by deleted LRECs.

ALL
deletes all subfiles referenced by the LRECs that you are deleting. You can also use this parameter with the ALL or FULLFILE parameter.

Notes:

  1. With INCLUDE=(ALL), if the deleted subfiles contain LRECs that reference other subfiles, the DBDEL macro also deletes these referenced subfiles. This process continues to as many levels as necessary.

  2. If the subfile containing the LREC being deleted was opened in detac mode, the subfiles referenced by the LREC cannot be recovered using DBCLS ABORT.

Attention: Do not use the INCLUDE parameter with subfiles that you have opened in detac mode. The TPFDF product deletes any referenced subfiles when you issue the DBDEL macro. If you subsequently close the subfile using an ABORT parameter, the subfile will contain LRECs with references to nonexistent subfiles.

fname
is the name of the subfile or subfiles that you want to exclude or include in the DBDEL macro processing. You can specify as many as 10 DSECT names.

LIST=loc
specifies a list of subfiles that you want to include or exclude in the DBDEL macro processing, where loc is the location of a 22-byte field containing a list of as many as 10 file IDs. Specify one of the following:

loc
is the label of the field that contains the list.

A/loc
is the label of a 4-byte field containing the storage address of the field that contains the list.

The list starts with a 2-byte field that contains a halfword count of the number of file IDs referenced, each subsequent 2-byte field contains a file ID.

Note:
The location contains the file IDs, not the file names.

FULLFILE
deletes an LREC specified with the ALG and KEYnparameters from any of the subfiles in the file referenced by the REF parameter. If you do not specify the FULLFILE parameter, you can only delete an LREC in the current subfile.
Note:
If you specified the BEGORD and ENDORD parameters with the DBOPN macro, the DBDEL macro only deletes the subfiles between the specified ordinals.

INTERLV
specifies the interleave that you want to use. Specify one of the following:

interlvnum
is one of the following:
  • A register that contains the address of the interleave number
  • An absolute value representing the interleave number
  • The label of a 2-byte field that contains the interleave number.

ALL
specifies all interleaves. Use this value when you use fullfile processing to ensure that you do not miss an LREC located in a different interleave.

If you specify this parameter, the maximum interleave number must be defined in the DSECT or DBDEF macro. See TPFDF Database Administration for more information about interleaves.

PARTITN
specifies the partition that you want to use. Specify one of the following:

partitnum
is one of the following:
  • A register that contains the address of partition number
  • An absolute value representing the partition number
  • The label of a 2-byte field that contains the partition number.

ALL
specifies all partitions. Use this value when you use fullfile processing to ensure that you do not miss an LREC located in a different partition.

If you specify this parameter, the number of partitions and the end ordinal must be defined in the DSECT or DBDEF macro. See TPFDF Database Administration for more information about partitions.

Note:
Do not use this parameter with the #TPFDB0F algorithm. This algorithm computes the partition used from the algorithm argument. See TPFDF Database Administration for more information about algorithms.

KEYn
specifies the key parameters that you want to use with this macro, where n is a number from 1-6. You can specify as many as six KEYn parameters and they must be specified in sequential order beginning with 1. That is, you cannot code a KEY2 parameter without a KEY1 parameter, a KEY3 parameter without the KEY1 and KEY2 parameters, and so on.

If you use these parameters, you must also specify the file organization of the keys. See Specifying File Organization with Keyn Parameters for more information about how to do this. Use one or more of the following subparameters with the KEYn parameter:

PKY=primarykey
specifies a value that will be compared against the primary key of an LREC, where primarykey is a 1-byte immediate value; for example:
... KEY1=(PKY=#RR00K80)

This has the same effect as:

... KEY1=(R=RR00KEY,S=#RR00K80)

R
specifies a field in the LREC to be compared with the search argument specified with the S subparameter or to be tested against the mask specified with the M or D subparameter.

T
specifies a field in the subLREC of an extended LREC to be compared with the search argument specified with the S subparameter or to be tested against the mask specified with the M or D subparameter.

fldname
is the name of a field defined in the DSECT for the LREC; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,S=EBW000)

label1
is a 2-byte field containing the displacement into the LREC; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=EBX010,S=EBW000,L==H'4')

D/absval
specifies the displacement into the LREC of the field, where absval is an absolute value; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=D/2,S=EBW000,L=L'GR00NAM,UP)

You can also specify the absolute value implicitly; for example:

... KEY1=(PKY=#GR00K80),KEY2=(R=D/GR00NAM-GR00REC,S=EBW000,L=L'GR00NAM,UP)

literal
is a halfword literal containing the displacement into the LREC; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R==H'2',S=EBW000,L==H'4')

flddisp
is the displacement off the field of the LREC; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD+2,S=EBW000,L==H'4')

or

... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD+L'GR00FLD,S=EBW000,L==H'4')

C=condition
specifies the condition to be used when comparing fields in the logical record (specified with the R subparameter) with the search argument (specified with the S or PKY subparameter) or with the bit mask (specified with the M or D subparameter).

If you specify the S or PKY subparameter, use one of the following values:

Value
Condition
EQ
Equal (this is the default)
E
Equal
NE
Not equal
GE
Greater than or equal
LE
Less than or equal
GT
Greater than
LT
Less than
H
High
L
Low
NH
Not high
NL
Not low.

If you specify the M or D subparameter, use one of the following values:

Value
Condition
Z
Zeros
O
Ones
M
Mixed
NZ
Not zeros
NO
Not ones
NM
Not mixed.

D=dynmask
specifies the label of a 1-byte field containing a mask to be tested against the LREC field specified with the R or T subparameter; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,D=EBW000,C=Z)

M=mask
specifies a mask to be tested against the LREC field specified with the R or T subparameter; for example:
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,M=X'80',C=Z)

S=searcharg
specifies the search argument to be compared with the LREC field specified with the R or T subparameter, where searcharg is one of the following:
  • A register that contains the address of the search argument
  • A literal that represents the search argument
  • A label in one of the following formats:

    searcharg
    is the label of the search argument.

    A/searcharg
    is the label of a 4-byte field that contains the storage address of the search argument.

    P/searcharg
    is the label of a field that contains the search argument in packed decimal format.

    If you specify P/searcharg or a literal in the form of =P'...', the LREC field and search argument are compared as decimal numbers in packed format. Otherwise, the LREC field and search argument are compared as character data.

L=length
specifies the length of the search argument, where length is one of the following:
  • The address of a 2-byte field containing the length of the search argument
  • A 2-byte literal
  • An absolute value in the form of L'fldname (for example, L=L'GR92FLD).

The default value is the length of the field specified with the R subparameter.

UP
specifies that the key field is in ascending order in the subfile.

DOWN
specifies that the key field is in descending order in the subfile.

NOORG
specifies that the key field is in no particular order in the subfile.

KEYLIST=keyloc
specifies a key list that you want to use with this macro, where keyloc is one of the following:

See Setting Up and Using a Key List for information about how to set up a key list.

NOKEY
deactivates any currently active keys.

Notes:

  1. If the file is not open when you specify the NOKEY parameter, the DBDEL macro opens the file and deletes the first LREC.

  2. If the file is open and you specify the REF and NOKEY parameters, the DBDEL macro deletes the next LREC.

  3. If the file is open and you specify the FILE and NOKEY parameters, the DBDEL macro deletes the current LREC.

LAST
deletes the last LREC in a subfile.

If you specify KEYn parameters as well, the DBDEL macro deletes the last LREC that matches these keys.

LRECNBR=lrecnum
specifies the sequence number of an LREC that you want to access, where lrecnum is one of the following:

Notes:

  1. If you use the #TPFDB0D algorithm, you must specify this parameter.

  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 the LRECNBR parameter with KEYn parameters, only those LRECs that match the key conditions are included in the sequence numbering; LRECs that do not match are ignored.

NEXT
steps through and deletes LRECs from a subfile. If you do not specify any subparameters with the NEXT parameter, the DBDEL macro deletes the next LREC in the subfile after the current LREC.

LIST=lreclst
deletes a list of LRECs following the current LREC, where register is a register that contains the address of the list of the LRECs.

The list contains one or more LREC sequence numbers separated by a slash (/). You can also specify a range of sequence numbers by separating the beginning and end of the range by a hyphen (-). You can use LAST to mean the last LREC of the subfile and ALL to mean all the remaining LRECs. You can also end the list with a nonnumeric character.

Notes:

  1. The ranges must be in ascending order; if one is found out of order, that range and all subsequent ranges are ignored.

    For example, if there are 41 LRECs in a subfile, the following lists all have the same effect:

    20/31/32/33/37/38/39/40/41
    20/31/32/33/37-41
    20/31-33/37-LAST
    20/31-33/37/ALL
    

  2. You cannot specify the number zero in the list of LREC numbers, even if you specify the ADJUST parameter with a value that would adjust the number zero to a valid LREC number.

NODUMP
specifies that you do not want the TPFDF product to issue any of the following system errors while processing this macro:

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

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

NOPGM
specifies not to change the program stamp in a block when filing it.

PATH
specifies the path for a detail subfile using index support. If there is only one index path, do not specify this parameter. Specify one of the following:

pathnum
is the path number or the label of a 2-byte field that contains the path number. The number of index paths used is defined by your database administrator.

ALL
specifies all paths.

See TPFDF Database Administration for more information about path numbers.

REG=register
specifies a register in which to return the address of the current LREC (this address is contained in SW00SR field SW00REC). You must specify this parameter for T-type files.

REGD=register
specifies a register in which to return the base address of the userLREC part of an extended LREC.

SUBLREC
deletes some or all of the subLRECs in an extended LREC. Use one of the following to specify the range of subLRECs you want to delete:

sublrecnum
is the number of the subLREC from which you want to begin deleting.

Note:
The first subLREC in an extended LREC is 0.

num
is the number of subLRECs you want to delete.

FIRST
deletes the first subLREC (the latest one added to the extended LREC).

LAST
deletes the subLRECs to the end of the extended LREC (until the first subLREC added to the extended LREC).

ALL
deletes every subLREC in the LREC you have specified.

If you specify the ALL parameter (not as a subparameter of the SUBLREC parameter), the TPFDF product deletes the requested subLRECs in all the LRECs in the open subfile. For example, the following instruction deletes the first subLREC in every extended LREC in a subfile:

DBDEL REF=GR24DF,SUBLREC=(FIRST),ALL
Note:
When you specify the SUBLREC parameter, do not specify any of the access parameters (ALG, ORD, FADDR).

SUFFIX=char
allows you to use the same DSECT to map two different areas of storage, where char is the suffix character.

UP
specifies that the LRECs are organized in the subfile in ascending order of key fields.

DOWN
specifies that LRECs in the subfile are organized in descending order of key fields.

NOORG
specifies that the LRECs are organized in the subfile in no particular order. (NOORG is the default if subfile organization has not been defined in the DBDEF).

Entry Requirements

Before specifying the SUBLREC parameter, you must specify a DBRED macro to locate the extended LREC from which you want to delete the subLREC.

Normal Return

Error Return

Programming Considerations

Examples

Related Macros