Return to Mainframe Utilities Page
Module
/**********************************************************************
/* EDIT MACRO : COLS *
/* AUTHOR : DAVE LEIGH *
/* FUNCTION : UNTIL WE GO TO THE APPROPRIATE RELEASE OF ISPF *
/* CREATE COMMENT BOXES IN VARIOUS FORMATS. *
/**********************************************************************
ISREDIT MACRO NOPROCESS (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
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
IF &HELP = HELP THEN GOTO HELPSEC
/**********************************************************************
/* DETERMINE WHETHER TO USE AN "A¦B" LINE COMMAND OR THE CURSOR POS. *
/**********************************************************************
ISREDIT (SLN,SCL) = CURSOR
ISREDIT PROCESS DEST
SET DESTCC = &LASTCC
SELECT (&DESTCC)
WHEN (0) DO
ISREDIT (LINENUM) = LINENUM .ZDEST
END
WHEN (8) DO
SET ZEDSMSG = &STR(A¦B LINE REQUIRED)
SET ZEDLMSG = &STR("COLS" AS A PRIMARY COMMAND REQUIRES AN +
"A" OR "B" LINE COMMAND TO OPERATE)
ISPEXEC SETMSG MSG(UTLZ001)
EXIT CODE(12)
END
WHEN (16) DO
SET ZEDSMSG = &STR(INVALID LINE COMMAND)
SET ZEDLMSG = &STR(LINE CMDS CAN'T CONFLICT OR SPECIFY +
"BEFORE" THE 1ST OR "AFTER" THE LAST +
LINE)
ISPEXEC SETMSG MSG(UTLZ001)
EXIT CODE(12)
END
WHEN (20) DO
SET ZEDSMSG = &STR(SEVERE ERROR)
SET ZEDLMSG = &STR(PROCESSING THE LINE COMMAND PRODUCED A +
SEVERE EDIT MACRO ERROR)
ISPEXEC SETMSG MSG(UTLZ001)
EXIT CODE(12)
END
OTHERWISE
END
/**********************************************************************
/* CREATE A "COLUMNS" LINE THE SIZE OF THE LRECL *
/**********************************************************************
SET COLS =
ISREDIT (LRECL) = LRECL
DO &I = 1 TO &LRECL
IF &I > 9 THEN +
SET A = &SUBSTR(&LENGTH(&I)-1:&LENGTH(&I)-1,&I)
SET B = &SUBSTR(&LENGTH(&I):&LENGTH(&I),&I)
SET MARK = &STR(-)
IF &B = 5 THEN SET MARK = &STR(+)
IF &B = 0 THEN SET MARK = &STR(&A)
SET COLS = &STR(&COLS&MARK)
END
/**********************************************************************
/* PLACE THE COLUMNS LINE WHERE IT BELONGS *
/**********************************************************************
ISREDIT CURSOR = &LINENUM 1
ISREDIT LINE_AFTER .ZCSR = (COLS)
/**********************************************************************
/* RESTORE THE USER'S CURSOR POSITION *
/**********************************************************************
ISREDIT CURSOR = &SCL &SLN
EXIT
/**********************************************************************
/* HELP PROCESSING *
/**********************************************************************
HELPSEC: + 02480000
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL) 02490000
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR COLS UTILITY + 02490000
*** NO PROCESSING PERFORMED ***) 02490000
ISPEXEC SETMSG MSG(UTLZ000) 02490000
EXIT
Documentation
COLS is an edit macro which approximates the function of the "COLS" ISPF edit
command. The only difference in the result is that the "columns" line is an
actual "data" line when you use the COLS edit macro and it is a "message" line
when you use the COLS line command. When we go to ISPF 3.0 or higher, the COLS
edit macro will be superfluous. The reason is that in the newer releases of
ISPF, a new line command, "MD" is introduced. "MD" stands for "Make Data".
When you put "MD" on any non-data line which ISPF displays in the body of your
data (like "=COLS>" or "=BNDS>", or "==MSG>", etc.), that line will actually be
converted to a "data" line and be saved with your file. Until that time,
however, to painlessly create a columns line (for whatever purpose), the COLS
edit macro may be your best bet.
COLS is invoked as follows:
COMMAND ===> cols
The "columns" line is then created specific to the LRECL of the file being
edited. Its placement within the file is based on these rules:
If you use an "A" or "B" line command (like you would for a normal copy or
move), the columns line will be placed accordingly in the file. If you do not
specify an "A" or "B", the columns line will be inserted after the line your
cursor is currently on.

0 Comments