Proc Command [P]
Calls an external subroutine and passes it lines to examine, update, delete, or split. Qedit has two built-in routines to downshift and upshift lines, DOWN and UP.
PROC[name] [ S|P|G|PP|PG ] [ rangelist ]
[ DOWN | UP ]
(Q=reset workspace)
(Defaults: previous proc)
Except when name is one of the built-in routines (DOWN, UP), name must be a procedure in an SL file to be dynamically loaded and then called. If you omit name, PRoc calls the most recent procedure name (at startup this is DOWN). The procedure is only actually “loaded” the first time you mention it. Qedit keeps the procedure loaded as long as it can. Since DOWN and UP are part of Qedit, they need not be loaded from an SL, nor can they be unloaded. Use Verify Proc to list the current procedures.
Maximum
Set Limits Proc n determines the maximum number of procedures which Qedit will keep loaded for you at a time. The default is four. When you exceed the limit, Qedit unloads the one least-recently used. Normally, Qedit unloads procedures when needed to make room for new routines that you have asked to load. However, if you are using an Interface routine also, Qedit does not unload any of your procedures. That is because Qedit allows you to combine interface routines and Proc routines in the same routine and install both with a single Loadproc. The Qedit display will show that the Proc is gone, and you will no longer be able to call it, but it will not be unloaded. You will not be able to purge it from the SL unless you Exit from Qedit.
Proc passes each line of the rangelist to the procedure and updates the line upon return. If you omit rangelist, Proc passes a dummy line with all blanks and line number of ” ? ” instead; this allows you to call procedures without having a workfile Open.
For DOWN and UP, the default rangelist is the current line (*); PQ shifts quietly (i.e., without printing the lines); and PJ shifts with user verification (i.e., PJ prints each shifted line and asks you to approve it).
The library search options for the Proc command are as follows:
PROC procname S | Sl.Pub.Sys only |
PROC procname P | logon Sl.Pub then Sl.Pub.Sys |
PROC procname G | logon group, then Sl.Pub, then Sl.Pub.Sys |
PROC procname PP | Sl.Pub in Qedit program account |
PROC procname PG | SL in Qedit program account and group |
Built-In PROCs to Shift Up or Down
The Up and Down Procedures put Roman-8 characters into uppercase or lowercase if Set Editinput Extend is On. Otherwise, they only operate on A-Z and a-z.
The first time that you use Down or Up after running Qedit, they ask you to configure them. There are 4 options: 1 means to shift every alpha character in the lines, 2 means to skip over characters enclosed in double quotes (“), 3 means to skip over characters enclosed in single quotes (‘), and 4 means to skip over characters enclosed in either double quotes or single quotes. If Down (or Up) finds a line with unmatched quotes, it prints a warning and stops (unless the lines are part of a COBOL program, in which case unmatched quotes are okay).
/open qedit.doc {open document file} /list 415.1 {display a line} 415.1 You will need to Purge the old file. /proc down 415.1 {try it lowercase} Set Shift DOWN? 1(@) 2(") 3(') 4(" or ') [0]:2 415.1 you will need to purge the old file. /proc up 415.1 {try it uppercase} Set Shift UP? 1(@) 2(") 3(') 4(" or ') [0]:2 415.1 YOU WILL NEED TO PURGE THE OLD FILE. /proc down {lowercase is better} /proc 410/415 {downshift some more lines} /pq 420/1002 {many more! quietly} /pj up 1003 {upshift with approval} 1003 >GET D-LINE (Okay?) yes
If you always configure the shifting routines to the same option (e.g., skip strings with double quotes), you can use Set Shift to define the configuration:
/set shift down 2 up 2
User-Written PROCs
Besides the two built-in PROCedures UP and DOWN, you can invoke any number of user-written PROCedures from SL files (four of these can be loaded at one time).
The QLIB contributed library contains two PROCedures: FINDJUNK to remove nonprinting characters from lines, and NEATER to align COBOL fields to specific columns. The easiest way to use them is to copy SL.QLIB into your logon account and/or group:
/:run fcopy.pub.sys >from=sl.qlib.robelle;to=sl;new >exit /open memos {open document with junk in it} /proc findjunk,g,first/10 {cleanup start of current file} /proc 1/50 {cleanup some more lines} /p findjunkq,g,51/last {cleanup the rest quietly} /:qhelp qlib.help.robelle,contr,findj {check manual} /open cobsrc {open a cobol source file} /p neater40,g,12.3/14 {adjust some data division} /:qhelp qlib.help.robelle,contr,neater /p findjunk 2.1/2.4 {remove some phone junk too!}
For detailed instructions on coding user procedures, consult the index.