Crashing of program with SMG$ calls when run in a command file (198 Views)
Reply
Regular Advisor
MarkOfAus
Posts: 158
Registered: ‎01-08-2007
Message 1 of 3 (198 Views)
Accepted Solution

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.

Please use plain text.
Honored Contributor
Volker Halle
Posts: 5,190
Registered: ‎04-26-2004
Message 2 of 3 (189 Views)

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.

Please use plain text.
Regular Advisor
MarkOfAus
Posts: 158
Registered: ‎01-08-2007
Message 3 of 3 (181 Views)

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.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation