bdfp1m2lProgramming Concepts and Reference

DBSRT-Sort a Subfile

Use this macro to sort logical records (LRECs) in an open subfile.

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.

INPUTREF=irefname
specifies the reference name of the input subfile, where irefname is one of the following:

INPUT=inputaddr
specifies the base address of the SW00SR slot of the input file.
Note:
This parameter is supported for migration purposes only; where possible, always use the INPUTREF parameter to identify the input subfile.

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.

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.

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.

FULLFILE
sorts LRECs from the entire input file (not from a single subfile) to the output subfile specified with the REF parameter.

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:

R
specifies a field in the LREC to be used for placing the LRECs in the output file.

T
specifies a field in the subLREC of an extended LREC to be used for placing the LRECs in the output file.

fldname
is the name of a field defined in the DSECT for the LREC; for example:
... KEY1=(R=GR00FLD)

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

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

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

... KEY1=(R=D/GR00NAM-GR00REC,L=L'GR00NAM,UP)

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

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

or

... KEY1=(R=GR00FLD+L'GR00FLD,L==H'4')

L=length
specifies the length of the field to be used in placing the LRECs in the output file, where length is one of the following:
  • The label of a 2-byte field containing the length of the field
  • 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.

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.

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

POOLTYP
overrides the pool type defined by the database administrator, where:

0
uses the pool type defined by the PF0 parameter of the DBDEF macro.

1
uses the pool type defined by the PF1 parameter of the DBDEF macro.

2
uses the pool type defined by the PF2 parameter of the DBDEF macro.

type
is the label of a 1-byte field that contains a 0, 1, or 2 to specify to pool type.

Use the POOLTYP parameter as directed by the database administrator.

RELEASE
releases the SW00SR slot for the input subfile after the macro has completed processing.

RELFC
releases the input subfile and deletes it from DASD. All overflow blocks are released. If the file is a pool file, the prime block is also released. If the file is a fixed file, the prime block is initialized to empty.

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

Entry Requirements

Both subfiles must be opened before you call the DBSRT macro.

Normal Return

None.

Error Return

 See Identifying Return Indicators and Errors for information about how to check the error indicators. 

Programming Considerations

Examples

Related Macros

DBMRG-Merge Logical Records from Two Subfiles.