22 Using IBM Application Development Tools for z/OS and OS/390
Proceeding with the copy, in Figure 2-6 we now see the result of the selection of only those
records with ‘04’ in columns 1 and 2 — only 12 records have been copied.
Figure 2-6 Results of selection
2.1.5 How to perform a global find and replace in a PDS
File Manager’s Find/Change Utility allows you to search for or change a string in a partitioned
data set (PDS), a VSAM data set, or a sequential file.
Scenario: global update of JCL
This section describes both online and batch approaches to the global update of a JCL deck.
Using File Manager online
This scenario presents the succession of panels to change all references of one user ID to
another in all the members of a library. You reach the File/Change Utility panel by selecting
option 3.6 on the Main panel of File Manager and entering data in the appropriate fields as
shown in Figure 2-7.
In this scenario, we want to change all the members (* in the Member field) of the library
REDBK2.FM.CNTL. Since we know all these members are source JCL, we enter a “/ in the
JCL Source format field.
Chapter 2. Introducing File Manager 23
Figure 2-7 File/Change utility panel
Then we enter the change command C REDBK2 PETERH ALL on the command line and we
press Enter. As we did not ask for Immediate change, we get a confirmation panel displaying
all the proposed modifications as shown in Figure 2-8.
Figure 2-8 Proposed modifications
To confirm the changes, press F3, followed by Enter to save or F3 to cancel. After
confirmation, File Manager completes the job as shown in Figure 2-9. We see that 12
changes have been made in 3 members.
24 Using IBM Application Development Tools for z/OS and OS/390
Figure 2-9 Confirmation of changes
You can then refer to the listing data set, SRCHFOR.LIST, for the details of the changes.
Using File Manager in batch
Example 2-1 presents the batch job generated by File Manager to change all references of
one user ID to another, in all the members of a library.
Example 2-1 Batch job to change one user ID to another
//*
//FILEMGR 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=*
//SYSIN DD *
$$FILEM FCH ,
$$FILEM MEMBER=*,
$$FILEM LIST=SUMMARY,
$$FILEM JCL=YES,
$$FILEM DSNIN=REDBK2.FM.CNTL
BNDS 1 80
CAPS OFF
C REDBK2 PETERH ALL
/+
Tip: The first time you ask File Manager to perform a find/change, request a “batch
execution” (insert a ‘/’ in this field on the panel referenced in Figure 2-1 on page 19, and
save the displayed JCL in your JCL library. You then can reuse it as needed.
Chapter 2. Introducing File Manager 25
More complex scenario
We decided to use the File Manager function Data Set Copy (DSC), along with some simple
REXX code, to perform a very selective global find and replace.
Assume the following scenario: As a production support specialist, you need to help an
application developer set up a portion of a job stream for a User Acceptance Test (UAT).
You need to take the production job card members, not the procedures, that were created for
production, and convert them to UAT standards. The changes depicted in Table 2-1 need to
be made.
Table 2-1 JCL modifications to make in selected members of a PDS
Any job that invokes the program FTP must be copied, but must not be changed. These jobs
contain the string XMIT2 in the accounting information parameter of the JOB card. To ensure
that no transmission occurs, the program name in the procedure will be changed from FTP to
IEFBR14. How to make this change is not covered as part of this scenario.
How to set up the batch job
We decided to pre-allocate a separate output file for the changed members. The Job Control
Language (JCL) is shown in Example 2-2.
Example 2-2 Batch job to search for string
//*
//* 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=DAVIN6.SVLSAMP.JCL
//DDOUT DD DISP=SHR,DSN=DAVIN6.SVL@UAT.JCL
//SYSIN DD *
$$FILEM DSC INPUT=DDIN,MEMBER=*,
$$FILEM OUTPUT=DDOUT,REPLACE=YES,
$$FILEM PROC=*
IF LEFT(INREC,3) <> ‘//*’ THEN DO
SELECT
WHEN CO(INREC,’ JOB ‘) & ,
CO(INREC,’XMIT2’) THEN DO
PRINT(‘MEMBER NOT CHANGED BECAUSE IT IS FTP’,’CHAR’)
RETURN
END
WHEN CO(INREC,’ PROC ‘) THEN DO
PRINT(‘MEMBER NOT COPIED BECAUSE IT IS A PROC’,’CHAR’)
RETURN ‘STOP IMMEDIATE’
END
Field From To
OPC user ID ZOPCPRD ZUATUSR
MSGCLASS S J
Symbolic MODEP=’P’ MODEP=’U’
Member name Do not copy if it ends in “T”

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.