IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to execute a .bat file using JCL?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
atulbaviskar

New User


Joined: 08 May 2008
Posts: 8
Location: Mumbai, India

PostPosted: Thu Apr 04, 2013 5:42 pm
Reply with quote

In my shop, i have to delete .txt files older than 7 days say kept in Perticulart folder (My Documents) and various other criteria, I used MS-DOS command and kept all dos commands in .txt and saved it as .bat file. It works fine when run standalone..i want to automate this process to include in my shop batch cycle. Is there any way i can achieve this any sample JCL?

Appreciate your help. Thanks.

Atul
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Apr 04, 2013 5:44 pm
Reply with quote

Quote:
.i want to automate this process to include in my shop batch cycle. Is there any way i can achieve this any sample JCL?


how do You plan to have zOS and windoze talk to each other ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 04, 2013 5:51 pm
Reply with quote

To add to enrico's comment, if this is on your desktop and not a server, then you have at least two issues:
1) desktops don't normally run server software to let them be connected to from a mainframe, and
2) desktops don't normally get fixed IP addresses so if your mainframe is supposed to connect to it, how does the mainframe determine the IP address to use?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Apr 04, 2013 6:00 pm
Reply with quote

if Your organization wants to enforce rules to handle the data stored on the workstations
the proper approach would be to investigate the use of a DISTRIBUTED STORAGE MANAGER

not to endorse anything but just to quote
IBM Tivoli Storage Manager is one
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 6:02 pm
Reply with quote

Hopefully you are not talking about your own PC, as that can't be part of Production.

Somewhere you must have some network/PC support people. Talk to them. If you already have files coming from the Mainframe which you now want to do "housekeeping" on, then you have to find out how it is being done, and what are reasonable options for automatically managing the files once they are there.

I'd not put them in "MyDocuments" anyway. Even if not run as a "PC" per se, there's too much danger of someone saying "MyDocuments on an unattended machine? It's OK to get rid of those...". If run as a PC, the "user" could more easily idly delete files they didn't "recognise" but which someone wanted.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu Apr 04, 2013 8:37 pm
Reply with quote

Atul,

Check your company email...
Back to top
View user's profile Send private message
atulbaviskar

New User


Joined: 08 May 2008
Posts: 8
Location: Mumbai, India

PostPosted: Fri Apr 05, 2013 10:21 am
Reply with quote

Actually, my requirement is to delete the files older than 7 days kept at production folder. Executing a .bat files using below MS-DOS command would be manual process -

FORFILES /P U:\FILES /S /M DCM*.txt /D -7 /C "cmd /c del @file /Q"

I want to automate this process to include in daily batch cycle.
Back to top
View user's profile Send private message
atulbaviskar

New User


Joined: 08 May 2008
Posts: 8
Location: Mumbai, India

PostPosted: Fri Apr 05, 2013 10:50 am
Reply with quote

Here..the folder My documents is just for rerrenced, the real folder name would be of Prod server.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Apr 05, 2013 11:28 am
Reply with quote

Use the Windows Scheduler.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Apr 05, 2013 12:08 pm
Reply with quote

or CRON if it's installed
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 05, 2013 12:10 pm
Reply with quote

is this one a company directive or a personal whim ???
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Apr 05, 2013 1:27 pm
Reply with quote

Quote:
is this one a company directive or a personal whim ???


atulbaviskar wrote:
Actually, my requirement is to delete the files older than 7 days kept at production folder.


But does that really matter?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 05, 2013 1:33 pm
Reply with quote

it does make a difference IMO

if it is a personal whim
then using JCL is inappropriate

if it is a company directive
I already told my opinion about the proper approach using a distributed storage manager


but really the TS just cared about the lowly technicalities
without caring about the overall logic

for example
is the PC a server or a personal workstation ???
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Apr 05, 2013 2:56 pm
Reply with quote

@TS
If you want to delete the files on production server after checking the mainframe batch cycle completion, then I would try using windows Scheduler as Peter said.

Here is a crude approach assuming u have FTP connection from prod server to mainframe.

1. make mainframe batch cycle to create a dummy tracking file on mainframe with date once batch cycle is successfully over.
2. on the windows production server side, make windows scheduler to trigger a FTP GET of the tracking file created by batch cycle.
3. check the tracking file if it has the desired date and kick off the batch file to delete 7 days old files.
Back to top
View user's profile Send private message
atulbaviskar

