TRS (Tape Record Scan)

Purpose
Locate data within a tape file.
Usage notes
You can use this function to locate tape records containing data that meet your search conditions. Scanning starts at the current tape position. Scanning applies to logical records, if a record size or a variable record format is indicated.
The search string can contain up to 50 characters and can be:
  • A character string. The string cannot contain blanks or commas. Case (uppercase or lowercase) is ignored.
  • A character string enclosed in quotation marks. The string can contain blanks and commas and must match exactly (including case).
  • A character string enclosed in quotation marks. The string can contain blanks and commas and must match exactly (including case).
  • A hexadecimal string, for example X'04'.

Specify a DDNAME for the tape.

For further information on the use of this function, see Tape Record Scan (option 4.10).

Options
Specify a record format or a length to deblock the physical records before searching. You can request searching everywhere in the data, from a position you specify or only at the specified offset. You can also specify the number of blocks to be scanned and the number of occurrences of the string to be found before the scan stops. The scan stops when the specified number of blocks is reached or when the specified number of string occurrences have been found, whichever occurs first.
Various SET processing options allow you to control the print output:
  • SET PRINTOUT defines the destination of the print output. If set to PRINTOUT=SYSOUT, you can use the PB (Print Browse) function to browse the accumulated output.
  • SET RECLIMIT controls how many bytes of each record are printed.
  • The format of the print output also depends on the settings of SET PAGESIZE, SET PRINTLEN, and SET PRTTRANS.
  • Use SET DUMP to specify the dump format.
Related functions
FCH
Find or change data
TP
Print a specified number of blocks from one or more files on a tape
Read syntax diagramSkip visual syntax diagram
Syntax

                                          .-RECFMIN=U-------.   
>>-TRS--+-----------+--+-INPUT=ddname--+--+-----------------+--->
        '-LABEL=BLP-'  '-OUTPUT=ddname-'  '-RECFMIN=recfmin-'   

                        .-SCANTYPE=D--------.   
>--+-----------------+--+-------------------+------------------->
   '-RECSIZE=recsize-'  '-SCANTYPE=scantype-'   

   .-SCANPOS=1-------.                    
>--+-----------------+--SCANARG=scanarg------------------------->
   '-SCANPOS=scanpos-'                    

   .-SCANHITS=1--------.  .-NLRECS=ALL----.   
>--+-------------------+--+---------------+--------------------><
   '-SCANHITS=scanhits-'  '-NLRECS=nlrecs-'   

ddname
Refers to a DD or TSO ALLOC statement.
LABEL=BLP
Specifies that bypass label processing is used. This parameter must be specified with the first Z Data Tools function that uses the tape. For BLP processing requirements, see “Customizing the Security Environment” in the Z Data Tools Customization Guide.
nlrecs
Number of records to be scanned or ALL. The maximum number is 99 999 999. If you specify ALL or omit the parameter, Z Data Tools scans to the end of the file or until the specified number of hits is found.
recfmin
Record format for the input. Each value is a combination of the following letters:
B
Blocked
D
Variable-length ISO/ANSI tape records
F
Fixed length
S
Spanned format
U
Undefined length
V
Variable length
The possible values are: U, F, FB, V, VB, VBS, VS, D, DB, DBS, and DS.
recsize
Length of the input records, if recfmin is F or FB. If recfmin is F, the length of the first record is used by default. If recfmin is FB, recsize is required.
scanarg
The string to be searched for. The string can contain up to 50 characters and can be:
  • A character string. The string cannot contain blanks or commas. Case (uppercase or lowercase) is ignored.
  • A character string enclosed in quotation marks. The string can contain blanks and commas; the string must match exactly (including case).
  • X followed by a hexadecimal string enclosed in quotation marks (for example, X'C1C2C3').
scanhits
Specifies whether scanning stops after the first match is found, after a specified number of matches, or at the end of the file. The maximum is 99 999 999; the default is 1. Specify ALL to scan to the end of the file.
scanpos
Offset (byte position) where the search begins within a record. The default is 1.
scantype
One of the following:
D
Scans records only at the position in the record specified by scanpos (the default)
DP
Scans records starting at the position specified by scanpos
//TRS JOB (acct),'name'  Tape Record Scan
//*
//HFMBAT    PROC
//HFMBAT    EXEC PGM=HFMMAIN
//STEPLIB  DD DSN=HFM.SHFMMOD1,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//         PEND
//*
//ZDTOOLS  EXEC HFMBAT
//SYSPRINT DD SYSOUT=*
//TAPE     DD UNIT=561,VOL=SER=FMO001,
//            DISP=SHR,LABEL=(,BLP)
//SYSIN    DD *
$$FILEM TRS INPUT=TAPE,SCANARG='HDR2'
$$FILEM EOJ
/*