| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |

     

Do It Yourself with LISTF

By Steve Hammond

Inside VESOFT covers tips and techniques you can use with VESOFT’s products, especially MPEX.

I like to consider myself something of a do-it-yourselfer. I would expound on my credentials in that field, but I am afraid my wife would request rebuttal time. (Really, honey, I will finish those shelves in the basement THIS weekend. Really.)

So several years ago, when a user came to me with a request for a special LISTF format, I was ready to meet the challenge. (Warning: Obscure Canadian reference in next sentence.) And like Red Green and his trusty duct tape, I knew that the best tool for the job is MPEX. You have the ability to create your own LISTF formats with MPEX, although you need a little bit of programming skill, but that’s not a problem for any of us.

The user wanted to be able to see on a single line, the file name (fully qualified), the number of records in the file, the blocking factor and the date created. You ask why? Here’s this month’s “Helpful Hint for Beginners” — if someone asks for something totally outrageous, remember the old adage about trying to teach a pig to sing — it wastes your time and annoys the pig. In other words, don’t ask why, just consider it a challenge and do the task, because you don’t want to know why they need this.

Anyway, I knew I could define my own LISTF format in MPEX, so it’s just a matter of a few commands and some basic understanding of programming and logic. My first pass at this LIST format was:


FOR RFILE IN MPEXFILESETTOTAL
DO
BEGIN
WRITELN (FILE:8,
".",
GROUP:8,
".",
ACCOUNT:8,
" ",
EOF:6,
" ",
BLOCKFACTOR:6,
" ",
CREDATE:8
);
END;

The elements of this command, or what really becomes a command file, are fairly simple. The “FOR RFILE...” line goes back to one of the basic principles of MPEX we’ve discussed — every MPEX command is really a command acting upon an indirect file. In other words, DO whatever is between the BEGIN and the END on each file (RFILE) in this list (MPEXFILESETTOTAL). And between BEGIN and END, we write a line (WRITELN) that consists of the file name (allowing 8 characters FILE:8), a period, the group name, a period, the account name, two spaces, the end of file, two spaces, the blocking factor, two spaces and finally the creation date. I named the file PIG. The output of the command: %LISTF STEP@, ^PIG is:

PAGE 1
STEVE,MANAGER.SYS,PUB ***, *** **, 2004, *:** PM

ACCOUNT= SYS GROUP= PUB

STEP1 ..PUB .SYS 7 3 20 OCT 99
STEP11 .PUB .SYS 7 1 05 APR 00
STEP2 ..PUB .SYS 7 3 20 OCT 99
STEP3 ..PUB .SYS 7 3 20 OCT 99
STEP4 ..PUB .SYS 15087 1 08 MAR 00

GROUP TOTAL: 5 FILES 2 MEGABYTES 8464 SECTORS

Note to invoke the custom LISTF format PIG, you must precede it with a caret (more on how to avoid that later). Also note that you get no headings. You get the standard MPEX page, user, date and account/group headers and total footer, but nothing telling what these columns are — you got an idea on name and there’s a date at the end, but that’s about it. So you take this PIG and start to make the silk purse out of it without much trouble. MPEX lets you put in header lines of your own, with the syntax MPEXHEADERn:=”.....” For example, I added:

MPEXHEADER1:="Special LISTF for Office of Obfuscation";
MPEXHEADER2:="";
MPEXHEADER3:=" File Name EOF BLK Creation Date";
FOR RFILE IN MPEXFILESETTOTAL

at the start of the PIG (you can only have three headers). You need to play with the positioning of the column labels, adding spaces here and there. But I got this:

%listf step@,^pig
MPEX %LISTF step@ PAGE 1
STEVE,MANAGER.SYS,PUB ***, *** **, 2004, *:** PM

ACCOUNT= SYS GROUP= PUB

Special LISTF for Office of Obfuscation
File Name EOF BLK Creation Date
STEP1 ..PUB .SYS 7 3 20 OCT 99
STEP11 .PUB .SYS 7 1 05 APR 00
STEP2 ..PUB .SYS 7 3 20 OCT 99
STEP3 ..PUB .SYS 7 3 20 OCT 99
STEP4 ..PUB .SYS 15087 1 08 MAR 00

GROUP TOTAL: 5 FILES 2 MEGABYTES 8464 SECTORS

Now that’s downright ugly. I don’t need the MPEX footers! Remember that the command starts with FOR RFILE IN MPEXFILESETTOTAL. Just change MPEXFILESETTOTAL to MPEXFILESETHEAD, and you get:

%listf step@,^pig
MPEX %LISTF step@ PAGE 1
STEVE,MANAGER.SYS,PUB ***, **** **, 2004, *:** PM

ACCOUNT= SYS GROUP= PUB

Special LISTF for Office of Obfuscation
File Name EOF BLK Creation Date

STEP1 ..PUB .SYS 7 3 20 OCT 99
STEP11 .PUB .SYS 7 1 05 APR 00
STEP2 ..PUB .SYS 7 3 20 OCT 99
STEP3 ..PUB .SYS 7 3 20 OCT 99
STEP4 ..PUB .SYS 15087 1 08 MAR 00

You actually have three options on that keyword — MPEXFILESET, MPEXFILESETHEAD and MPEXFILESETTOTAL. The first gives you nothing except that in the WRITELN command, the second gives you the same with the page header and the third gives you that plus the totals. So, if you declare MPEXHEADERn and use MPEXFILESET, the headers you define are ignored (like most things, I learned this one the hard way).

Comments are always nice and you can add them to your LISTF formats just as easily. Precede any comment with “(*” and follow it with “*)”. So our final LISTF format looks like:

(* This LISTF format was created by Steve Hammond *)
(* It was created for the Office of Obfuscation and *)
(* he has no idea why it was created this way. *)

MPEXHEADER1:="Special LISTF for Office of Obfuscation";
MPEXHEADER2:="";
MPEXHEADER3:=" File Name EOF BLK Creation Date";
FOR RFILE IN MPEXFILESETHEAD
DO
BEGIN
WRITELN (FILE:8,
".",
GROUP:8,
".",
ACCOUNT:8,
" ",
EOF:6,
" ",
BLOCKFACTOR:6,
" ",
CREDATE:8
);
END;

You may want to compile your LISTF and put it into production. Just put it in the group LISTF.VESOFT and you can reference from anywhere on the system, without the “^”. Run it one time and you will now see not only PIG, but PIG8 with a file code of 176. This is a compiled LISTF file — compiling it helps performance. But be careful, an upgrade to the software could delete or remove your special LISTF files. I always kept the source of them in a separate group in the VESOFT account — cleverly named “STEVE”. But that meant I could always recover them, since an upgrade never removed that group.

There are a variety of other things you can do with customized LISTFs, sorts, or booleans. The manual will help with all that.

Steve Hammond, who works for a trade association in Washington, DC, has respect for Canadians. He just wishes they would get on with it and move the Expos to DC!


Copyright The 3000 NewsWire. All rights reserved.