Operating System - OpenVMS
1747988 Members
4583 Online
108756 Solutions
New Discussion

Crashing of program with SMG$ calls when run in a command file

 
SOLVED
Go to solution
MarkOfAus
Valued Contributor

Crashing of program with SMG$ calls when run in a command file

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:

%SMG-F-EOF, end-of-file
break on unhandled exception preceding BATCH_USER_DIS\displayEmails\%LINE 34050
 34050:         rStatus = smg$delete_menu(&display);
DBG>

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,
                                    &def_number, &SMG$M_RETURN_IMMED,
                                    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.

cc/ver

Compaq C V6.4-008 on OpenVMS Alpha V7.3-2

Anyone seen anything like this? Any clues?

 

Thanks for any help,

Mark.

2 REPLIES 2
Volker Halle
Honored Contributor
Solution

Re: Crashing of program with SMG$ calls when run in a command file

Mark,

 

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.

 

Volker.

MarkOfAus
Valued Contributor

Re: Crashing of program with SMG$ calls when run in a command file

Volker,

 

 

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.

 

Cheers

Mark.