Return to Mainframe Utilities Page
Module
ISREDIT MACRO (HELP) ISPEXEC CONTROL ERRORS RETURN /**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/ ISPEXEC VGET (DBGSWTCH) PROFILE IF &DBGSWTCH = &STR(ON) THEN + CONTROL MSG LIST CONLIST SYMLIST NOFLUSH ASIS ELSE + CONTROL NOMSG NOLIST NOFLUSH NOPROMPT ASIS /******************************************************************/ /* 'CENTER' EDIT MACRO. CENTER THE STRING ON THE CURSOR LINE */ /* AUTHOR : DAVID LEIGH DATE : 11-15-89 */ /******************************************************************/ IF &STR(&HELP) = &STR(HELP) THEN GOTO HELPSEC ISREDIT (DSN) = DATASET LISTDSI '&DSN' ISREDIT (LN,CL) = CURSOR ISREDIT CURSOR = &LN 1 ISREDIT FIND FIRST P'¬' .ZCSR .ZCSR ISREDIT (LN,FIRST) = CURSOR ISREDIT FIND LAST P'¬' .ZCSR .ZCSR ISREDIT (LN,LAST) = CURSOR ISREDIT (DLINE) = LINE .ZCSR SET DLINE = &SUBSTR(&FIRST:&LAST,&STR(&DLINE)) SET DLEN = &LENGTH(&STR(&DLINE)) SET POS = (&SYSLRECL - &DLEN) / 2 SET REM = (&SYSLRECL - &DLEN) / 2 IF &REM > 1 THEN SET POS = &POS + 1 ISREDIT LINE .ZCSR = < &POS '&STR(&DLINE)' > EXIT HELPSEC: + 02480000 ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL) 02490000 SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR CENTER UTILITY + 02490000 *** NO PROCESSING PERFORMED ***) 02490000 ISPEXEC SETMSG MSG(UTLZ000) 02490000 EXIT
Documentation
This utility allows you to center the text on the line in a file you are editing. Simply type CENTER on the command line, place your cursor anywhere on the line to be "centered" and press ENTER. The utility finds the first non-blank character and the last non-blank character on the line; calculates the length of the string, subtracts it from the LRECL of the file; divides the result by 2 and positions the string on the resulting column.