View previous topic :: View next topic
|
Author |
Message |
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Let me start by stating that I'm an idiot if I have to ask this here;
At my previous sites we had some edit macro's with which one could jump into , out of COBOL PERFORMS.
I never thought about looking into them, because several sites I seen had these and i was sure if I ever needed them I could find them on the net or CBT tape.
Well, I guess not because now I need them and can't find any reference to them except some documentation of the Mississippi ITS.
* So does anyone know these, and where I could find them publicly available?
(Merry X-mas BTW) |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Hi GuyC,
Could you explain or provide more info on your requirement? |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
Guy, I dont, but I have the source form them, just contact me for it. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
suresh,
It's pretty basic : it's 2 edit-macros or one with a parm
you locate your cursor on a line with a perform statement and press a PFKEY, the macro will postion the editor to the definition of the section/paragraph
you press another PFKEY and the macro will reposition to the perform statement.
and this nested : It can jump into performs several levels deep and return to each (LIFO)
Some had extra functionality that if it wasn't a perform statement, it will look for the word under the cursor and will search for & jump to the definition of a variable named as such. (and return to the original statement using the other PFKEY). |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Hi GuyC,
here is REXX logic, if I understanding your logic correctly.
First Macro:
1. Fetch the data from the editor from cursor position (with validation).
2. Find for word "PERFORM" in the fetched line
3. Get "PARA" name from the line.
4. Set "LABEL" to the cursor position. (may be .A)
5. Find Para definition within the editor. (F para-name 8)
Second Macro:
1. Get back cursor to LABEL that set by first macro. (In our case it is .A).
2. Remove labels.
Any better solution or finding anything missing or wrong in my solution would be greatly appreciated. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Sorry My bad.
When the macro finishes running, the .A label is removed.
So, point 4 in the first macro is invalid... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Hi GuyC,
Sorry for confusing, Here is the two macro that suits for your requirement.
Macro-1:
Code: |
address ispexec
"isredit macro"
'isredit (ln,co) = cursor' /* Get cursor position */
if abs(co) = 0 then
do
ZEDSMSG = ''
ZEDLMSG = 'Cursor is not located in EDITOR'
'SETMSG MSG(ISRZ001)'
exit
end
'isredit (ld) = line ' ln /* Get data from the line*/
x = msg("OFF")
if index(ld,'PERFORM') = 0 then
do
ZEDSMSG = ''
ZEDLMSG = 'No PERFORM specified in the line'
'SETMSG MSG(ISRZ001)'
CALL curset
exit
end
parse var ld 'PERFORM ' paraname ' ' others
paraname = strip(paraname) /* remove spaces*/
'isredit label .ZCSR = .THIS 0' /* Set label .THIS */
'isredit f ' paraname ' 8'
'isredit res'
exit
|
Macro-2:
Code: |
/* REXX */
address ispexec
"isredit macro"
"isredit l .THIS"
"isredit res lab"
exit
|
I hope this helps. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
thx, but it is missing the nesting.
suppose this cobol extract :
Code: |
01000 PERFORM A.
...
02000 A SECTION.
02100 PERFORM B.
...
03000 B Section.
03100 PERFORM C.
...
04000 C. |
cursor located on line 01000 : press PF20 => locate 02000;
.cursor located on line 02100 : press PF20 => locate 03000;
..cursor located on line 03100 : press PF20 => locate 04000;
..Press PF19 => Locate 3100 (or whichever line was on top of screen when PF20 was pushed)
.Press PF19 => Locate 2100 (or whatever ...)
Press PF19 => Locate 1000 (or whatever ...)
I supposse it will need some way of remembering variables in between runs. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What if the paragraph name is not on the same line as the PERFORM verb? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Nic Clouston wrote: |
What if the paragraph name is not on the same line as the PERFORM verb? |
I have never seen it, but i guess one could read the next line to find the word after PERFORM .
Also if this word is VARYING or UNTIL , you wouldn't want to look for that paragraph name.
But really that is just fancy stuff. I would be happy with just the basic. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Hi GuyC,
Sorry It took long time... I was busy... Here is the code with basic requirement. You may add all other fancy conditions and validations if you like.
First Macro:
Code: |
address ispexec
"isredit macro"
'isredit (ln,co) = cursor' /* Get cursor position */
if abs(co) = 0 then
do
ZEDSMSG = ''
ZEDLMSG = 'Cursor not located in screen EDITOR'
'SETMSG MSG(ISRZ001)'
exit
end
'isredit (ld) = line ' ln /* Get data from the line*/
x = msg("OFF")
if index(ld,'PERFORM') = 0 then
do
ZEDSMSG = ''
ZEDLMSG = 'No PERFORM specified in the line'
'SETMSG MSG(ISRZ001)'
exit
end
parse var ld 'PERFORM ' paraname ' ' others
paraname = strip(paraname) /* remove spaces*/
call gen_lab_name;
'isredit label .ZCSR = ' lab ' 0'
'isredit f ' paraname ' 8'
'isredit res'
exit
gen_lab_name:
num1=0
lab = '.A';
"isredit locate first label"
if rc > 0 then do
lab = lab || 'A'; return; end;
Do forever
num1 = num1 + 1
"isredit locate label"
if rc > 0 then leave
end
if num1 > 25 then
do
ZEDSMSG = ''
ZEDLMSG = 'Out of label generation'
'SETMSG MSG(ISRZ001)'
exit
end
select
when num1=1 then lab=lab||'B'
when num1=2 then lab=lab||'C'
when num1=3 then lab=lab||'D'
when num1=4 then lab=lab||'E'
when num1=5 then lab=lab||'F'
when num1=6 then lab=lab||'G'
when num1=7 then lab=lab||'H'
when num1=8 then lab=lab||'I'
when num1=9 then lab=lab||'J'
when num1=10 then lab=lab||'K'
when num1=11 then lab=lab||'L'
when num1=12 then lab=lab||'M'
when num1=13 then lab=lab||'N'
when num1=14 then lab=lab||'O'
when num1=15 then lab=lab||'P'
when num1=16 then lab=lab||'Q'
when num1=17 then lab=lab||'R'
when num1=18 then lab=lab||'S'
when num1=19 then lab=lab||'T'
when num1=20 then lab=lab||'U'
when num1=21 then lab=lab||'V'
when num1=22 then lab=lab||'W'
when num1=23 then lab=lab||'X'
when num1=24 then lab=lab||'Y'
when num1=25 then lab=lab||'Z'
end
return
|
Second Macro:
Code: |
/* REXX */
address ispexec
"isredit macro"
lab = '.A';
lab1 = '.A';
"isredit locate first label"
if rc > 0 then
do
ZEDSMSG = ''
ZEDLMSG = 'No prior Location to go'
'SETMSG MSG(ISRZ001)'
exit
end
Do forever
"isredit (row,col) = display_lines"
"isredit (lab1) = label " row
if lab1 > lab then lab=lab1
"isredit locate label"
if rc > 0 then leave
end
"isredit l " lab
"isredit label "lab" = ' ' 0"
exit
|
Any bug fixing or code improvement are greatly appreciated. |
|
Back to top |
|
|
|