View previous topic :: View next topic |
Author |
Message |
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Wed Feb 19, 2014 7:17 am Post subject: Edit command to create MSG text in prefix area |
|
|
Not sure how to express this, so it'll probably be easier to include a screen capture to illustrate what I want to do. What is the edit command to create MSG text in the prefix area (as well as the actual message itself).
Thanx
Quote: |
000019 //*INFO: I N P U T - F I L E R
000020 //*
==ERR> //GSAMVB01 DD DSN=xxxxxx.UCXML.xxxxxxxxx.XML,DISP=SHRJJ
==MSG> E3 - DSS10080E - VALUE 'SHRJJ' SHOULD HAVE BEEN NEW, OLD, SHARE, SHR,
==MSG> MOD, OR NULL VALUE.
000022 //*
000023 //SHBG201 DD *
|
_________________ Michael |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Wed Feb 19, 2014 9:12 am Post subject: I found the answer |
|
|
The following will do it
Quote: |
'LINE_BEFORE .zcsr = MSGLINE "'!!temp!!'"'
|
I have a follow-on question.
Assuming I now have a number of these MSG lines and my cursor is on line 1, is there a way of doing a FIND to position the cursor at the next MSG line ? _________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Feb 20, 2014 3:29 am Post subject: Thanks Kolusu, but that's not what I'm after. |
|
|
What I've done is to write a macro that can be used when editing some COBOL source code. It edits the compiler listing and looks for occurrences of sections and variables that not used in the source code (Micros Focus's Mainframe Express has a similar menu option for this).
Let's assume that they have 5 "errors" in their code, either sections that are never performed or variables that are never referenced. As a s result of the macro, I do the LINE_AFTER calls above for these 5 occurrences.
This now means that the user has 5 msg's in the prefix area. What I'm wondering is if there is a way of finding these via a primary command, something like, say,
Code: |
find 'MSG' prefix-area next
|
or similar _________________ Michael |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Feb 20, 2014 7:31 am Post subject: Found the answer to that as well |
|
|
Use
Quote: | LOCATE NEXT MSGLINE |
Strangely (?) enough, there is no edit command RLOC (similar to RFIND) but it was easy to cobble together such a macro. _________________ Michael |
|
Back to top |
|
|
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Thu Feb 20, 2014 12:13 pm Post subject: |
|
|
Good to hear it! Thanks for posting what you found _________________ All the best,
di |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Thu Feb 20, 2014 2:21 pm Post subject: |
|
|
Also. I'd suggest you never use the variable name in concatenation with edit commands like this. Instead, set the variable and use parenthesis notation.
With concatenation, if your variable contains characters that are important to edit macro syntax like ampersands and quotes, your command will fail and those types of problems are hard to diagnose, especially if someone else has to do it.
Instead of
Code: | "Line_after .x = '" || myvar || "'" |
use
Code: | myvar='whatever'
'LINE_AFTER .x = (myvar)' |
_________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Thu Feb 20, 2014 2:48 pm Post subject: |
|
|
You are using compiler option OPT(FULL) when producing the listing? |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Fri Feb 21, 2014 8:36 am Post subject: |
|
|
William. No, we're using XREF(FULL)
Semigeezer. Thanks for the idea. Will include it in my "cheat" list so I remember it for next time _________________ Michael |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Fri Feb 21, 2014 9:48 am Post subject: |
|
|
Well, if you use OPT(FULL) the compiler will tell you, exactly, with no fear of error and no code for you to write other than to extract what the compiler tells you: code which cannot be executed (not limited to paragraphs/SECTIONs not actually referenced (which does not tell you that the code is not used anyway)) and WORKING-STORAGE/LOCAL-STORAGE which is unreferenced.
However, why it would require other than using a split-screen to work on any information uncovered (I can't see why there should often be such things) I don't know. |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sat Feb 22, 2014 12:57 am Post subject: Sorry William, didn't understand your last append. |
|
|
At the end of the day, you can use the macro I wrote when editing your source code. This then runs an edit macro under the covers, analyzing the results of the compiler listing to return a list of unused variables/sections. On returning from the "covers", the macro then highlights the places "in error" with ==MSG> in the prefix area.
I agree, they could split the screen and then start visually analyzing the results in the compiler listing, but it's a damn site easier to have everything served up on a plate using ==MSG> _________________ Michael |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Sat Feb 22, 2014 4:15 am Post subject: |
|
|
You have written some code to identify storage which is not referenced.
You have written some code to identify paragraphs/SECTIONs which are not referenced.
The first is not too bad (assuming you have the data-map).
The second is very difficult (if I have understood what you want) to do reliably.
With OPT(FULL) the compiler does both of these, to a 100%-accurate degree. It lists the line-numbers for you, points them out in the listing. All you'd need to do is extract those (not needing XREF(FULL)) and then take that information into your macro.
At that point I just wonder how many times it is useful to have a macro to highlight the lines, when all you need to do is look at the listing, then look at the source and fix it.
Why do you get unused storage and unused (non-accessible) code so often that you need a macro to make it easier to look at? |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sun Feb 23, 2014 4:42 am Post subject: Thanks for the comments William |
|
|
I'll play around with the OPT(FULL) to see how the results differ compared to the other variation. A potential problem there is that (and I'd have to check this) OPT(FULL) is not the default parm for compilations here at work, XREF(FULL) is.
Quote: | .....so often that you need a macro to make it easier to look at? |
if you had any idea how lazy some developers are, you wouldn't ask that question. I don't know of anyone who has ever mentioned that they using the compiler listing to remove "dead code". This option is a standard in Mainframe Express (where we do our development/testing) but even there, I might well be the only one to take advantage of this option. _________________ Michael |
|
Back to top |
|
|
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Sun Feb 23, 2014 4:21 pm Post subject: |
|
|
I've only supported more than 100 data centers over the years and never yet has "dead code" been much of an issue. . .
How has this become a "biggie" in your organization? I suspect making sure the code always runs correctly and performs acceptably is a bigger issue than dead code . . . _________________ All the best,
di |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Mon Feb 24, 2014 1:32 am Post subject: Di |
|
|
It isn't a big deal here, it's just rather quiet at the moment _________________ Michael |
|
Back to top |
|
|
|
|