Paul, Bob, et al.: here is a version of LINEMAC and a dsn extractor I have used before. Feel free to treat this like open source - modify/fix/enhance and re-share it!
Thanks! On Tue, Sep 15, 2009 at 10:58 AM, Beesley, Paul <paul.bees...@atosorigin.com > wrote: > I did send mine to Don. > As you said pretty please I'll find somewhere appropriate to post them > :) > > > Regards > Paul > > -----Original Message----- > From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On > Behalf Of Richards, Robert B. > Sent: 15 September 2009 12:56 > To: IBM-MAIN@bama.ua.edu > Subject: Re: User-written ISPF-Editor line commands > > Did anyone ever post their source for the line commands they spoke > about? If not, can you, pretty please! :-) > > Mark, you are exempt. I got yours from your website. Good stuff! > > Bob > > -----Original Message----- > From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On > Behalf Of Donald Johnson > Sent: Friday, September 11, 2009 8:01 AM > To: IBM-MAIN@bama.ua.edu > Subject: Re: User-written ISPF-Editor line commands > > Paul, I like the sounds of these - would you be free to post/send the > source for these commands? > Don > > On Thu, Sep 10, 2009 at 5:53 PM, Beesley, Paul > <paul.bees...@atosorigin.com>wrote: > > > A few more to add .. > > > > NA, NC, NJ, NR, NP - convert line to a comment ( > > Assembler/Cobol/JCL/Rexx/PL1 ) - as per Roscoe equivalents JJ - Join > > JCL lines, removing the // from the front JS - Split a JCL line at the > > > cursor, inserting a // and spaces to line it up / - scroll this line > > to the top ( cos I kept thinking I was in CMS edit ... ) > > > > > > Regards > > Paul > > > > _______________________________________________________ > > Atos Origin and Atos Consulting are trading names used by the Atos Origin > group. The following trading entities are registered in England and Wales: > Atos Origin IT Services UK Limited (registered number 01245534) and Atos > Consulting Limited (registered number 04312380). The registered office for > each is at 4 Triton Square, Regents Place, London, NW1 3HG.The VAT No. for > each is: GB232327983 > > This e-mail and the documents attached are confidential and intended solely > for the addressee, and may contain confidential or privileged information. > If you receive this e-mail in error, you are not authorised to copy, > disclose, use or retain it. Please notify the sender immediately and delete > this email from your systems. As emails may be intercepted, amended or > lost, they are not secure. Atos Origin therefore can accept no liability > for any errors or their content. Although Atos Origin endeavours to > maintain a virus-free network, we do not warrant that this transmission is > virus-free and can accept no liability for any damages resulting from any > virus transmitted. The risks are deemed to be accepted by everyone who > communicates with Atos Origin by email. > _______________________________________________________ > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
/* Rexx implement line commands */ Trace o; Address "ISPEXEC"; isp = "ISPEXEC "; isr = "ISREDIT "; isr "MACRO (lc) NOPROCESS"; /* Get line command */ isp "CONTROL ERRORS RETURN" /* Return ispf errors */ valid_cmds = "/ CEN REV SL SR AUTH DB DT CB CE CV NA NC NJ NR SJ EOJ"; /* > ------------------------------------------------------------------- < > Valid line commands processed here: < > / - Sets the cursor line at top of the screen < > CEN - Centers the cursor line < > REV - Reverses the cursor line < > SL - Left Justifies the cursor line < > SR - Right justifies the cursor line < > DB - Deletes from the cursor line to the bottom < > DT - Deletes from the cursor line to the top < > CB - Invokes BROWSE on the filename at the cursor < > CE - Invokes EDIT on the filename at the cursor < > CV - Invokes VIEW on the filename at the cursor < > NA - Turns the cursor line into a comment for ASM < > NC - Turns the cursor line into a comment for COBOL < > NJ - Turns the cursor line into a comment for JCL < > NR - Turns the cursor line into a comment for REXX < > SJ - Executes SplitJoin processing at the cursor < > EOJ - Inserts a JCL EOJ card following the cursor line < > ------------------------------------------------------------------- < */ If wordpos(lc,valid_cmds) = 0 Then /* If the command is not valid */ Do; /* */ zinfo = lc; /* move the command to err msg */ isp "SETMSG MSG(ISRE041)" /* Set the ISPF Error message */ Exit 8 /* Leave with RC = 8 */ End /* */ /* */ isr "PROCESS RANGE" lc; /* Get the range for commands */ If rc > 0 Then /* If the range is invalid */ Do; /* */ zedsmsg = zerrsm; /* Set the error message */ zedlmsg = zerrlm; /* */ isp "SETMSG MSG(ISRZ001)"; /* */ Exit rc; /* Leave with the failed RC */ End; /* */ /* */ isr "(START) = LINENUM .ZFRANGE"; /* Get 1st line no in the range */ isr "(STOP) = LINENUM .ZLRANGE"; /* Get last line no in the range */ isr "(L$BOT) = LINENUM .ZLAST"; /* Get last line no of the member*/ isr "(DW) = DATA_WIDTH"; /* Get width of editable data */ nl.0 = 1; /* Initialize stem variable count*/ nl.1 = ""; /* Initialize first new line fld */ /* > ------------------------------------------------------------------- < > Process non-block commands < > ------------------------------------------------------------------- < */ Select; When (lc = "/") Then /* Set the selected line to top */ Do; isr "(D$T,D$B) = DISPLAY_LINES"; scr = start - d$t; isr "DOWN CURSOR"; Exit 0; End; When (lc = "DT") Then /* Delete selected line to top */ Do; isr "LABEL 1 = .FROM"; isr "LABEL" start "= .TO"; isr "DELETE ALL .FROM .TO"; End; When (lc = "DB") Then /* Delete selected line to bot */ Do; isr "LABEL" start "= .FROM" isr "LABEL" l$bot "= .TO" isr "DELETE ALL .FROM .TO" End; When (lc = "SJ") Then /* Process SPLIT/JOIN */ Do; isr "(SJ1) = LINE" start; /* Get contents of first line */ isr "(CR,CC) = CURSOR"; /* Where is the cursor in line? */ /* -------------------------------------------- > This section assumes a JCL line, or line < > that can split at comma. If the cursor is < > anywhere in the data, find the previous < > comma and place the trailing data on the < > next line. If JCL, it will line up the < > split data with the line above or in column < > 16. For anything else, it will line up with < > the first non-blank column. < > -------------------------------------------- */ If (cc > 0) & (Length(Strip(sj1,"T")) > cc) Then Do; If Substr(sj1,cc,1) = "," Then sj2_st = cc + 1; Else sj2_st = Lastpos(",",sj1,cc) + 1; If sj2_st = 1 Then Exit 4; sj2 = Strip(Substr(sj1,sj2_st)); nl.1 = Substr(sj1,1,sj2_st - 1); If Substr(sj1,1,2) = "//" Then Do; If Word(nl.1,2) = "DD" Then sj2_st = Wordindex(nl.1,3) - 3; Else sj2_st = Wordindex(nl.1,2) - 3; nl.2 = "//" || Copies(" ",sj2_st) || sj2; End; Else nl.2 = Copies(" ",Verify(nl.1," ","N",1) - 1) || sj2; nl.0 = 2; End; Else Do; If start = l$bot Then Do; zedsmsg = "Invalid on this line"; zedlmsg = "SJ cannot be executed on the last line"; isp "SETMSG MSG(ISRZ001)"; Exit 12; End; isr "(SJ1) = LINE" start; /* Get first line */ isr "(SJ2) = LINE" start+1; /* Get next line */ sj1 = Strip(sj1,"T"); If Substr(sj2,1,2) = "//" Then Do; sj2 = Strip(Substr(sj2,3),"B"); maxl = 71; End; Else Do; sj2 = Strip(Substr(sj2,1),"B"); maxl = dw; End; If Length(sj1) + Length(sj2) > maxl Then Do; zedsmsg = "Cannot JOIN lines"; zedlmsg = "Joined lines would exceed max length"; isp "SETMSG MSG(ISRZ001)"; Exit 4; End; nl.1 = sj1 || sj2; isr "DELETE" start + 1; End; End; When (lc = "EOJ") Then /* Insert JCL EOJ cards */ Do; isr "(OL) = LINE" start; exec_str = right(ol, Length(ol) - Length(Word(ol,1))); nl.1 = ol; nl.2 = "// "; nl.3 = "//* END OF JOB CARD ADDED BY EOJ LINE COMMAND"; nl.4 = "// "; nl.0 = 4; End; Otherwise Nop; End; /* > ------------------------------------------------------------------- < > Process possible block commands < > ------------------------------------------------------------------- < */ Do a = start To stop; /* Process the range of lines */ isr "(OL) = LINE" a; /* Get line to process */ Select When (lc = "CEN") Then nl.1=Center(Strip(ol),dw); /* Center */ When (lc = "REV") Then nl.1=Reverse(ol); /* Reverse */ When (lc = "SL") Then nl.1=Strip(ol,"L"); /* Left justify */ When (lc = "SR") Then nl.1=Right(Strip(ol,"T"),dw); /* Right Justify */ When (lc = "NA") Then nl.1="* <NA>" Strip(ol) "*"; /* ASM Comment */ When (lc = "NC") Then nl.1="C <NC>" Strip(ol); /* COB Comment */ When (lc = "NJ") Then nl.1="//*<NJ>" Strip(line); /* JCL Comment */ When (lc = "NR") Then nl.1="/* <NR>" Strip(line) "*/"; /* REXX Comment */ When (lc = "CB") |, /* Browse file on this line */ (lc = "CV") |, /* View file on this line */ (lc = "CE") Then /* Edit file on this line */ Do; type = Word("BROWSE VIEW EDIT",Wordpos(lc,"CB CV CE")); isr "(CR,CC) = CURSOR"; /* Where is the cursor in line? */ dsn = Dsname(cc,ol); /* Extract the dsn from the line */ isp type "DATASET('"dsn"')" If rc /= 0 Then isp "SETMSG MSG("zerrmsg")"; isr "CURSOR = (cr,cc)"; /* put cursor back to last pos */ End; Otherwise Exit; /* Otherwise leave the program */ End /* > ------------------------------------------------------------------- < > Replace the existing line, and add any additional lines < > ------------------------------------------------------------------- < */ If nl.1 > "" Then /* If lines have been changed */ Do; /* */ nl = nl.1; /* set a non-stem variable */ isr "LINE" a "= (NL)"; /* set line data from the var */ /* */ Do loop = 2 to nl.0 /* If lines have been added */ nl = nl.loop; /* set the non-stem variable */ isr "LINE_AFTER" a "= (NL)"; /* add lines as needed */ a = a + 1; /* */ End; /* */ End; /* */ End; /* Do a = start to stop */ Exit 0;
/* REXX THIS LINE MUST BE PRESENT FOR THIS EXEC TO FUNCTION! */ /*--------------------------------------------------------------------*/ TRACE o; /*--------------------------------------------------------------------*/ cc = Arg(1); line = Arg(2); sw = Arg(3); Upper sw; ADDRESS "ISPEXEC"; "CONTROL ERRORS RETURN"; delim = " ~`!%_=+\{|};:'<,>/?()" || '"'; If cc > 0 Then Do; memtest = Substr(line,cc-9,18); in_member = (Pos("(",memtest) > 0) & (Pos(")",memtest) > 0); b_line = Reverse(Substr(line,1,cc-1)) || " "; f_line = Substr(line,cc,Length(line)) || " "; If in_member Then Do s_col = cc - Verify(b_line,delim,"M",Pos("(",b_line)+1) + 1; e_col = cc + Verify(f_line,delim,"M",Pos(")",f_line)+1) - 2; End; Else Do s_col = cc - Verify(b_line,delim,"M") + 1; e_col = cc + Verify(f_line,delim,"M") - 2; End; If Substr(line,e_col+1,1) = "(" Then memname = Substr(line, e_col+1,Pos(")",line,e_col+2) - e_col); Else memname = ""; End; Else Do; Select When Pos("DSN=",line) > 0 Then s_col = Pos("DSN=",line) + 4; When Pos("DSNAME=",line) > 0 Then s_col = Pos("DSNAME=",line) + 7; Otherwise s_col = 1; End; l_paren = Pos("(",line,s_col); r_paren = Pos(")",line,l_paren+1); beg_srch = Max(s_col,r_paren) + 1; e_col = Verify(line,delim,"M",beg_srch) - 1; memname = ""; End; dsn = Substr(line,s_col,e_col- s_col + 1) || memname; Select; When sw = "COLS" Then Return Right("000"||S_COL,3) || Right("000"||e_col,3); When sw = "BOTH" Then Return dsn || Right("000"||S_COL,3) || Right("000"||e_col,3); Otherwise If Left(dsn,8) = "&SYSUID." Then dsn = Sysvar(SYSUID) || Substr(dsn,9); Return dsn; End;