10-04-2013 01:58 AM
I have a program in C which makes extensive use of SMG$ calls. The program works PERFECTLY when run from the command line but when run from within a command file it ALWAYS crashes with:
break on unhandled exception preceding BATCH_USER_DIS\displayEmails\%LINE 34050
34050: rStatus = smg$delete_menu(&display);
The offending line:
if (! (rStatus & 1) ) (void )lib$stop(rStatus);
Which is a trap for the line above it:
rStatus = smg$select_from_menu(&kb_id, &display, &number, &def_number, 0,
0, 0, &term, &selected_desc);
Even if I comment out this code the program will crash when it next encounters some input requirements via SMG$ somehwere else in the program.
Compaq C V6.4-008 on OpenVMS Alpha V7.3-2
Anyone seen anything like this? Any clues?
Thanks for any help,
Solved! Go to Solution.
10-04-2013 02:17 AM
by default, SMG$ calls read from SYS$INPUT. If you run your program from a DCL procedure, SYS$INPUT is the procedure itself. SYS$COMMAND is the terminal, from which the procedure has been invoked, if running in INTERACTIVE mode.
If you expect your SMG$ calls to read from the terminal, consider to add the following command into the DCL procedure, before the $ RUN your-program line:
$ DEFINE/USER SYS$INPUT SYS$COMMAND
This will direct your program to read from the terminal instead of from the DCL procedure.
10-04-2013 03:02 AM
Wow, you're the man!!!
I had tried exotic set terminal things but couldn't understand why it would not work.
I just amended my SMG$CREATE_VIRTUAL_KEYBOARD to use the input-device of SYS$COMMAND: rather than SYS$INPUT: and it works a treat, but I think your solution of a quick redefine of the logical is the better solution.
Once again, thank you.