46 Using IBM Application Development Tools for z/OS and OS/390
$$FILEM PROC=*
67 record(s) read
20 record(s) copied: 0 truncated: 0 fields truncated
What is happening in these jobs?
The File Manager program keyword DSC is used to invoke the data set copy function. The
input and output files are identified, and the keyword PROC is used to indicate that an in-stream
routine, either DFSORT or REXX, is being supplied.
DFSORT We know that DFSORT is being used by the presence of the *FASTPROC
statement. The routine is built using standard DFSORT program control
statements, as described in the DFSORT R14 Application Programming Guide
(SC26-7050-05). The INCLUDE statement uses a substring comparison test to
search for one of the listed values in column 3 of the input records. If found, the
record is copied to the output file; all other records are bypassed.
REXX The first line of the routine checks the contents of the record (using the function
FLD) starting in position 3 for a length of 1 in order to see if it matches one of the
listed values. If it does, the second line of the routine writes out the records to
the output file. Otherwise, the fourth line ignores the records.
Notice that in both examples the Data Control Block (DCB) information for the new file is
copied from the input file.
2.1.12 Search for a string in all members of a PDS
If you need to determine which members of a PDS contain a particular string, you can use
this utility.
The code to perform this function with File Manager is shown in Example 2-17.
Example 2-17 File Manager string find in a PDS batch step
//*
//* FILE MANAGER BATCH: SEARCH FOR STRING
//*
//STEP01 EXEC PGM=FMNMAIN
//STEPLIB DD DSN=FMN.V4R1M0.SFMNMOD1,DISP=SHR
//* DD DSN=IGY.SIGYCOMP,DISP=SHR
//SYSPRINT DD SYSOUT=*
//FMNTSPRT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//DDIN DD DISP=SHR,DSN=YOUR.CHANGE.MGMT.UAT.JCLLIB
//SYSIN DD *
$$FILEM FCH INPUT=DDIN,MEMBER=*,
$$FILEM PROC=*
IF CO(INREC,’UNIT=CART’) | ,
CO(INREC,’UNIT=TAPE’) THEN
RETURN
ELSE
RETURN ‘DROP’
/+
What is happening in this step
The File Manager utility FCH is used to invoke the Find/Change function.
Chapter 2. Introducing File Manager 47
The file, DDIN (the default input file for the FCH function) is the PDS you want to search.
The first two lines check for one of two strings. The fifth line ignores any records that do not
contain the strings.
Let us review the report output
The key portion of the batch job’s output report is listed in Example 2-18.
Example 2-18 Output from string find in a PDS batch job
IBM File Manager for z/OS and OS/390
$$FILEM FCH INPUT=DDIN,MEMBER=*,
$$FILEM PROC=*
IBM File Manager for z/OS and OS/390
Record-# Find/Change Listing DSN:DAVIN6.WORK.JCL
FABSERCH ---------- STRING(S) FOUND ----------
12s IF=(1,0,C’UNIT=CART’),
13s ORIF=(1,0,C’UNIT=TAPE’)
FMBSERCH ---------- STRING(S) FOUND ----------
14s IF CO(INREC,’UNIT=CART’) | ,
15s CO(INREC,’UNIT=TAPE’) THEN DO
IECD01 ---------- STRING(S) FOUND ----------
833s // DISP=(,CATLG,DELETE),UNIT=CART,EXPDT=99000,
862s // DISP=(,CATLG,DELETE),UNIT=CART,EXPDT=99000,
ISBSERCH ---------- STRING(S) FOUND ----------
9s SRCHFOR ‘UNIT=CART’
10s SRCHFOR ‘UNIT=TAPE’
TESTME ----------- member in use -----------
------- Find/Change summary section ------------------
Records found: 8 Records processed: 2744
Members w/recs: 5 Members wo/recs: 42
------- Find/Change statement section ----------------
IF CO(INREC,’UNIT=CART’) | ,
CO(INREC,’UNIT=TAPE’) THEN
RETURN
ELSE
RETURN ‘DROP’
Each of the members in which either one of the strings was found is listed. The lines on which
the strings were found are displayed.
Notice that our test file is still in use; no search was performed on this member (otherwise, the
string would have been found there as well).
The summary statistics appear at the end of the report, along with a display of the search
commands.
Get Using IBM Application Development Tools for z/OS and OS/390 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.