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
Figure 1. Syntax

1 TRS? LABEL=BLP
1 INPUT=ddname
1 OUTPUT=ddname
1! RECFMIN=U
1 RECFMIN=recfmin
3? RECSIZE=recsize
1! SCANTYPE=D
1 SCANTYPE=scantype
1! SCANPOS=1
1 SCANPOS=scanpos
5 SCANARG=scanarg
1! SCANHITS=1
1 SCANHITS=scanhits
1! NLRECS=ALL
1 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 File Manager function that uses the tape. For BLP processing requirements, see “Customizing the Security Environment” in the File Manager for z/OS 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, File Manager 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
//*
//FMBAT    PROC
//FMBAT    EXEC PGM=FILEMGR
//STEPLIB  DD DSN=FMN.SFMNMOD1,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//         PEND
//*
//FILEMGR  EXEC FMBAT
//SYSPRINT DD SYSOUT=*
//TAPE     DD UNIT=561,VOL=SER=FMO001,
//            DISP=SHR,LABEL=(,BLP)
//SYSIN    DD *
$$FILEM TRS INPUT=TAPE,SCANARG='HDR2'
$$FILEM EOJ
/*