| View previous topic :: View next topic |
| Author |
Message |
sinjon Beginner
Joined: 16 May 2006 Posts: 3 Topics: 1
|
Posted: Sun May 21, 2006 11:35 pm Post subject: Edit macro command |
|
|
I've created a small edit macro to automate a sequence of edit commands that I often manually enter. Everything works fine except for there's one command I don't know how to automate. Intereactively I'd use the MD (make data) command and I don't know how to incorporate that command into the macro.
For example, if interactively I always go to the fifth line and enter 'md30' to turn any notes or message lines within the next 30 lines into data, how would I do that from within a macro? |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Sun May 21, 2006 11:40 pm Post subject: |
|
|
| Unfortunately, youj can't automate that through a simple edit macro. There is no macro access to 'special' lines like info or note lines. Only data lines are addressable. |
|
| Back to top |
|
 |
sinjon Beginner
Joined: 16 May 2006 Posts: 3 Topics: 1
|
Posted: Mon May 22, 2006 12:18 pm Post subject: |
|
|
I don't actually want to do any specific processing of just the notes or info lines, just save them as data lines so they can then be processed like the rest of the data. No way to do theat through a macro... seems odd since it so simple manually...
Thanks for your reply |
|
| Back to top |
|
 |
stefan Beginner
Joined: 20 Nov 2003 Posts: 41 Topics: 2 Location: Germany
|
Posted: Tue May 23, 2006 8:18 am Post subject: |
|
|
You could write a macro which captures the contents of the current screen, parse it, and process as you need.
| Code: |
eyecatcher = '==CHG>'
address ispexec 'vget zscreeni'
p = pos(eyecatcher,zscreeni)
do while p > 0
lineno = (p % 80) - 4
say 'data on line' lineno 'contains'
say substr(zscreeni,(p+7),72)
p = pos(eyecatcher,zscreeni)
end
|
But keep in mind that this variable is NOT refreshed when scrolling down the data via DOWN macro command. You have to let the ISPF editor repaint the screen and thus cause zscreeni to contain the newly loaded screen data.
Hope this helps. |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue May 23, 2006 9:46 am Post subject: |
|
|
If you are going to go down that route, then the complete solution is to create an edit panel with a panel exit that captures and updates the zdata variable with the right commands and screen attribute bytes. But that still requires getting the screen to display each non-data line (scrolling) which is very hard to simulate from a macro.
Panel exits that interogate or manupulate edit data are possible -- I've written exits that remove or alter the line command area for use by screen readers for example -- but they are non-trivial and not easy to maintain.
The other way is to write an emulator macro. With a good emulator language (EHLLAPI or Vista's macro language for example, that would not be not too hard.
But edit macros themselves can't do it through any documented interface. |
|
| Back to top |
|
 |
sinjon Beginner
Joined: 16 May 2006 Posts: 3 Topics: 1
|
Posted: Wed May 24, 2006 10:31 pm Post subject: |
|
|
| Well considering that I'll be dealing with thousands of lines, capturing the screen won't work. Perhaps in a loop, but I think it'd take too long with the size of the data set. |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed May 24, 2006 11:53 pm Post subject: |
|
|
Here is a thought...
- Manually MD all lines, MD9999 or if you have >9999 lines,
- X ALL
- MD on the excluded line
- RESET X
- COMPARE SESSION or COMPARE * (those are the same thing)
- That will give you a set of labeled lines where the new lines are. Then your macro can go through those lines and process them as needed, deleting the ones you don't want.
You can either calculate the label names (you'll see the pattern when you look at the labels, .Oxxxx where xxxx is a cycle AAAA, AAAB, ... AAAZ, AABA, AABB, etc , basically xxxx is a base26 'number' using alphabetic characters), or use LOCATE LABEL and the DISPLAY_LINES, something like this: | Code: | /* REXX */
Address isredit
'MACRO'
'LOCATE LABEL FIRST'
locrc=rc
Do While locrc=0
"(T) = DISPLAY_LINES"
Say "Label found at line" t+0
"LOCATE LABEL"
locrc=rc
End | It is a litte bit manual, but maybe not too bad. |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Thu May 25, 2006 12:21 am Post subject: |
|
|
I think there is a better way to calculate the labels, but this small genlabel routine will do it: | Code: | /* Rexx - calculate compare labels */
/* using starting index of 1 */
Address isredit
Do a = 1 to 28
Say genlabel(a)
End
Return
genlabel: Procedure
i = Arg(1) - 1
q = i % 17576 /* 26*26*26 */
r = i // 17576 /* 26*26*26 */
c = d2c(q) /* 26*26*26 */
q = r % 676 /* 26*26 */
r = i // 676 /* 26*26 */
c = c|| d2c(q) /* 26*26 */
q = r % 26
r = i // 26
c = c|| d2c(q)|| d2c(r)
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Return ".O"|| translate(c,alpha,xrange("00"x,"1F"x)) |
|
|
| Back to top |
|
 |
|
|
|