|
Post by arnoldtrembley on Jul 3, 2022 0:36:20 GMT -5
I have never created a line macro in SPFLite, but I would like to create one to accept a line command, and then shift the display to make that line the top line in the edit window.
I know that something close to this behavior can be done with the CSR option, but I learned SPF on a compatible editor named SYSD, and I have never been comfortable with the CSR option and have always used PAGE, rather than CSR or HALF. In SYSD, I could do what I want with "/" as the line command. In TSO/ISPF I was able to build a custom macro to do that using some free software from an IBM engineer.
My guess is that this kind of macro could not use "/" as the line command because of the macro filename, but I could probably find a one or two character name that would not conflict with any existing line commands.
Can anyone suggest a possible solution? I still need to update my SPFLite to the latest version from May, 2022.
Kind regards,
Arnold Trembley
|
|
|
Post by George on Jul 3, 2022 9:41:52 GMT -5
Hi Arnold,
I'm not sure why CSR gives you problems, maybe you could explain. Since if you do have scrolling set to CSR, what you want is exactly how it would work. Just to review - CSR acts like PAGE if the cursor is not on a text line, otherwise the cursor line becomes the top/bottom, depending on whether you use PgUp/PgDown.
George
|
|
|
Post by arnoldtrembley on Jul 3, 2022 18:32:31 GMT -5
In response to George, I normally use PAGE rather than CSR as my SCROLL setting, because CSR drives me crazy. If the cursor is in the edit screen and I press PF7 or PF8, the screen moves an unexpected range which gives me a feeling of being lost. But in SYSD (CICS hosted clone of ISPF) or in VM/CMS XEDIT, I could simply newline or enter to the prefix area, type "/", press enter, and that would become the top line in the edit window.
Frequently when I'm editing, I need to shift the edit window to get a better view of the COBOL paragraph I'm working on. So I end up going to the primary command area, and typing UP n or DOWN n until I get close to where I want to be. I've actually found that setting SCROLL to HALF is a little better. PF7/PF8/PgUp/PgDn give predictable jumps and I don't feel like I'm getting lost in the edit file. It does take longer to page thru the file. Of course, on a TN3270 screen I was usually limited to a window of 24 lines, but my SPFLite window is 34 lines.
I've been using SPFLite for over 10 years, and I am very satisfied with it. I've been retired about six years but still play with COBOL programming on my home PC, and I prefer SPFLite. It seems like younger programmers want to use VSCodium or Visual Studio to edit GnuCOBOL programs, but I'm much more productive with SPFLite.
And I successfully upgraded to V2.6.22138. I was on V2.4.21112.
And for Robert's benefit, I did find "Macros for Fun and Profit", but I definitely need to spend more than 5 or 10 minutes with it. Maybe I'm more impatient as I get older. If I spent more time with it, I might be able to build the macro I want.
Thanks very much!
|
|
|
Post by arnoldtrembley on Jul 3, 2022 23:15:10 GMT -5
Robert,
Thank you very much! It took me an extra minute or two to figure out the right folder to store LOC-TOP.MACRO, since I have some duplicates. But it works perfectly!
Thanks again for all your help!
Arnold Trembley
|
|
|
Post by arnoldtrembley on Jul 4, 2022 16:07:45 GMT -5
Robert,
There was a clue about using ALT in your post, and I can understand why you wouldn't want to assign LOC-TOP.MACRO to every usage of "/" on the keyboard.
I'm very satisfied with the performance of LOC-TOP.MACRO, and it's pretty easy to install as a macro and a KEYMAP setting.
I also tried LOC .ZCSR and got a similar result.
I guess part of my problem learning to use CSR to get a similar function is that I've used several different ISP style editors over the years (SPFPC, SPFWin, SYSD) and they all seem to have slightly different behavior as to where the cursor goes after you press ENTER or NEWLINE in the edit screen. Once you get used to a particular editor, changing to another one can sometimes result in a feeling that something is not the same and wondering what was different.
Anyway, I really like SPFLite and hope to keep using it for years to come!
Kind regards,
|
|
|
Post by George on Jul 5, 2022 9:27:07 GMT -5
Guys: It's all a matter of what years of usage have trained you to do. For myself, I'm a CSR user from day 1.
I noticed LOC-TOP leaves you with the cursor on the command line. Here's a possible alternative that maintains the cursor column position where it was when the macro is invoked.
George
' TP.MACRO ' Move line to top of screen ' Syntax: {TP} i.e. a line command if Is_Primary_Cmd then halt(fail, "TP macro was not invoked as a line command") dim LineNo as long = Get_Src1_LPtr ' Line number dim ColNo as long = max(1, Get_Csr_Col) ' Column number Set_TopScrn_LPtr(LineNo) ' Position the screen Set_Csr(LineNo, ColNo) '
|
|
|
Post by George on Jul 5, 2022 14:23:58 GMT -5
Robert: maybe post the 'latest' again, I can't find one that works as you say.
George
|
|
|
Post by George on Jul 5, 2022 14:59:42 GMT -5
Robert: This is what I have. And it puts the cursor on the command line, not the cursor line.
George
' LOC-TOP.MACRO ' MAKE THE CURRENT CURSOR LOCATION THE "TOP" OF THE DISPLAY ' SUGGESTED KEY MAPPING: ALT /
DIM CURSOR_LPTR AS LONG = Get_Csr_LPtr IF CURSOR_LPTR = 0 THEN HALT("CURSOR NOT ON A DATA LINE") DIM CURSOR_LNUM AS LONG = Get_LNum(CURSOR_LPTR) IF CURSOR_LNUM = 0 THEN HALT("COULD NOT DETERMINE LINE NUMBER")
DIM CURSOR_LINE AS STRING = TSTR$(CURSOR_LNUM) SPF_CMD("LOCATE ." & CURSOR_LINE & " TOP") SPF_CMD("LOCATE ." & CURSOR_LINE) HALT
|
|
|
Post by George on Jul 5, 2022 15:49:56 GMT -5
Robert: Well, I do the two commands, and I end up with the cursor in the line command area of the line.
If I do it with the macro, I end up with the screen postioned correctly, and the cursor on the command line.
And this is with version 22186, which is the latest and greatest.
George
|
|
|
Post by arnoldtrembley on Jul 5, 2022 22:15:08 GMT -5
I don't want to create more controversy, but my cursor ends up in the command line after LOC-TOP.MACRO runs. I don't mind that because the command line is not very far from the top line. It might also match the behavior of some other SPF-style editor I have used.
I have an extra blank line below the command line for long messages. I thought that was a configuration option years ago, but I might be thinking of SPFWin. Or it's possible some other odd configuration choice affects the final curser location. In any event, I'm very happy with LOC-COP.
Arnold
|
|
|
Post by George on Jul 6, 2022 8:42:01 GMT -5
Robert: Sorry when I test, it's always with the latest cmpiled version, which may or may not have made it to Beta. Those two versions are basically identical.
George
|
|
|
Post by arnoldtrembley on Jul 6, 2022 19:15:48 GMT -5
I will try to attach a screen shot of my SPFLite window with the extra line below the command line. I tried out version 2 of LOC-TOP and it puts the cursor in the prefix area of the top line, instead of in the command line. I'm not sure which I prefer at this point, but it's nice to have a choice! Here are the big differences between version 1 and version 2 from what I downloaded: LOC-TOP version 1 ending: DIM CURSOR_LINE AS STRING = TSTR$(CURSOR_LNUM) SPF_CMD("LOCATE ." & CURSOR_LINE & " TOP") SPF_CMD("LOCATE ." & CURSOR_LINE) HALT LOC-TOP version 2 ending: DIM CURSOR_LINE AS STRING = TSTR$(CURSOR_LNUM) SPF_CMD("LOCATE ." & CURSOR_LINE & " TOP") SPF_POST_DO("(CondLineNo)") HALT So, Version 2 has an extra blank line before the HALT statement. I don't see why the lack of a blank line before HALT would affect version 1, but I could test that. Let me see if I can paste my screen shot here:
|
|
|
Post by Stefan on Jul 7, 2022 4:39:06 GMT -5
Arnold...
Macro Version 2: The blank line before HALT is irrelevant, but it is preceded by a "SPF_POST_DO(CondLineNo)" statement which moves the cursor AFTER the macro has finished.
For an explanation,
issue HELP SPF_POST_DO
and HELP CondLineNo
I think the entire thing can be simplified to:
' LOC-TOP-V3.MACRO DIM AS NUMBER csrLne = Get_CSR_LPtr DIM AS NUMBER csrCol = Get_CSR_Col SPF_Cmd("LOCATE TOP !" & csrLne) ' use of ! avoids need to get the line NUMBER
SET_CSR(csrLne,csrCol) ' <--- use this line to leave the cursor in the same column as-was
'SPF_Post_Do("(CondLineNo)") ' <--- use this line instead to leave cursor in the line number field
HALT
As for the blank line below the command line on the display, I think it is always there. See my screen shot
|
|
|
Post by Stefan on Jul 7, 2022 5:02:29 GMT -5
Don't know what to say George. I just double-checked my local copy. It's exactly like you show above. I tested it, and mine goes to the cursor line, not the command line. Test this out: Get some file at least 20 lines. Now, issue the following commands in order: LOCATE .10 TOP LOCATE .10 When you do that, what happens? If your cursor is not on data line 10, something is wrong with your version of SPFLite. R Robert,
I'm using v22182 and it seems simpler than this for me. Tried it with a 90-line file with cursor on last 'page', line 88. Issue LOCATE .10 TOP
Display is scrolled so that line 10 is the top line and the cursor is in the line number field of line 10. Same result if I lave cursor on the command line before issuing the command.
Irrelevant to this discussion, but I note there's no difference between LOCATE .10 TOP and a plain LOCATE .10 Shouldn't the plain LOCATE place line 9 at the top of the display?
|
|
|
Post by George on Jul 7, 2022 8:01:01 GMT -5
Stefan: Yes a simple L .10 should place line 10 as the 2nd line, same way that FIND positions things. I'll have to check it out.
If I find and fix it, my bet is it will break LOC-TOP.
BTW, I posted a TP.MACRO further back that maintains the column position after positioning. Nobody commented on it.
George
|
|