- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Printing comments from the com script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 01:54 AM
09-29-2006 01:54 AM
I am using VMS 7.3-2. I have a simple com script which requires P1 and P2.
I have written comments from the first line of the script till I hit =====
so...
Example.com script
$! xxxx
$! xxxxx
$! xxxxx
$! USAGE:
.
.
.
$! ==============================
Now in case a user does not pass p1 I want an error message which basically types up the above comments.
I was thinking of using search or type command to read till "====" but I am not sure how I can open or search the current file. Since I will be executing the script and trying to type the comments on the screen.
I am aware of $write sys$output ---
But that will be a bit tedious and am looking for a neater method.
Nipun
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:00 AM
09-29-2006 02:00 AM
Re: Printing comments from the com script
A common enough requirement. The solution is to use the TYPE command in conjunction with SYS$INPUT, not comments. For example:
$ IF F$LENGTH(P1) .EQ. 0
$ THEN
$ TYPE SYS$INPUT
You omitted the parameter to this file. Please supply a parameter of the form ...
$ ENDIF
I re-typed this, my apologies in advance if I have introduced some typographical errors.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:06 AM
09-29-2006 02:06 AM
Re: Printing comments from the com script
$!
$ goto start
$!
$ usage:
$!
$ type sys$input
Text line 1.
Text line 2.
$!
$ return
$!
$ start:
$ if (p1 .eqs. "")
$ then
$ gosub usage
$ exit
$ endif
$!
$ write sys$output "Normal."
$!
alp $ @ x.com xxx
Normal.
alp $ @ x.com
Text line 1.
Text line 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:12 AM
09-29-2006 02:12 AM
Re: Printing comments from the com script
I this script is helpful. But there is one problem.
I have been using these scripts in the past so I have put all the comments preceeing with a
$!
So those lines don't get out. Now I have 15-20 lines in several scripts so it would be very painful for me to manual change that.
Would there be a better way ?
Nipun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:20 AM
09-29-2006 02:20 AM
Re: Printing comments from the com script
> so it would be very painful for me to
> manual change that.
This sounds like a few seconds worth of work
in any text editor. Adding the TYPE command
should require more time. Your idea of
"very painful" seems to differ from mine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:43 AM
09-29-2006 02:43 AM
Re: Printing comments from the com script
I would recommend the change, iterating through a series of files and making this type of change is not too difficult. You can use the command DIRECTORY/OUTPUT/NOHEAD/NOTRAIL to produce a list of files to be edited and make a command file out of them. You will also need to insert an ASSIGN/USER TT SYS$INPUT before each invocation of your favorite editor. This is not too difficult to do, unless you have hundreds of files (in which case a command file can generate the command file).
A quick (and VERY UGLY) fix is to use the DECK command to supress the behavior of the leading dollar signs for the display of the comments. You will also need to insert the trailing marker as described in the HELP text. Would I use this method? NO.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:45 AM
09-29-2006 02:45 AM
Re: Printing comments from the com script
My response was for Bob not yours.
Your response must have come while I was typing mine.
Nipun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 02:51 AM
09-29-2006 02:51 AM
Re: Printing comments from the com script
The real solution is to make the comments be the usage text. It really is a minor edit and the scripts will look better:
----------------------------------------
$if p1.nes."" then goto got_p1
$type sys$input
xxxx
xxxxx
xxxxx
USAGE:
==============================
$got_p1:
Now if you insist on using the crummy, yet firmly established and widely followed comment construct, might I recommend perl?:
--------------------------------
$! xxxx
$! xxxxx
$! xxxxx
$! USAGE:
$! ==============================
$if p1.eqs."" then perl -ne -
"exit 268435472 if /====/; print if (s/^\$! / /)" 'F$ENV("PROCEDURE")
$!all is well...
Enjoy!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 03:14 AM
09-29-2006 03:14 AM
Re: Printing comments from the com script
"$! " in the output:
alp $ type x2.com
$!
$ goto start
$!
$ usage:
$!
$ type sys$input
$ deck /dollars = "$END"
$! Text line 1.
$! Text line 2.
$END
$!
$ return
$!
$ start:
$ if (p1 .eqs. "")
$ then
$ gosub usage
$ exit
$ endif
$!
$ write sys$output "Normal."
$!
alp $ @ x2.com xxx
Normal.
alp $ @ x2.com
$! Text line 1.
$! Text line 2.
I _do_ like DECK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2006 11:27 AM
09-29-2006 11:27 AM
Re: Printing comments from the com script
search /nohighlight /window=(99,0) 'F$ENVIRONMENT("procedure") "==''=="
Adjust search string as necessary to not produce undesirable matches with other content in the command file(s).
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2006 04:46 AM
10-03-2006 04:46 AM
Re: Printing comments from the com script
Using the EachLine script (from dcl.openvms.org), and the pipe command, you can get rid of the $! and $! =======... too.
$ pipe search 'f$env("Procedure") "$! ===="/wind=(99,0) | search sys$pipe "$! ===="/match=nor | eachline in "write sys$output in-""$!"""
This one-liner will give you the contents of the comments without the prefix on each line, and without the end-comment line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2006 06:00 AM
10-03-2006 06:00 AM
Re: Printing comments from the com script
I am still exploring different options. Your suggestions look directly applicable to my current problem.
I will try to test this in a day or two and provide an update.
Thank you everyone for your feedback ...as I mentioned will provided an update in a day or two...
Nipun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 02:03 AM
10-05-2006 02:03 AM
Re: Printing comments from the com script
I tried the routine you suggested however,
the output comes out to be the entire script.
I think it doesn't stop the search at the first instance of the ====== sign but rather on the search command below which has the specified line "===="
I executed the following line
search /nohighlight /window=(99,0) 'F$ENVIRONMENT("procedure") "==''=="
I also changed the wind =(0,0)
but it didn't make a different. I am attaching the script file for feedback
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 02:21 AM
10-05-2006 02:21 AM
SolutionTry this:
$!========================================
$ IF P1 .EQS ""
$ THEN
$ x="======"
$ search /nohighlight /window=(99,0) 'F$ENVIRONMENT("procedure") 'x''x'
Or how is this for cute:
$!
$i="======================================"
$ IF P1 .EQS ""
$ THEN
$ search /nohighlight /window=(99,0) 'F$ENVIRONMENT("procedure") 'i
Still... did you try the PERL solution I showed? It gives SO MUCH control. Trivial to only do comments, trivial to remove the actual comment introducer, and so on.
And show about a re-write into the $type sys$input variant?
A simple (perl!?) script could easily do this on all your dcl scripts.
Regards,
Hein.