EXAMPLES OF MPEX/3000 COMMANDS  

System Management | Managing Disk Space | Program Development | Database Management
File System Security | Job Stream Programming | Documentation  

(VESOFT Homepage)

An example is worth a thousand syntax diagrams. Here are only a few of the things you can do with MPEX. Remember, these examples are only the tip of the iceberg. There are many more features which are discussed further in the manual.

SYSTEM MANAGEMENT

%ALTFILE @.@(CREATOR="JOHN"); CREATOR=MANAGER

After you purge the user JOHN, this command will change all of his files to have creator ID (IDentification) MANAGER.

%ALTFILE @.DATA-CUST@.DATA(INTCODE=0); FLIMIT=EOF*1.5

Sets the file limit of the (MPE and KSAM) files in the DATA group (except for files that start with CUST) to be 50% greater than the current EOF.

%ALTSPOOLFILE $STDLIST.@.@(SPOOL.JSNAME="MCOMPILE"); PRI=8

Changes to 8 the output priority of all $STDLISTs belonging to jobs that logged on with job/session name MCOMPILE.

%COPY @.@.AP, @/=.@.APBACKUP; KEEPATTR

Copies all the files in the AP account into the APBACKUP account, preserving file attributes (e.g. creator ID, file limit, lockword, etc.).

%COPY @.DATA, =.=; YES; DEV=ROBIN#

Copies all the files in the group DATA (including IMAGE databases and KSAM files!) over a DSLINE (or NS LAN, etc.) to system ROBIN, purging any files that already exist with the same name.

%DELETESPOOLFILE $STDLIST.@.@(SPOOL.OUTPRI<=2)

Deletes all the $STDLISTs that have output priority 2 or less.

%LISTF MYFILE, ACCESS

Shows all the accessors of MYFILE: accessing program name, access job number/name, current record being accessed, etc.

%LISTF @.DATA, DISCUSE

