- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Calling DCL from bash returns 1 on success
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
Discussions
Discussions
Forums
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
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
тАО07-27-2009 09:00 AM
тАО07-27-2009 09:00 AM
Here is the issue. I am running GNV bash and calling some DCL commands using the DCL command. Bash captures the return value from each command that it invokes. Typically, a command that runs successfully returns an error code of 0.
It appears that successful DCL commands return 1. Example (echo $? prints the last return value):
bash$ ls makefile.mak
makefile.mak
bash$ echo $?
0
bash$ DCL dir makefile.mak
Directory DEV_SRC:[DMAX.CFTS.ELX_004_001_008_001.SRC]
MAKEFILE.MAK;2
Total of 1 file.
bash$ echo $?
1
bash$ DCL dir makefil
%DIRECT-W-NOFILES, no files found
%DIRECT-W-NOFILES, no files found
bash$ echo $?
144
bash$
This is throwing off make (and anything else that looks at return values) because it makes it appear as if every DCL command is failing because with non-zero return value.
Any general way to work around this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 10:18 AM
тАО07-27-2009 10:18 AM
SolutionOr rebuild the DCL command in bash, if the source code is available. You'll want to map all odd values to zero here, if you take that route. Odd being success, in OpenVMS, and thus any odd value would map to zero. (I'm kinda surprised there isn't a switch on DCL to flip this. But then wildcards might not work as expected here, either.) (And the DCL command is far from the only bash command around that returns non-zero on success.)
Otherwise expect to get this stuff back here from OpenVMS. You should never get a zero status value back from an OpenVMS process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 11:14 AM
тАО07-27-2009 11:14 AM
Re: Calling DCL from bash returns 1 on success
The environments differ so you should take that into account, and the easy way out is "don't mix". "make" is a Unix-based program so run it in bash and use "ls" (with appropiate switches). in DCL, use MMS of MMK or wahever VMS-based tool you are comfortable with.
OpenVMS Developer & System Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-28-2009 01:43 AM
тАО07-28-2009 01:43 AM
Re: Calling DCL from bash returns 1 on success
What you use as DCL (here or in your makefile) is a bash utility, essentially it is /bin/dcl. It can be used if you want to execute a dcl command from the bash.
For a bash utility it is a bug to return a VMS success status.
In your makefile you can ignore the status with the '-' prefix.
For more info on using the dcl utility you may want to read the thread 1325629
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-28-2009 05:11 AM
тАО07-28-2009 05:11 AM
Re: Calling DCL from bash returns 1 on success
#!/gnu/bin/bash
# Converts DCL return value into bash return code
# In DCL, odd value means success. In bash, 0 value means success.
# If DCL failure (even), return the DCL return value.
if [ $(( $1 & 1 )) -eq "1" ]
then
exit 0
else
exit $1
fi
Usage example:
bash$ DCL SHOW TIME
28-JUL-2009 09:08:29
bash$ echo Return value is $?
Return value is 1
bash$ DCL SHOW TIME ; dcl_return $?
28-JUL-2009 09:08:53
bash$ echo Return value is $?
Return value is 0
bash$ DCL DIR BLAHBLAH ; dcl_return $?
%DIRECT-W-NOFILES, no files found
%DIRECT-W-NOFILES, no files found
bash$ echo Return value is $?
Return value is 144
bash$