HPE 9000 and HPE e3000 Servers
1753528 Members
5282 Online
108795 Solutions
New Discussion юеВ

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

 
aachu
New Member

Escape sequences in Server Express 4.0 MF COBOL on HP-UX

Hello All,

I have a burning issue. We had an application running on MF COBOL 1.5 on HP-UX box.
We have recompiled the same using Server Express 4.0.

Now, certain cobol programs use shell scripts to perform tasks using CALL "SYSTEM"
THese scripts in turn use Escape sequences to execute some commands.

But in Server express 4.0, those escape sequences are directly displayed onto the screen instead of executing them.

Is there some way to overcome this issue ?? THe $TERM varaibles are the same.
Just that even a sample SE 4.0 program also doesn't understand escape sequence.
Is there some way in MFC SE 4.0 to get esc. sequence working ????
5 REPLIES 5
Peter Godron
Honored Contributor

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

What are you using as escape character?
Have you tried pling (!) ?
Prefix string to be escaped, so "\tmp" becomes "!\tmp"

Please let us know the result.
aachu
New Member

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

Hello,

Thanks for the reply.
I have a COBOL program which in turn calls a UNIX shell script.
Inside the shell script there is an executable which throws escape sequences onto the screen.

There is no way I can alter the escape sequence that is being thrown. Just that I need some way to get it functioning.

Is it a known fact that escape sequences are not supported by Server Express 4.0 ?? If that is so, how do we port older programs which use escape sequences extensively ??

Please reply.

Thanks,
Rajesh R


Bill Hassell
Honored Contributor

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

escape sequences are just a fancy name for special characters, so they are probably working just fine. Assuming the script is very simple and just uses echo to display characters to stdout, you can run the script by hand as a test but redirect stdout to cat -v to see the characters:

./myscript | cat -v

$TERM does NOT enable any functions at all. It is an implementation flag for your current terminal and the curses library of system calls. Inside your script, properly written code would use tput rather than hardcoded escape sequences. In that case, $TERM must match your terminal -- you can't force $TERM to a desired value as it may have nothing in common with your actual terminal. Use this command:

ttytype -s

to identify your terminal and if $TERM does not match what ttytype reports, then $TERM must be set to match your current terminal. You can do this:

eval $(ttytype -s)

and now you terminal is correctly documented. And if the script uses tput, then the correct escape sequences will be generated for your current terminal.

However, if the script is hardcoded (no tput usage), then $TERM has no effecty at all and you must research what kind of terminal the original programmer expected you to use. When you see portions of escape sequences on your screen, you can be sure that the terminal you are using is not supported by the script. This si the very reason that tput (and see man terminfo) exists.


Bill Hassell, sysadmin
aachu
New Member

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

Thanks for the reply.
WE've fixed the problem. It was rather silly.

The TERM type gets changed to 'mfdebug' inside any Server Express 4.0 executable whatever the exported type.. However the TERM that we exported was 70092.

To notify COBOL SE 4.0 compiler not to do it, we need to remove +A option from COBSW flag before compiling it. (non-animate mode).

In that case 70092 is retained and everthing works fine.

But, the problem would still be there in Animate mode. We're trying to fudge the 70092 func. into mfdebug term src file.

I would like to have ur comments about this.

Thanks,
Rajesh R

Bill Hassell
Honored Contributor

Re: Escape sequences in Server Express 4.0 MF COBOL on HP-UX

The 70092 string for $TERM applies only to HP terminals, specifically the 700-series such as the 700/92, 700/94, 700/96. So if you are using an HP terminal, then the sequences will work. I don't work with MF COBOL so the (rather bizarre) behavior of the code to change $TERM is unexpected and certainly undesirable. In searching through Google, I found this comment:

> Make sure that your COBTERMINFO environment variable is set
properly and then use mftic to build the $COBDIR/terminfo/mfdebug.src
file. If your function keys operate properly in a normal run unit
(cobrun or cobrun_t) then this should fix your problem.

Now this implies that the COBOL code generator is trying to replace the classic Unix terminal handling (ie, curses) in some fashion. I did not see any other useful references to TERM=mfdebug so you may need to research this. Now since the MFC code (and perhaps the script) seem to pay attention to TERM variable, a simple workaround would be something like this:

if [ $TERM = mfbedug ]
then
export TERM=70092
fi

Insert this to the top of the shell script (I'm assuming it's a POSIX or ksh script). I never advocate forcing a TERM variable like this since it bypasses all the automatic matching of terminal codes, but as long as you are using an HP terminal (or terminal emulator such as Reflection for HP, QCterm or the Minisoft HP emulator) this should work.


Bill Hassell, sysadmin