vms batch processing loops
Joe Boyle
atla38 at dsl.pipex.com
Tue Jan 9 19:02:36 CST 2007
Some general loops from a couple of batch jobs are below, you might find
something of use there,
Job1
$!
$! trap theusers process settings so that when he/she crashes this file
$! might give us a clue why
$!
$set noon
$!
$! trap theusers process id so that it can be incorporated into the file
string
$!
$! @thesight$disk:[thesightmgr.pat]pats-tst-user.com
$!set veri
$!
$!
$ sho use theuser/full/out=thesight$disk:[thesightmgr.pat.data]pat.txt
$ open in thesight$disk:[thesightmgr.pat.data]pat.txt
$ loop:
$ read/end_of_file=endit in name
$ is_it_theuser = f$extract(0,7,name)
$ if is_it_theuser .eqs. " theuser" -
then gosub pats_processing
$ goto loop
$ endit:
$ close in
$ purge thesight$disk:[thesightmgr.pat.data]pat.txt
$!
$! i'm only interested in the most recent details
$!
$!
$ purge thesight$disk:[thesightmgr]pats-monitor-theuser.log/lo
$ purge thesight$disk:[thesightmgr.pat.data]pat-mir*.out*/keep=1000/lo
$ current_time = f$extract(12,11,f$time())
$ sho sym current_time
$!
$ if current_time .lts. "08:00:34.84" -
.or. current_time .gts. "18:30:34.84" then goto que_tomorrow
$!
$ submit/que=sys$compile -
/noprint/after="+00:10" -
thesight$disk:[thesightmgr.pat]pats-monitor-theuser.com
$ exit
$ que_tomorrow:
$ submit/que=sys$compile -
thesight$disk:[thesightmgr.pat]pats-monitor-theuser.com -
/noprint/after="tomorrow+08:30"
$ exit
$ pats_processing:
$ theusers_pid == f$extract(24,8,name)
$ sho sym theusers_pid
$!
$!
$ current_time_date_char_1 = f$extract(0,1,f$time())
$ if current_time_date_char_1 .eqs. " "
$ then
$ current_time_date = "0"+f$extract(1,10,f$time())
$ else
$ current_time_date = f$extract(0,11,f$time())
$ endif
$ sho sym current_time_date
$ current_time = f$extract(12,11,f$time())
$ sho sym current_time
$!
$ delete thesight$disk:[thesightmgr.pat.data]pats-*-dets.txt;*/lo
$ delete thesight$disk:[thesightmgr.pat.data]pats-*-accessed.txt;*/lo
$!
$ sho proc/identifi='theusers_pid'/all -
/quota/accountin/subproc -
/out=thesight$disk:[thesightmgr.pat.data]pat-mir.out'current_time_date'-'the
users_pid'
$!
$ sho proc/identifi='theusers_pid'/all -
/quota/accountin -
/out=thesight$disk:[thesightmgr.pat.data]pats-proc-dets.txt
$!
$ append thesight$disk:[thesightmgr.pat.data]pats-proc-dets.txt -
thesight$disk:[thesightmgr.pat.data]pat-mir.out'current_time_date'-'theusers
_pid'/lo
$!
$ sho dev /fil thesight$disk -
/out=thesight$disk:[thesightmgr.pat.data]pats-dkb0-files-accessed.txt
$!
$ sea thesight$disk:[thesightmgr.pat.data]pats-dkb0-files-accessed.txt -
/statistics -
'theusers_pid' -
/out=thesight$disk:[thesightmgr.pat.data]pats-theusers-files-accessed.txt
$!
$ append
thesight$disk:[thesightmgr.pat.data]pats-theusers-files-accessed.txt -
thesight$disk:[thesightmgr.pat.data]pat-mir.out'current_time_date'-'theusers
_pid'/lo
$!
$ accoun/full/identifi='theusers_pid'/sin -
/out=thesight$disk:[thesightmgr.pat.data]pats-acc-dets.txt
$!
$!
$ append thesight$disk:[thesightmgr.pat.data]pats-acc-dets.txt -
thesight$disk:[thesightmgr.pat.data]pat-mir.out'current_time_date'-'theusers
_pid'/lo
$!
$ return
Job2
$!set veri
$!
$! trap theusers process settings so that when he/she crashes this file
$! might give us a clue why
$!
$set noon
$set proc/priv=all
$!
$!
$ purge dkb0:[vxusr.sue]create_what_if_sched_1998*.log/nolog
$ dat2 = f$search ("dkb0:[vxusr.sue]create_what_if_sched_1998*.log",3)
$ if dat2 .eqs. "" then goto goeon2
$ tot_count = 0
$ cur_count = 0
$ start:
$ dat = f$search ("dkb0:[vxusr.sue]create_what_if_sched_1998*.log",2)
$ if (dat .eqs. "") then goto goeon
$ tot_count = tot_count + 1
$ goto start
$ goeon:
$! sho sym tot_count
$ if ( tot_count .lt. 2 ) then goto goeon2
$ start2:
$ dat = f$search ("dkb0:[vxusr.sue]create_what_if_sched_1998*.log",4)
$ cur_count = cur_count + 1
$ if ( cur_count .eq. tot_count ) then goto goeon2
$ ren 'dat' .pat_done
$ goto start2
$ goeon2:
$ if f$search("sys$login:pat-dev-full.file",7) .nes. "" -
then delete sys$login:pat-dev-full.file;*/nolo
$ if f$search("sys$login:pats-whatifa-day.out",6) .nes. "" -
then delete sys$login:pats-whatifa-day.out;*/nolo
$!
$ search_symbol =
f$search("dkb0:[vxusr.sue]create_what_if_sched_1998*.log",5)
$!
$ dir_date = ""
$ dir 'search_symbol' /out=sys$login:pats-whatifa-day.out/da=all/col=1
$ open in sys$login:pats-whatifa-day.out
$ loop:
$ read/end_of_file=endit in name
$!
$ if f$extract(35,1,name) .eqs. ":" -
.and. f$extract(38,1,name) .eqs. ":" -
.and. f$extract(41,1,name) .eqs. "." -
then dir_date = f$extract(21,11,name)
$! sho sym dir_date
$! sho sym search_symbol
$ goto loop
$ endit:
$ close in
$!
$ if search_symbol .eqs. "" then goto pats_processing
$! sho sym dir_date
$ sea 'search_symbol' device /out=sys$login:pat-dev-full.file/nol
$!
$!
$ open in sys$login:pat-dev-full.file
$ loop2:
$ read/end_of_file=endit2 in name
$ is_it_theuser = f$extract(0,10,name)
$ if is_it_theuser .eqs. "-rms-f-ful"-
then goto pats_processing
$ goto loop2
$ endit2:
$ close in
$!
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ write sys$output -
" ************************************************************************"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$out_line = -
" ** the whatifa process called on " + ''dir_date' + " was successful
**"
$ write sys$output out_line
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** this screen will clear in ten seconds **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ************************************************************************"
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ wait 00:00:10
$ set term/wid=80
$ exit
$!
$ pats_processing:
$!
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ write sys$output -
" ************************************************************************"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$out_line = -
" ** the whatifa process called on " + ''dir_date' + " was not successful
**"
$ write sys$output out_line
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** this screen will clear in ten seconds **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ** **"
$ write sys$output -
" ************************************************************************"
$ write sys$output " "
$ write sys$output " "
$ write sys$output " "
$ wait 00:00:10
$ set term/wid=80
$ exit
-----Original Message-----
From: powerh-l-bounces+atla38=dsl.pipex.com at lists.sowder.com
[mailto:powerh-l-bounces+atla38=dsl.pipex.com at lists.sowder.com] On Behalf Of
Etienne Rompré
Sent: 08 January 2007 20:20
To: powerh-l at sowder.com
Subject: old question : same problem
Hi to all!
It might be related to Powerhouse or not but I give it a shot!
Tools availables
PH 8.4 VMS
Cobol on VMS
OpenVms 7.3
RMS file
flat Text file
The problem:
A client send one or more text file via ftp.
The name will always be different.
I can't process the file 2 time.
The FTP process can't rename the file to NATWRRN.TXT since there might
be 2 files at the same time.
Question:
Is there a way in powerhouse or in VMS to know automaticaly when a file
is written in a directory and be able to process that file by name? Or
start a COM that could rename the file automaticaly when the file is
written and then start a QTP to import the file with a fixed name?
Thanks!
Etienne Rompré
Koala-Tech
--
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l at lists.sowder.com
Subscribe: "subscribe" in message body to
powerh-l-request at lists.sowder.com
Unsubscribe: "unsubscribe <password>" in message body to
powerh-l-request at lists.sowder.com
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Add 'site:lists.sowder.com powerh-l' to your search terms to search the list
archive at Google.
More information about the powerh-l
mailing list