bdfp1m2f | Programming Concepts and Reference |
Use this macro to read a logical record (LREC) or block header and get the address where the record is stored. You can read the next LREC in sequence or specify details of the LREC you require.
You can also use this macro to read a sequence of LRECs. In this case, you perform a sequence of DBRED macro calls and get a different LREC each time.
Format
|
Notes:
|
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:
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.
The user data is defined in the DBDEF macro of the detail subfile. See TPFDF Database Administration for more information about defining this user data.
Notes:
If you specify the HEADER and FULLFILE parameters on an open subfile, the DBRED macro retrieves the header of the next subfile.
See TPFDF Database Administration for information about how bits 4 and 5 in the &SW00OP2 global set symbol in the DSECT macro, or the OP2= parameter in the DBDEF macro, affect hold processing.
Use this parameter when you want to read each LREC in a subfile sequentially.
Notes:
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.
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.
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:
... KEY1=(PKY=#RR00K80)
This has the same effect as:
... KEY1=(R=RR00KEY,S=#RR00K80)
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,S=EBW000)
... KEY1=(PKY=#GR00K80),KEY2=(R=EBX010,S=EBW000,L==H'4')
... 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)
... KEY1=(PKY=#GR00K80),KEY2=(R==H'2',S=EBW000,L==H'4')
... 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')
If you specify the S or PKY subparameter, use one of the following values:
If you specify the M or D subparameter, use one of the following values:
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,D=EBW000,C=Z)
... KEY1=(PKY=#GR00K80),KEY2=(R=GR00FLD,M=X'80',C=Z)
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.
The default value is the length of the field specified with the R subparameter.
See Setting Up and Using a Key List for information about how to set up a key list.
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:
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
Notes:
See Messages (System Error, Online, Offline) and Master Glossary for more information about these system errors.
See TPFDF Database Administration for more information about path numbers.
Entry Requirements
If you specify the PREVIOUS, STACK, or STACKREF parameter, you must first open the subfile using the DETAC or HOLD parameters.
Normal Return
If the specified LREC is located, the address of that LREC (the current LREC) is loaded into the SW00REC field of the SW00SR slot. If you specify the REG parameter, the address is also loaded into the register that you specify. For P-type files, the current LREC is the address of the block that contains the record.
Error Return
If you use the FULLFILE parameter, and the end-of-file indicator is set, you cannot issue additional TPFDF macros until the file is closed. However, you can specify the REUSE parameter on the DBCLS macro. See Identifying Return Indicators and Errors for information about the end-of-file indicator.
Programming Considerations
If you need this type of key definition, you must use a key list.
#DO INF DBRED REF=GR22DF,FULLFILE,HEADER * Start of next subfile * #DOEX DBEOF,YES * Exit if end of file * DBRED KEYLIST=EBW0000 * Access record in subfile * #EDO
Examples
DBOPN REF=GR44DF DBRED REF=GR44DF,ALG==C'ALDER'
SW01SR REG=R5 ADDRESSABILITY TO KEY LIST GR95SR REG=R4 PROTOTYPE LREC STRUCTURE LA R4,EBW004 BASE OF PROTOTYPE LREC MVI GR95KEY,X'80' SEARCH FOR PKY X'80' MVC GR95NAM(5),=C'SMITH' SEARCH FOR NAME OF SMITH MVC GR95CTY(8),=C'NEW YORK' SEARCH FOR CITY OF NEW YORK LA R5,EBX000 LOAD BASE OF DBKEY TABLE XC EBX000(L'SW01NKY+L'SW01KIT),EBX000 CLEAR KEYLIST AREA MVC SW01NKY,=H'1' SET UP 1 KEY (READ-ONLY) DBSETK BASE=R5,KEYNUM=1,MSK=I/X'06',SEA=EBW004,ID1=#DF_KEYS DBRED REF=IR73DF,KEYLIST=EBX000 ACTIVATE KEY LIST
SW01SR REG=R5 LA R5,EBX000 LOAD BASE OF DBKEY TABLE XC EBX000(L'SW01NKY+2*L'SW01KIT),EBX000 CLEAR KEYLIST AREA MVC SW01NKY,=H'2' DBSETK BASE=R5,KEYNUM=1,DIS=I/2,LEN=I/1,CON=#DF_EQ,MSK=X'80', * ID1=#DF_UP+#DF_CONST,ID2=#DF_OR DBSETK BASE=R5,KEYNUM=2,DIS=I/6,LEN=I/4,SEA=EBW000,ID1=#DF_UP DBKEY REF=IR73DF,KEYLIST=EBX000 ACTIVATE KEY LIST DBRED REF=IR73DF
MVC EBW000(4),=C'TZ35' Department number MVC EBW004(10),=C'HARRISON ' Name of employee DBRED ...,KEY1=(PKY=#PR17K80),KEY2=(T=PR17DNR,S=EBW000),KEY3=(R=PR17NAM,S=EBW004)
MVC EBW000(L'PR20FLT),PR20FLT Flight number MVC EBW007(L'PR20BRD),PR20BRD Board and off point DBRED ...,KEY1=(PKY=#PR25K80),KEY2=(R=PR25FLT,S=EBW000,L=L'PR20FLT+L'PR20BRD)
Related Macros