T.R | Title | User | Personal Name | Date | Lines |
---|
368.1 | A stupid script from me (what else ;') | HYPERS::VICKERS | If it helps a customer, DO IT | Tue Mar 31 1992 01:15 | 32 |
| Below is a script which I use to blow away old documents on my ALL-IN-1
account. It is a really crude and poor imitiation of the JAN_CLEAN tool
which used to be in ASSETS.
It requires that the user enter the folder name and purge date on a
form called NBSDATE. This trivial form loads the $BLOW_FOLDER and
$BLOW_NBSDATE symbols with the folder name and NBS date.
I am sure that others can give you better tools so this will serve as a
mere starter:
! Blow_Em.SCP Blow away the old documents
!
FORM NBSDATE
.IF OA$FORM_DISPOSE NE 2 THEN .EXIT
!
DECIMAL I
DISPLAY Working ...
FORCE
GET #I = 0
FOR CAB$ WITH .FOLDER == $BLOW_FOLDER AND -
.MODIFIED_NBS:8 LT $BLOW_NBSDATE DO -
GET #DOCKEY = .FOLDER:30 .DOCNUM\\-
CABINET DELETE_DOCUMENT #DOCKEY\\-
.IF OA$STATUS THEN COMPUTE #I = #I + 1
!
GET OA$DISPLAY = #I ' documents deleted'
!
! [End]
Have fun,
don
|
368.2 | "Take a look at note 317, might help" | BODRUM::YEGEN | | Tue Mar 31 1992 11:00 | 9 |
| I thought that you might take a look at note 317 in which I managed to
enter to the filecabinets of the users and change two specific
chracters in all documents (documents, attachments, mails) into two
other specific characters. This might give you some programming ideas,
too.
Best regards,
TANSU
|
368.3 | doesn't run in batch mode | CGOOA::IUS | Donald V. Ius - DTN: 638-6927 | Fri Apr 03 1992 22:12 | 84 |
| Hi,
Thanks for the helpful suggestions. I've been to the customers site
and have successfully created a set of scripts that do what we want
while running interactively, but the customer wants of course to run
this procedure at night in batch mode.
I tried to produce a script & command procedure that would do as
requested, but I find that it works fine when I run it from DCL in a
command procedure, but nothing happens when running it as a batch job.
Ths job starts up just fine, but then it seems to just sit there.
The following are samples of the procedures I am using. If anyone can
spot what I am doing wrong, I'd sure appreciate your help.
Thanks again...
- Start_cleanup.com - First command procedure calleds from DCL or
submitted to batch.
$ allin1/noinit -
/override -
/reenter -
/user=manager
oa$ini_init
script oauser:start_cleanup
.exit
$ exit
- Start_cleanup.scp - invoked from command procedure above.
.function do oauser:cleanup
- Cleanup.scp - called from the above script.
.LABEL Start
GET #DATE_NBD="1992010100000000"
GET OA$DCL="OPEN/WRITE OUTLOG CLEANUP.LOG"
GET #TEXT = "Beginning Cleanup procedure at " OA$DATE_FULL
GET OA$DCL="WRITE OUTLOG " """" #TEXT """"
FOR PROFIL DO GET #NEWUSER = .USER\\-
GET OA$FUNCTION="NEWDIR " #NEWUSER\\-
GET #TEXT = "Checking documents for user: " #NEWUSER\\-
GET OA$DCL="WRITE SYS$OUTPUT " """" #TEXT """"\\-
GET OA$DCL="WRITE OUTLOG " """" #TEXT """"\\-
DO SYS$SYSDEVICE:[ALLIN1.MGR]CHECK_FOLDER
!end for
GET OA$FUNCTION="NEWDIR"
GET OA$DCL="CLOSE OUTLOG"
.EXIT
- Check_folder.scp - Called from the above script.
.LABEL Start
CABINET OPEN
DECIMAL I
GET #I = 0
GET #FOLDER = "READ"
CABINET SELECT #FOLDER,,,#DOCKEY
.IF OA$STATUS == 0 THEN No_More
.LABEL NEXT_Doc1
.IF OA$CURDOC_MODIFIED_NBS LTS #DATE_NBD THEN .GOTO DEL_Doc1
CABINET NEXT_DOCUMENT #FOLDER, #DOCKEY
.IF OA$STATUS == 1 THEN .GOTO NEXT_Doc1
.GOTO No_More
.LABEL DEL_Doc1
GET #FILENAME = OA$CURDOC_FILENAME
GET $TITLE = OA$CURDOC_TITLE !DCL symbol needed
COMMAND SYS$SYSDEVICE:[ALLIN1.MGR]NO_QUOTE !Strip any " from title
GET #TEXT='Title : $TITLE ' Filename: ' #FILENAME
GET OA$DCL="WRITE SYS$OUTPUT " """" #TEXT """"
GET OA$DCL="WRITE OUTLOG " """" #TEXT """"
CABINET DELETE_DOCUMENT #DOCKEY
.IF OA$STATUS == 1 THEN COMPUTE #I = #I + 1
CABINET NEXT_DOCUMENT #FOLDER, #DOCKEY
.IF OA$STATUS == 1 THEN .GOTO NEXT_Doc1
.GOTO No_More
.LABEL No_More
GET OA$DCL-"WRITE SYS$OUTPUT " """" #I """" " documents deleted"
.EXIT
|
368.4 | Go directly to DO CLEANUP, do not collect $200 | BUFFER::VICKERS | If it helps a customer, DO IT | Fri Apr 03 1992 22:46 | 12 |
| I'm not sure whether the SCRIPT mode script will be taken from the
stack so I suggest just executing the DO script. I suggest changing
the line:
script oauser:start_cleanup
line to:
DO oauser:cleanup
I hope this gets you somewhere,
don
|
368.5 | Just in case... | HOTAIR::MADDOX | DIGITAL Alien | Fri Apr 03 1992 23:02 | 4 |
| If Don's suggestion doesn't fix your problem (whom am I kidding?) then I would
suggest that you include a log file on a job that you start, let run for
awhile and then kill. It might provide a clue as the whether it's in a loop
or hung up on a command, etc.
|
368.6 | a little more... | CGOOA::IUS | Donald V. Ius - DTN: 638-6927 | Tue Apr 07 1992 01:20 | 26 |
| >If Don's suggestion doesn't fix your problem (whom am I kidding?) then I would
>suggest that you include a log file on a job that you start, let run for
>awhile and then kill. It might provide a clue as the whether it's in a loop
>or hung up on a command, etc.
I'm sorry to have to ask this, but how do I "... include a log file
..."? I submitted this to batch with a batch log file but nothing
beyond the first lines of the command procedure were recorded in 12
hours.
I imagine that is not the log file you are referring to.
Also, I originally tried the DO script directly from the command
procedure but that didn't work either. I read somewhere that I may
need to call OA$SUB_OPEN first. Could this be the problem? The
interesting thing is that the output log file that I am trying to
generate does get created, however the only thing in it is the first
statement that indicates the cleanup procedure was begun at a certain
date. This seems odd to me that it could get that far but no farther.
As always, any help is greatfully appreciated.
/Don I.
P.S. The customer is running ALL-IN-1 V2.3. Could this make a
difference?
|
368.7 | Try tracing from an interactive session | 57826::VICKERS | If it helps a customer, DO IT | Tue Apr 07 1992 04:21 | 19 |
| V2.3 shouldn't be an issue in this regard.
You might want to improve the Record Selection Expression in your FOR
so that you skip over the distribution lists but I doubt that this will
correct the rather strange effect you are seeing:
FOR PROFIL WITH .MAIDES NES "MAIL-LIST" DO GET #NEWUSER = .USER\\-
It's not clear from your description as to whether the code is looping
or freezing. I am guessing that it may be looping and suggest that you
turn on tracing of SCRIPT, MESS, and SYMBOL via the GOLD % keys and
have the output go to the screen. Interactively invoke your script and
see if you can see anything exciting and/or interesting occurring.
You might wish to change the trace to go to A1TRACE.LOG if there is a
great deal of information.
Let us know what you discover,
don
|
368.8 | it works interactively... | CGOOA::IUS | Donald V. Ius - DTN: 638-6927 | Tue Apr 07 1992 18:55 | 13 |
| Thanks for the suggestions,
When I run this script interactively it works just fine. It is only
when this is done in "batch" mode that it doesn't work. It appears
that it may be looping while waiting for something else to happen.
Unfortunately, I can't look at this right now as everything is at the
customerr site and I don't have immediate access to a system here that
I can test with. I'll look around to see if I can do some more testing
locally then get you more information.
Thanks,
/Don I.
|
368.9 | Nits and a suggestion | MDCRAB::HOWARD | Ben. It should do what people expect it to do | Wed Apr 08 1992 23:24 | 28 |
| I do notice two things which might or might not be relevant:
1. $ allin1/noinit -
/override -
/reenter -
This might indicate that some is already using the account. ALL-IN-1
doesn't know what to do in that case, which is why /NOREENTER is the
default.
2. .IF OA$STATUS == 0 THEN No_More
Missing .GOTO
You might want to put in some bookmarks which will tell you how far it
is getting, e.g.,:
.LABEL Start
DISPLAY Step 1
FORCE
GET #DATE_NBD="1992010100000000"
This should force "Step 1" to appear in the .LOG file for the job.
Incidentally, you could do the WRITE stuff with TEXT_FILE without using
the sub-process. The syntax is practically the same as DCL.
Ben
|