Change all occurrences with JCL and FileManager

File-AID from Compuware and File Manager from IBM.
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Change all occurrences with JCL and FileManager

Post by nico56 »

Hello Folks,

I usually change files using FileManager through ISPF interface. Now I need to do this in a JCL. Via ISPF interface, I enter in FM option, 2 (Edit), open the file (VSAM) and execute command "change 'string1' 'string2' all". The strings have the same length. Do you know how to do this in a JCL?

Regards!
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

I am trying with this JOB but when I run it, I get an error for missing or invalid control card.

Code: Select all

//JOBSIT1 JOB (999),'PROGRAMMER',
//            CLASS=A,
//            MSGCLASS=X,
//            NOTIFY=&SYSUID,
//            COND=(0,NE)
//STEP1    EXEC PGM=FILEMGR
//SYSPRINT DD SYSOUT=*
//SYSIN DD * 
$$FILEM DSP DSNIN='PPG.TEST.LEKS.VS.CONTR',
$$FILEM CHANGE 'XXX' 'YYY' ALL
/*
//
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Change all occurrences with JCL and FileManager

Post by enrico-sorichetti »

what happened when You looked at the manual or pressed the PF1 key for interactive help ?
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

I didn't find it :S
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

enrico-sorichetti wrote:what happened when You looked at the manual or pressed the PF1 key for interactive help ?
Hello enrico-sorichetti, I looked in the manual (PDF) and interactive help but I didn't get the answer. In the interactive help I read about command "CHANGE" but there is no information how to use it in a JCL. I don't even know how to make reference to the file.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Change all occurrences with JCL and FileManager

Post by Robert Sample »

I'm looking at the FileManager manual and it indicates DSP is Data Set Print. Perhaps if you look in the manual at FCH (Find / CHange) instead of DSP, you would get further?
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

The manual is really difficult to use if one doesn't know how to search. Is there any tutorial? :(
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Change all occurrences with JCL and FileManager

Post by Robert Sample »

Google is your friend. Googling file manager tutorial returns plenty of hits which you can go through to your heart's content. Furthermore, if you had bothered to check the FCH section of the File Manager manual (starting on page 1023 of the z/OS 13 manual) you could have found this example of how to use the CHANGE command in batch:

Code: Select all

//FMUSRFCH JOB  (@TS2,MVS6),’FMNUSER’,NOTIFY=FMNUSER,
//  CLASS=A,MSGLEVEL=(1,1),MSGCLASS=H
//FMNBAT   EXEC PGM=FILEMGR
//STEPLIB  DD  DSN=FMNUSER.FMN110.TSTLOAD,DISP=SHR
//         DD  DSN=FMN.V1R1M0.TSTLOAD,DISP=SHR
//         DD  DSN=FMN.V1R1M0.SFMNMOD1,DISP=SHR
//         DD  DSN=FMN.IGYV1R20.SIGYCOMP,DISP=SHR
//SYSPRINT DD SYSOUT=*
//FMNEXEC  DD DSN=FMN.EXEC,DISP=SHR
//FMNTSPRT DD SYSOUT=*
//FMNIN    DD DSN=FMNUSER.JCL.TESTING,DISP=SHR
//SYSTERM  DD SYSOUT=*
//SYSIN    DD *
$$FILEM FCH ,
$$FILEM INPUT=FMNIN,MEMBER=J*
F ’rights reserved’
C ’Copyright 2001-2002’ ,
’Copyright 2001-2003’ 1 71
C ’Alpha Company Ltd’ ,
’Alpha Beta Company Ltd’ 1 71
C ’Beta Company Ltd’ ,
’Alpha Beta Company Ltd’ 1 71
/+
/*
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Change all occurrences with JCL and FileManager

Post by nicc »

And please do not post on multiple forums - there are answers on the other forum where I found your post.
Regards
Nic
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Change all occurrences with JCL and FileManager

Post by Anuj Dhawan »

IBM File Manager does have the capability to execute all the commands in batch too. It allows you to generate a Job of your choice - suggest you should also try generating the JCL and use that for future reference. IBM File Manger is, usually, tailored differently for different shop however the batch Job generated "automatically" will take care about any custom adjustment for your shop... fwiw.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

Anuj Dhawan wrote:IBM File Manager does have the capability to execute all the commands in batch too. It allows you to generate a Job of your choice - suggest you should also try generating the JCL and use that for future reference. IBM File Manger is, usually, tailored differently for different shop however the batch Job generated "automatically" will take care about any custom adjustment for your shop... fwiw.
Hello, Anuj! Yes, I read about all commands what you executes in FileManager have that capability, buy How do you generete that JCL?
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

Robert Sample wrote:Google is your friend. Googling file manager tutorial returns plenty of hits which you can go through to your heart's content. Furthermore, if you had bothered to check the FCH section of the File Manager manual (starting on page 1023 of the z/OS 13 manual) you could have found this example of how to use the CHANGE command in batch:

Code: Select all

//FMUSRFCH JOB  (@TS2,MVS6),’FMNUSER’,NOTIFY=FMNUSER,
//  CLASS=A,MSGLEVEL=(1,1),MSGCLASS=H
//FMNBAT   EXEC PGM=FILEMGR
//STEPLIB  DD  DSN=FMNUSER.FMN110.TSTLOAD,DISP=SHR
//         DD  DSN=FMN.V1R1M0.TSTLOAD,DISP=SHR
//         DD  DSN=FMN.V1R1M0.SFMNMOD1,DISP=SHR
//         DD  DSN=FMN.IGYV1R20.SIGYCOMP,DISP=SHR
//SYSPRINT DD SYSOUT=*
//FMNEXEC  DD DSN=FMN.EXEC,DISP=SHR
//FMNTSPRT DD SYSOUT=*
//FMNIN    DD DSN=FMNUSER.JCL.TESTING,DISP=SHR
//SYSTERM  DD SYSOUT=*
//SYSIN    DD *
$$FILEM FCH ,
$$FILEM INPUT=FMNIN,MEMBER=J*
F ’rights reserved’
C ’Copyright 2001-2002’ ,
’Copyright 2001-2003’ 1 71
C ’Alpha Company Ltd’ ,
’Alpha Beta Company Ltd’ 1 71
C ’Beta Company Ltd’ ,
’Alpha Beta Company Ltd’ 1 71
/+
/*
Robert, the problem with those examples is I can not understand them. In this example, what are you trying to do? Do you always have to write $$FILEM FCH , or $FILEM <COMMAND> and in the other lines the parameters? I don't get what are you trying to do with MEMBER anyway :S.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Change all occurrences with JCL and FileManager

Post by Robert Sample »

Me? I am doing NOTHING -- this example is straight out of the IBM manual and attributing anything about it to me is wrong. The example is working with a PDS named FMNUSER.JCL.TESTING -- and specifically only the members of this PDS that start with J -- and is finding occurrences of "rights reserved" in those members. The example is also changing "Copyright 2001-2002" to "Copyright 2001-2003" in columns 1 through 71 of the selected members of the PDS; changing "Alpha Company Ltd" to "Alpha Beta Company Ltd" in the same columns for the same members and changing "Beth Company Ltd" to "Alpha Beta Company Ltd" in the same columns for the same members.

This is not rocket science -- I've never had reason to use File Manager (although I do have extensive experience with File Aid) and hence my analysis is based purely upon understanding IT concepts and principles, and knowing mainframe data sets. If you cannot figure out what the File Manager JCL is doing from inspection, you REALLY need to ask yourself if you might want to pursue a career in a different field as this example JCL is pretty simple yet you have great difficultly in comprehending it. This example shows you how to write a change command in File Manager batch -- you should be able to experiment with it to determine the answers to your questions yourself. Make a back up copy of your data set so you can recover should you find the changes you try don't work as expected. If your data set is not a PDS, remove the MEMBER=J* from the sample JCL. Change the INPUT DD statement to point to your data set. Take out the FIND command. Test your changes.

And, finally, if you wish to ever become a professional IT person (as opposed to being a paid amateur like now), you need to learn how to read manuals, interpret syntax diagrams and find things out for yourself. Requiring your information to be spoon-fed to you does not improve your skills and definitely makes you less desirable to employers than someone who can figure things out themselves.
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

Robert, I get this all the time

Code: Select all

0FMNBA091 Missing or invalid control card
0FMNBA092 Parameter $$FILEM missing
0FMNBE098 Keyword verification discontinued for any subsequent command
This is my code (relevant part):

Code: Select all

//SYSIN    DD *
$$FILEM FCH ,
$$FILEM INPUT=FMNIN,
C 'XXX' 'YYY' 0 50
/+
/*
I deleted "MEMBER" because is a VSAM file, and I specified columns between 0 and 50 because equals the length of all record (instead of ALL like the original command).
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Change all occurrences with JCL and FileManager

Post by Robert Sample »

Code: Select all

$$FILEM FCH ,
$$FILEM INPUT=FMNIN,MEMBER=J*
F ’rights reserved’
is what the manual has;

Code: Select all

$$FILEM FCH ,
$$FILEM INPUT=FMNIN,
C 'XXX' 'YYY' 0 50
is what you posted. Note that your code has a trailing comma on the second $$FILEM statement while the manual example does not. Details like this are important. You will probably also get an error in attempting to change column 0 which doesn't exist -- the value is not an offset but a column number, and the manual specifically states the value must be 1 or higher. If I wanted to change the occurrences in the entire record, I would completely remove the starting and ending columns from the CHANGE command -- why complicate the processing if not needed?
nico56
New Member
Posts: 9
Joined: Sat Jun 06, 2015 4:27 am

Re: Change all occurrences with JCL and FileManager

Post by nico56 »

Thanks Robert. You could be more nice in your answers, specially if this is a beginner forum.

Regards
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Change all occurrences with JCL and FileManager

Post by nicc »

This is not a beginners forum. There is another forum elsewhere that is for beginners.
Regards
Nic
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Change all occurrences with JCL and FileManager

Post by enrico-sorichetti »

I usually change files using FileManager through ISPF interface.
it should mean that You KNOW HOW to use file manager

remember ...
we reply ON OUR TIME and FOR FREE
so it is our right to expect that people asking have done their homework

a paid consultant has the need and is expected to pick up all the s**t that the customer throws at him
we do not :mrgreen:

more time spent to show You what You should already know :mrgreen:
when You went to the file manager screen where it asks for the dataset name
did You notice ....

Code: Select all

  Process   Options   Help
 ──────────────────────────────────────────────────────────────────────────────
 File Manager                 Find/Change Utility
 Command ===>                                                       Scroll PAGE

 Input Partitioned, Sequential or VSAM Data Set, or HFS file:
 Data set/path name  ENRICO.MFTESTS.PS                               +
    Member . . . . .              (Blank - selection, pattern - process list)
    Volume serial  .              (If not cataloged)
    Record count . .               Number of records to be searched
 + Additional options
 Process List:
 Sel Name     Prompt       Alias-of     Size Created  Changed           ID
    ****  End of data  ****
 
and after positioning the cursor on the +

Code: Select all

  Process   Options   Help
 ──────────────────────────────────────────────────────────────────────────────
 File Manager                 Find/Change Utility
 Command ===>      C FROMSTRING TOSTRING                            Scroll PAGE

 Input Partitioned, Sequential or VSAM Data Set, or HFS file:
 Data set/path name  ENRICO.MFTESTS.PS                               +
    Member . . . . .              (Blank - selection, pattern - process list)
    Volume serial  .              (If not cataloged)
    Record count . .               Number of records to be searched
 - Additional options
 Listing data set  . ENRICO.FM.LIST

 Enter "/" to select option                        Listing Option  ISPF Packing
   JCL Source format           Immediate change    1 1. Long       3 1. Asis
   Use REXX proc             / Batch execution       2. Summary      2. Pack
   REXX no update            / Directory integrity                   3. Unpack
   Advanced member selection   Stats off                             4. None
   Binary mode, reclen         CAPS initially on                     5. Skip


 Process List:
 Sel Name     Prompt       Alias-of     Size Created  Changed           ID
    ****  End of data  ****
 
and if You had chosen the batch option

Code: Select all

 EDIT       ENRICO.SPFTEMP1.CNTL                            Columns 00001 00072
 Command ===>                                                  Scroll ===> PAGE
 ****** ***************************** Top of Data ******************************
 000001 //ENRICOB JOB (ESYZ),
 000002 //             ENRICO,MSGCLASS=A,
 000003 //             NOTIFY=ENRICO,CLASS=A,
 000004 //             MSGLEVEL=(1,1)
 000005 //*
 000006 //FILEMGR  EXEC PGM=FMNMAIN
 000007 //STEPLIB  DD DSN=FMN.SFMNMOD1,DISP=SHR
 000008 //*        DD DSN=IGY.SIGYCOMP,DISP=SHR
 000009 //*FMNCOB   DD DUMMY    Uncomment to force use of FM COBOL Compiler
 000010 //*FMNCLERR DD SYSOUT=* Uncomment to force output of Compiler listing
 000011 //SYSPRINT DD SYSOUT=*
 000012 //FMNTSPRT DD SYSOUT=*
 000013 //SYSTERM  DD SYSOUT=*
 000014 //SYSIN    DD *
 000015 $$FILEM FCH ,
 000016 $$FILEM PACK=UNPACK,
 000017 $$FILEM DIRINTEGR=YES,
 000018 $$FILEM DSNIN=ENRICO.MFTESTS.PS
 000019 C FROMSTRING TOSTRING
 000020 /+
 ****** **************************** Bottom of Data ****************************
a proper error free icl snippet would have been generated

the +/- is sticky, it is kept in your Filemanager ISPF profile data

If You want to keep receiving help on any forum
You will have to definitely change Your attitude
otherwise Your chances of getting help will be almost non existent
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Change all occurrences with JCL and FileManager

Post by Anuj Dhawan »

Thanks for the detailed explanation Enrico.
Last edited by Anuj Dhawan on Wed Jun 17, 2015 3:20 pm, edited 1 time in total.
Reason: Moved the topic to File-AID and IBM File Manager part of the Forum.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Change all occurrences with JCL and FileManager

Post by enrico-sorichetti »

for this TS the same consideration done here apply
http://www.zmainframes.com/viewtopic.php?f=35&t=1458

he asked a question, got a reply with a detailed explanation and did not care to acknowledge
these people have no place in a civil forum :evil:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “File-AID and IBM File Manager.”