Shows which devices the files in the "DATA" group reside on (invaluable if you're interested in disc balancing).

%MPEXSTORE @.@.@ - @.@.SYS - @.@.VESOFT &

(ACCDATE<TODAY-90 and NOT ISPRIV); *T; SHOW

%MPEXSTORE / - /SYS/ - @.@.VESOFT &

(ACCDATE<TODAY-90 and NOT ISPRIV); *T; SHOW (POSIX)

Implements the sophisticated MPEX FILESETS (with multiple "-"s, combining MPE & HFS syntax, selection criteria, etc.) on the MPE :STORE command.

%REPEAT

%>ECHO -----Formatting !MPEXCURRENTFILE

%>RUN MYFMT;INFO="!MPEXCURRENTFILE"

%>FORFILES X@.SOURCE

Performs a user-specified set of commands (here ECHO and RUN) on a fileset.

%SHOWOUT $STDLIST.@.@(SPOOL.OUTPRI=1)

Shows information on all $STDLISTs with output priority 1 in the system, including job number, job name, ready date, etc.

%SHOWOUTJ COMP010,@.PROD

Shows information on all the spool files created by a job that logged on with job name COMP010 in the PROD account.

                                                                                      Back to Top

MANAGING DISC SPACE

%ALTFILE @.@.@; XLTRIM; KEEPAMDATES (MPE/iX)

%ALTFILE / ; XLTRIM; KEEPAMDATES (POSIX)

On MPE/iX systems, this command releases a lot of currently unused disc space that has been allocated to files, without changing the capacity (FLIMIT) of the files in any way. (The "KEEPAMDATES" option tells MPEX not to change the last access/modify dates of any files it alters, so they won't appear on your next partial backup.)

%COPY @.@.MFG, =.=.MFGBACK

Makes a backup copy of the MFG account to the MFGBACK account.

%LISTF @.DATA(ISASCII and SAVABLESECTORS>100),2

Lists all the MPE ("flat") files that have FLIMIT greater than EOF and/or inefficient R/B (blocking factor); by SQUEEZEing and reblocking (BEST) them one might save more than 100 sectors on each file.

%ALTFILE RPT@.DATA(ISASCII); SQUEEZE

"Squeezes out" all the unused space between EOF and file limit in all blank-code files that start with RPT in the DATA group.

%EDIT @.SOURCE(CODE="EDTCT"), SET VARIABLE

Converts all EDITOR COBOL-format files in the SOURCE group to be variable record length files, saving 30-50% of the disc space while still leaving them editable, compilable, etc.

%LISTF @.@.@(ACCDATE<TODAY-120), 3

Finds all the files that haven't been accessed in the last 120 days and lists their names, access dates, modify dates, etc.; also shows total number of files and sectors.

%PURGE K#######.@.@+LOG####.@.@(CREDATE<TODAY-7)

Purges EDITOR K-files and system log files created more than a week ago. Prompts you for confirmation before purging anything!

%PURGE @.@.@ - @.@.VESOFT(ACCDATE<TODAY-120 and NOT ISPRIV)

%PURGE / - @.@.VESOFT(ACCDATE<TODAY-120 and NOT ISPRIV) (POSIX)

Purges all the non-privileged (mostly non-IMAGE) files that haven't been accessed in the last 120 days.

                                                                                   Back to Top

PROGRAM DEVELOPMENT

%COBOL AP@.SOURCE,AP@.PUB,*LP

Compiles using COBOL and :PREPs all the AP@.SOURCE files into program files with the same name in the PUB group. (Of course, the same works for FORTRAN, PASCAL, RPG, etc.)

%PRINT @.SOURCE;SEARCH="ITEM-NUM" or "ITEM-NAME" or "ITEM-DESC";NUM

Finds all the occurrences of the strings "ITEM-NUM" or "ITEM-NAME" or "ITEM-DESC" in all files in the SOURCE group. (Does your editor give you this kind of power?)

%PRINT @.SOURCE;SEARCH=DELIM "MYVAR";PREV="PROCEDURE" or "FUNCTION"

Prints all occurrences of the string "MYVAR" -- for each occurrence, also prints the last prior occurrence of the line that contains the strings "PROCEDURE" or "FUNCTION"; in other words, shows you all the lines that refer to "MYVAR" AND indicates what procedure they occur in!

The DELIM means that "MYVAR" will be searched for as a delimited string, i.e. surrounded by special characters (e.g. lines containing "TEMPMYVAR" or "MYVARIATION" will not be found).

%COBOL @.PRODSRC(FSEARCHEXP("'CUST-NO' or 'CUST-NAME'")>0), =.PUB

Recompiles all the files in PRODSRC that contain within them either the string CUST-NO or the string CUST-NAME!

%EDITCHG @.SOURCE, "ITEM-NO", "ITEM-NUMBER"

Changes all occurrences of "ITEM-NO" to "ITEM-NUMBER" in all files in the SOURCE group, KEEPing only those files that were actually changed.

%LISTF @.PRODSRC(MODDATE>3/15/91), 3

Finds all the files in PRODSRC that have been modified since 3/15/91 (perhaps the last production release date).

%PRINT @.SOURCE; OUT=*LP; PAGEHEAD; NUM

Prints all the SOURCE group files to the line printer (with page headers, nicely-formatted line numbers, etc.).

%COBOL @.PRODSRC(MODDATETIME>VEFINFO(FILE+".PUB").MODDATETIME), =.PUB

Compiles all the PRODSRC files whose modify dates (and times) are later than the modify dates (and times) of files with the same name in the PUB group (VEFINFO(FILE+".PUB").MODDATETIME). In other words, this recompiles all the programs that have been modified but not recompiled into PUB.

                                                                                     Back to Top

DATABASE MANAGEMENT

%ALTFILE CUST?#.DB(DBSETTYPE="D"); DEV=2

%ALTFILE CUST?#.DB(DBSETTYPE<>"D"); DEV=3

These two commands move all detail datasets of the CUST database to device2 and all non-detail datasets to device 3.

%ALTFILE @.@.AP(CREATOR<>"DBA" and ISPRIV); CREATOR=DBA

Changes the creator ID of all AP databases (ISPRIV) to be DBA, thus making sure that DBA -- and only DBA -- can run DBUTIL, DBSTORE, etc. against all those databases.

%COPY APDB@, DBNEW@; DEV=3

Copies the APDB database into a new database called DBNEW, moving all the files onto disc device 3.

%DBADGALT @.DB(DBSETFULLNESS>.8 and MODDATE>TODAY-30), 0.6

%DBGENALT @.DB(DBSETFULLNESS>.8 and MODDATE>TODAY-30), 0.6

%DBMGRALT @.DB(DBSETFULLNESS>.8 and MODDATE>TODAY-30), 0.6

Use ADAGER, DBGENERAL/BRADMARK, or DBMGR/DISC to alter the capacity of all datasets in the DB group that are currently more than 80% full (and have been modified within the last 30 days) so that they will only be 60% full.

%LISTF @.@.AP(DBSETFULLNESS>.70 and MODDATE>TODAY-7), DB

Shows database information (dataset name, type, capacity, etc.) for all datasets in the AP account that are more than 70% full and have been modified in the past week.

%RENAME MYDB@(ISPRIV), NEWDB@

Renames a database.

                                                                                    Back to Top

FILE SYSTEM SECURITY

%LISTF @.@.@(ISPROG and PROG.PMCAP), 5

Finds all the privileged-mode program files in the system and lists their program file information.

%LISTF @.@.PAYROLL(ACCDATE>=TODAY-2)

On Monday, this shows all files in the PAYROLL account that were accessed over the weekend.

%SECURE @.@.@(ISPROG and ISRELEASED and DIRGROUP.CAP("PM"))

Secures all the :RELEASEd program files in privileged groups (which are a SERIOUS THREAT to system security).

%LISTF @,SEC

Shows the "true" access to the file, factoring in both the group- and account-level restrictions as well as the file restrictions and the :RELEASE/:SECURE status.

                                                                                       Back to Top

JOB STREAM PROGRAMMING

!JOB JOBA,MGR.PROD
!RUN MAIN.PUB.VESOFT;PARM=1
%WHILE JSCOUNT("JOBB,MGR.PROD&BATCH")>0 DO
% PAUSE 120
%ENDWHILE
%EXIT

If the job JOBB,MGR.PROD is logged on, waits until it logs off before continuing execution of JOBA.

!JOB JOBA,MGR.PROD
!RUN MAIN.PUB.VESOFT;PARM=1
%WHILE VEFINFO("DATAFILE").OPENED DO
% PAUSE 120
%ENDWHILE
%EXIT

If the file DATAFILE is opened, waits until it is closed before continuing execution.

!JOB JOBA,MGR.PROD
!RUN MAIN.PUB.VESOFT;PARM=1
%SETVAR FNAME PRINTOPREPLY('Which file should we output to?')
%IF FEXISTS(FNAME) THEN
% IF PRINTOPREPLY('OK to purge file '+FNAME+'?')='Y' THEN
% PURGE !FNAME
% ENDIF
%ENDIF
%FILE MYOUTFIL=!FNAME,NEW;SAVE
%EXIT

MPE commands, UDCs and MPE/iX commands can be executed from MPEX as well.



                                                                                                                Back to Top

DOCUMENTATION

MPEX/3000 comes with a comprehensive user manual and on-line HELP facility.



VESOFT Homepage