New User


Joined: 08 May 2008
Posts: 8
Location: Mumbai, India

PostPosted: Fri Apr 05, 2013 4:28 pm
Reply with quote

Hi Vasanthz,

It is company directive.
As per Pt. 3 again would be a manual process. My shop wants it to be automate and run in every batch cycle.

In my shop a proc say PLACE run thru a job and using ICETOOL keep the DATA in path that was passed from job. The path is prod folder.

//STPC100 EXEC PGM=ICETOOL,ACCT='C=0'
//*------------------------------------------------------*
//* COPY FILE DATA *
//*------------------------------------------------------*
//IN01 DD DSN=TEMP.DATA.FILE,DISP=SHR
//OT01 DD PATH='&PATH.DATAFILE.TXT',
// PATHDISP=(KEEP,DELETE),
// PATHMODE=(SIRWXG,SIRWXU,SIRWXO),
// PATHOPTS=(OCREAT,ORDWR,OTRUNC)

This is a daily job and the folder is dumped with reports, there is no date with file name, the MS-DOS commands that I have mentioned in previous threads checks for modified date and delete the files older than 7 days.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 05, 2013 4:37 pm
Reply with quote

things get more and more confusing
what are YOU talking about...

<something> stored on a PC
or <something> stored on a zOS UNIX SYSTEM SERVICES Filesystem ???
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Apr 05, 2013 4:52 pm
Reply with quote

Quote:
As per Pt. 3 again would be a manual process.

Nope, write a program to do the checking, dont do it manually.

Quote:
<something> stored on a PC
or <something> stored on a zOS UNIX SYSTEM SERVICES Filesystem ???

@TS you need to explain your answer to this question
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 05, 2013 5:12 pm
Reply with quote

atulbaviskar: so far you have explained NOTHING about what you are wanting to do, and you are ignoring questions posed to you. Merely repeating the same lines is not answering questions; find a different way to explain what you are wanting to accomplish. Unless and untill you answer -- completely and fully -- these questions, there is no chance that you will get help on this forum:

1. Are you talking about Windows or Unix?
2. Are you talking about a server or a desktop machine?
3. If Windows, why will Windows Scheduler not do what you want?
4. If Unix, why will CRON not do what you want?
5. How are you planning on connecting the mainframe to the remote machine -- FTP? REXEC? something else you haven't explained?
Back to top
View user's profile Send private message
atulbaviskar

New User


Joined: 08 May 2008
Posts: 8
Location: Mumbai, India

PostPosted: Mon Apr 08, 2013 11:41 am
Reply with quote

1. Windows
2. Server
3. I don't have access to windows scheduler
4. No Unix
5. That's what i am not sure off, how would i connect but is there way to achieve this.

My requirement is to delete the report files oldar than 7 days placed in Server folder.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 08, 2013 11:58 am
Reply with quote

Quote:
That's what i am not sure off, how would i connect but is there way to achieve this.


Pulling info from You is like pulling teeth

lets' s start from the beginning

1) how do the files originate ?
1a) locally
1b) downloaded/transmitted from them MF

for case 1a
what kind of connectivity is in place between the MF and the windoze system

for case 1b
what software is used to download/ transmit them

why haven' t You spoken yet to ...
network support, for connectivity and file transfer tools in place ?
windows server support to ask them to do it using windows tools ?
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Mon Apr 08, 2013 5:52 pm
Reply with quote

If this was not for production, my advice would be to use the ISPF Workstation Agent. You could use the "WSCMD" ISPF service to execute your bat file once a connection is established to your workstation.

I doubt that your Operations department would consider this approach to be robust enough for production however.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 08, 2013 9:03 pm
Reply with quote

Hello,

Why does someone believe this remote file cleanup should involve the mainframe?

Suggest you consider working with your pc/network support people to implement a "clean-up" process that does Not involve the mainframe.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Apr 08, 2013 9:19 pm
Reply with quote

dick scherrer wrote:
Hello,

Why does someone believe this remote file cleanup should involve the mainframe?

Because the LUW analysts can't/won't do it icon_razz.gif

We have a process that sounds identical to what you are looking for, Atul-kun (which we wrote because the LUW analysts couldn't do it). If I have time I'll research it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top