| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |
WRQ Sponsor Message


Emptying the Mailbag

By Steve Hammond

Editor’s note: Steve had an early deadline this month. At the time other contributors were putting the finishing touches on their articles, Steve was sitting somewhere in the Caribbean in baggy shorts, a t-shirt bearing a snide comment, and Ray Bans sipping a cool beverage, which most likely had a little paper umbrella in it. Therefore this month’s offering will be the old stand-by, the fake mailbag column.

Dear MPEX Answer Man: Is there a way I can determine whether an MPEX command was successful or more importantly, how many files it was able to act upon? I have a job stream that I want to test some values before it proceeds.
— Jackie in Jacksonville, FL

Dear JJ: You have come to the right place for that information. MPEX offers some great JCWs to test.
I have a job that nightly copies five databases (with a total of 33 root files and datasets) to a backup group before starting a process that could update any or all of those databases. If there is a problem with any of the COPY commands, we want the job to stop. To do that test, we did the following:

!run mpex.pub.vesoft;parm=1
setvar success 0
setvar fail 0
setvar success = mpexnumsucceeded + success
setvar fail = mpexnumfailed + fail
showvar mpexnumsucceeded,mpexnumfailed,success,fail
setvar success = mpexnumsucceeded + success
setvar fail = mpexnumfailed + fail
showvar mpexnumsucceeded,mpexnumfailed,success,fail
(through three more databases and associated setvar’s)
!if SUCCESS <> 33 or FAIL > 0
! tellop ***********
! tellop * Problem with copy of databases, possibly
! tellop * one of the databases is open
! tellop * Check the the STDLIST. Job Terminating
! tellop * Restream the job when the problem has been solved.
! tellop ***********
! eoj

Now what this basically does is it first creates two variables — SUCCESS and FAIL — and initializes them to 0. Then the copying of each database begins. After each copy, the value in MPEXNUMSUCCEEDED is added to SUCCESS and the value in MPEXNUMFAILED is added to the value of FAIL. After all the databases are copied, both those new variables are tested. One thing to remember here is that if a database is open, there will be a database global block or DBGB open with the database. The properties of the DBGB will be such that MPEX’s attempt to copy it will fail.

So coming in, we know that SUCCESS should be 33 and FAIL should be 0. If a database is open, FAIL will be greater than 0. If a copy fails because of space, etc, then SUCCESS will not be equal to 33. Nice little use of the MPEXNUMSUCCEEDED and MPEXNUMFAILED variables, eh? Well, yes and no. The tests are real slick except when you add a dataset to one of the databases and forget to change the job stream. This usually results in a late night phone call, which we all hate!

Dear MPEX Answer Man: As one of the last steps in a project I am working on, I had to recompile all the programs, which was tedious. Then I discovered that I had forgotten to PREP each of them with MR capabilities. Now I have to go back and do this all over again. Can you help?
— Mixed-up Morgan in Ladd, AR

Dear Mix: You too have come to the right place! First of all, when you get time, look at the section of the MPEX manual titled “Using MPEX to Compile Programs”. That will tell you how to use MPEX to make the compile process much faster. But since you’re at this point, I’ll show you how to fix things from here. ALTFILE may be the most powerful MPEX command, since it let’s you alter any number of file attributes. Here, assuming all the programs are in the group OBJECT.PROD, you just %ALTFILE @.OBJECT.PROD(ISPROG);CAP=+MR

Viola! Your programs (only programs were done because of the attribute ISPROG) now have had MR capability added. An even more interesting trick is %ALTFILE @.OBJECT.PROD(ISPROG);CAP=+MR,-PM. That one added MR and remove PM capabilities in the same fell swoop.

Dear MPEX Answer Man: Every fiscal year I have to store off an account, clear out all the files and then rebuild them all over again. This is a mind-numbing process and I always miss creating a file or I build a file wrong and I have to come back and clean up my errors. I could write a script to do it all, but I was hoping MPEX could help me.
— Over-worked Karol in Menzie, KY

Dear OK: There is nothing I find more rewarding to write (aside from this column) than a nice script that performs multiple functions with intermediate tests to ensure everything is progressing properly. But forget all that. MPEX has a fairly new command called ERASE. This will erase the contents of all the target files but still leave the file structure (record size, ASCII vs. Binary, blocking factor, etc.) intact. It’s like the purge without the final step of deleting the file! You will still need something to take care of any databases, such as Adager or DBGeneral, but your MPE files are now empty.

Dear MPEX Answer Man: I have just started dating a programmer. He seems like a nice enough guy, but he appears to have no sense of humor. Is there something wrong with him? When he does laugh, it seems to be at all the wrong places. Is it me?
— Confused Kate in Hammond, IN

Dear Confused: You don’t say what kind of programmer he is. If he does all this Web or Java or Python or whatever endangered species they have named a programming language after this week, then give up now. He’s a lost cause. But if he’s a COBOL or FORTRAN or machine language programmer, then he’s a virile (I almost said viral), intelligent, thoughtful individual. An example of good programmer humor — Why do programmers confuse Halloween with Christmas? Because OCT31 = DEC25! [Insert mocking hysterical laughter at an old joke]

A better example — go into MPEX and execute the command %CALENDAR @;PICTURE
For you Trekkers (note: the difference between a Trekkie and a Trekker is that the latter has a job, therefore if you are reading this you most likely are gainfully employed), try %LISTF @,N1701.
Well, that’s all for this month. Mr. MPEX Answer Man now must retire to the balcony to watch the sun set over some seascape.

Steve Hammond, who works for a professional association in Washington, DC, could say he was forced to take this vacation against his will, but he would be lying.

Copyright The 3000 NewsWire. All rights reserved.