Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RMCOBOL 85 usage of BACKGROUND-COLOR 2

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
US
I am trying to use a DISPLAY statement with the BACKGROUND-COLOR attribute.

Example:
DISPLAY "HELLO WORLD" LINE 1 POSITION 1 BACKGROUND-COLOR = CYAN.

I get a 0414 compiler error with RMCOBOL 85 compiler version 5.27.00 for IBM RS/6000 for AIX 3.2 stating "statement has wrong format".

I don't know if this is due to my version of RMCOBOL 85 or what, but I've worked on RMCOBOL 85 in other shops on maintenance projects and was able to display using colors.

Anyone run into a similar challenge or know of a solution?

I did a keyword search of Background color attribute and didn't have any luck.

Thanks.
-David
 
David,

Check out the CONTROL phrase, documented with the DISPLAY verb. You will find what you need there.

BACKGROUND-COLOR is available in the mostly unused SCREEN SECTION. In that context it requires an integer argument. Ain't compatibility grand!

Tom Morrison
 
In RMCOBOL, to display color you shoud declare in the working storage section the following.
01 CONTROL-VALUE.
02 PIC X(4).
88 INTENSITY-HIGH VALUE "HIGH".
88 INTENSITY-LOW VALUE "LOW".
88 INTENSITY-OFF VALUE "OFF".
02 PIC X(12).
88 REVERSE-VIDEO VALUE ", REVERSE" FALSE SPACES.
88 NO-REVERSE-VIDEO VALUE ", NO REVERSE".
02 PIC X(10).
88 BLINKING VALUE ", BLINK".
88 NO-BLINKING VALUE ", NO BLINK".
02 COLOR-CONTROL.
03 PIC X(11).
88 FCOLOR-EQUALS VALUE ", FCOLOR = "
FALSE SPACES.
03 FOREGROUND-COLOR PIC X(7).
88 FOREGROUND-IS-BLACK VALUE "BLACK".
03 PIC X(11).
88 BCOLOR-EQUALS VALUE ", BCOLOR = "
FALSE SPACES.
03 BACKGROUND-COLOR PIC X(7).
03 PIC X(11).
88 BORDER-EQUALS VALUE ", BORDER = "
FALSE SPACES.
03 BORDER-COLOR PIC X(7).
01 I PIC 99 BINARY.
01 COLOR-TABLE.
02 PIC X(7) VALUE "BLACK ".
02 PIC X(7) VALUE "BLUE ".
02 PIC X(7) VALUE "GREEN ".
02 PIC X(7) VALUE "CYAN ".
02 PIC X(7) VALUE "RED ".
02 PIC X(7) VALUE "MAGENTA".
02 PIC X(7) VALUE "BROWN ".
02 PIC X(7) VALUE "WHITE ".
01 REDEFINES COLOR-TABLE.
02 COLOR-NAME PIC X(7) OCCURS 8.
01 INTENSITY PIC X.
88 LOW-INTENSITY-DESIRED VALUES "N", "n".
88 HIGH-INTENSITY-DESIRED VALUES "Y", "y", SPACE.
01 REVERSE-VID PIC X.
88 REVERSE-VIDEO-DESIRED VALUES "Y", "y".
88 REVERSE-VIDEO-UNDESIRED VALUES "N", "n", SPACE.
01 STANDARD-CONTROL.
02 PIC X(13) VALUE "BORDER=BLACK,".
02 SUBSTANDARD-CONTROL PIC X(47) VALUE
"LOW,FCOLOR=WHITE,BCOLOR=BLACK".
01 ROUGE PIC X(80).
01 ROUGEA PIC X(80).
01 ROUGEB PIC X(80).
01 ROUGEC PIC X(80).
01 ROUGEACCT PIC X(80).
01 BLEU PIC X(80).
01 VERT PIC X(80).
01 VERTB PIC X(80).
01 BRUN PIC X(80).
01 BRUNB PIC X(80).
01 CYAN PIC X(80).
01 MAGENTA PIC X(80).
01 BLANC PIC X(80).



and then in procedure division
MAIN SECTION.
D1.
MOVE SPACES TO CONTROL-VALUE.
SET FCOLOR-EQUALS, BCOLOR-EQUALS, BORDER-EQUALS TO TRUE.
MOVE COLOR-NAME (5) TO BACKGROUND-COLOR.
MOVE COLOR-NAME (8) TO FOREGROUND-COLOR.
MOVE CONTROL-VALUE TO ROUGE.
MOVE COLOR-NAME (2) TO BACKGROUND-COLOR.
MOVE COLOR-NAME (8) TO FOREGROUND-COLOR.
MOVE CONTROL-VALUE TO BLEU.
* MOVE COLOR-NAME (3) TO BACKGROUND-COLOR.
* MOVE COLOR-NAME (1) TO FOREGROUND-COLOR.
* MOVE CONTROL-VALUE TO VERT.
MOVE COLOR-NAME (1) TO BACKGROUND-COLOR.
MOVE COLOR-NAME (7) TO FOREGROUND-COLOR.
MOVE CONTROL-VALUE TO VERT.
MOVE COLOR-NAME (7) TO BACKGROUND-COLOR.
MOVE COLOR-NAME (8) TO FOREGROUND-COLOR.
MOVE CONTROL-VALUE TO BRUN.
MOVE COLOR-NAME (4) TO BACKGROUND-COLOR.
MOVE COLOR-NAME (8) TO FOREGROUND-COLOR.

move .... and so one


and to display :

DISPLAY " " ERASE CONTROL ROUGE.


excuse me for my english.

i think you it will work very good.

Z.Faouzi

 
Okay.
The format syntax on my manual for Screen Section shows:

SCREEN SECTION.
[screen-descr-entry] ...

What I coded was after my WORKING STORAGE:

SCREEN SECTION.
01 DISP-SCREEN VALUE "BACKGROUND-COLOR = 5".

DISPLAY "HELLO WORLD" CONTROL DISP-SCREEN LINE 1 POSITION 1
$
I'm getting compiler error 0528 - screen name is not permitted here

I don't understand what the manual is explaining for the format of CONTROL { identifier-4 or literal-4 }

On page 6-61 for the CONTROL phrase, it states "The value of identifier-4 or literal-4 in the CONTROL phrase is used to specify a dynamic option list. The value must be a character-string consisting of a series of keywords delimited by commas; some keywords allow assignment of a value by following the keyword with an equal sign and the value".

None of this information in the manual is making sense to me.

-David
 
If you want to use SCREEN SECTION stuff then you need to use the DISPLAY screen-name statement (also identified as "Format 3: Display Screen-Name" in the Language Reference Manual (LRM). You are attempting to use a Format 2 DISPLAY, which is not appropriate for SCREEN SECTION.

faoco shows what might appear as the value of a CONTROL phrase literal or variable.

Note also that the LRM refers to the RM/COBOL User Guide for more information; look there for some small examples.

Try this example of a Format 2 DISPLAY:
Code:
DISPLAY "HELLO WORLD" LINE 1 POSITION 1 CONTROL "BCOLOR=CYAN"

Tom Morrison
 
Here is how I use RMcobol colors using a screen section.
Just display or accept the screen name NAS1.
Enjoy Bob


01 NAS1.
05 BLANK SCREEN.
05 BACKGROUND IS BLUE.
05 FOREGROUND IS WHITE.
05 LINE 3 COL 2
"5 OF LAST NAME :".
05 PIC X(5) TO IND-NKY AUTO.
05 LINE 4 COL 2
"STATE :".
05 PIC X(2) TO IND-STATE AUTO.
05 PIC X(25) FROM ERRORMSG.
05 LINE 11 COL 2 'ESC KEY WILL QUIT PROGRAM'.

 
Tom,

For

DISPLAY "HELLO WORLD" LINE 1 POSITION 1 CONTROL "BCOLOR=CYAN"

it did not give me a compile or run-time error but it display that string with white letters and black behind the letters. The rest of the screen stays blue.

This is the format I seem to recall using before at a different shop without any problems. Do I still need a SCREEN SECTION setup with this format 2 usage of DISPLAY?
-Dave
 
Being a UNIX system you also need to have the correct terminfo/termcap entries.
And depending on the terminal (or terminal emulator) you may not be able to have color, even if the terminfo/termcap is correctly configured.

As you are working with v5.22 this version can work with terminfo and this would normally be the most usual.

So what we need to help you is
1- terminfo or termcap you are using (source)
2- Terminal used (either emulation or program)


And that display is enough, no need for a screen section entry.
 
Okay.

I've found the termcap in /etc directory.

All I can say from viewing that termcap file is that it is an IBM product. At the top of the code in this file it states:

src/bos/usr/ccs/lib/libtermcap/termcap.src, libtermcap, bos430, 9737A_430 5/5/94 10:47:01

I'm running on a Century TERM 32 terminal.

Please let me know the steps I need to take to provide the information you requested for termcap(source) and Terminal Used that you mentioned above.

Thanks.
-David
 
This one is going to be hard..

give us the output of
echo $TERM

and then search within the termcap file for a entry equal to the result above.

also search for the terminfo entry.
This is normally in /usr/lib/terminfo, and there should be a file there with all the terminfo entries.
Once again search for an entry with the result above.

Put both FULL entries here, along with the $TERM output
 
Frederico,

Thanks for your help! Termcap/terminfo is one area where I have no experience.

Catch a star!

Tom Morrison
 
Fredericofonseca:

I think my Century Tiny Term 32 emulator had the terminal emulation settings as VT220. This was about 3 weeks ago. But my DISPLAY statements were not showing up. So, I was advised to set the emulation settings as IBM3151 and after doing so the display statements then worked.

echo $TERM
$TERM output---> ibm3151
Not found upon search of ibm3151 in termcap file in the /etc/termcap file

On the 2nd step above regarding going to the /usr/lib/terminfo directory - I did this and there were about 30 file/directories upon doing an "ls".
I'm not sure which would possibly have the "ibm3151" entry in it.

So at the /usr/lib/terminfo directory I entered:

grep -c ibm3151 /usr/lib/terminfo/* | more
and all had a count of "0"
same for:
grep -c IBM3151 /usr/lib/terminfo/* | more
 
Ok.
First when doing a grep you should do "grep -i string file(s)"
the -i will do an ignore case search.

As for the terminfo. Sometimes the "source" file is not there. Nevertheless the terminfo entry will be in
/usr/lib/terminfo/i/ibm3151
(Note that all terminfo entries are within a directory named after the first letter of the terminfo emulation used).

As you are using a terminal emulator, you can have colors.
Do you really need to use that particular emulation or can you use one of the others available, such as AT386 or SCO ansi?

In the mean time, can you go the the terminfo directory and get the files ibm3151, AT386* and *ansi* that may be there, and send these by email to me at
frederico_fonseca @ syssoft-int.com

and I will have a look at them

While waiting for the info change your terminal type to ansi
TERM=ansi;export TERM
and changing it in the emulation also

and try it that way.
 
I'm not allowed to send those files out.
I did a vi on those files and they're all encrypted anyway.

Where do I code the TERM=ansi;export TERM?

I tried that at the UNIX prompt. Changed my Emulator settings to "ansi" from "ibm3151" and no luck.

Thanks.
-david
 
Humm. Who is preventing you from doing that? Those files are OS files, are public knowledge, are not encrypted, just compiled.

If you have a System Administrator, ask him to compile the following terminfo entry.
------------------
ansicobol|Ansi standard console for RMCOBOL,
am, bce, eo, xon,
colors#8, cols#80, it#8, lines#25, pairs#64,
acsc=0[I|`ja0fxgqh2jYk?lZm@nEqDtCu4vAwBx3~y;;IIHH<<JJKKMM::LL99NN88UUTT>
>OOQQFF55XX77VVSS==PPRRGG66WW,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z,
civis=\E[=14;12C, clear=\E[2J\E[H, cnorm=\E[=10;12C,
cr=\r, cub1=\b, cud1=\E[B, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M,
ed=\E[m\E[J, el=\E[m\E[K, home=\E[H, ht=\t, ich1=\E[@,
il1=\E[L, ind=\E[S, invis=\E[8m, kLFT=\E[d, kRIT=\E[c,
kbs=\b, kc3=\t, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C,
kcuu1=\E[A, kdch1=\E[{, kend=\E[F, kf1=\E[M, kf10=\E[V,
kf11=\E[W, kf12=\E[X, kf2=\E[N, kf3=\E[O, kf4=\E[P,
kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U,
khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I,
op=\E[37;40m, rev=\E[7m, ri=\E[T, rmacs=\E[10m,
rmso=\E[m, rmul=\E[m, setb=\E[4%p1%dm,
setf=\E[3%p1%dm, sgr0=\E[10;0m, smacs=\E[12m,
smso=\E[7m, smul=\E[4m,
---------------

Then set the TERM in the unix prompt (or in your .profile), and on the emulator.

The variables that affect the colors are
setf and
setb and
colors#8

Apart from this there is nothing else I can do.


 
Sorry, I should have mentioned the following.

Set the term to ansi in the emulator.
in your session (or .profile) set
TERM=ansicobol;export TERM
 
Fredericofonseca:

I did this, but had no luck. Out of all the choices in my emulator, I got it to finally work using AT386.
I did this just on a hunch. I went to the /usr/rmcobol directory and saw a file called terminfo.aix. Viewed the file and noticed a line coded as:

ansi|ansi-c|Ansi standard crt w/color
yadaydayad
...
..
..

and then another line aftewards coded as:

AT386|at386|386AT|386at|at/386 console w/ansi colors,

and another line with

AT386|at386|386AT|386at|at/386 console w/IBM colors,

Anyway, for some reason when I select AT386 and set the TERM=AT386;export TERM, it works!

Strange. Do you know why it would work with AT386? Anyway that I can view the AT386 in the /usr/lib/terminfo/A directory? The AT386 file is compiled as you mentioned above. Just kind of want to learn WHY this worked, you know what I mean; plus it may help others in the future if they run into something like this.
Star to ya!
Thanks a lot for the help.
-David
 
Glad it is working.
Just a few issues.

1- Did you compile the ansicobol entry I sent you? Did it issue any errors?

If so, and after changing the TERM to be ansicobol, can you try the following
tput setb 1
and write something in the terminal after this.

 
No, I didn't. My Systems Administrator is not available right now.

But, i'd be glad to give it a whirl.
Just clarify a few instructions for me....

a)do I just create a new file by command vi, name it MYANSICOBOL(or whatever), type that code in you sent, save it?
b)then at UNIX prompt, do I use &quot;compile MYANSICOBOL&quot; to get it compiled, or would I use rmcobol MYANSICOBOL?
c)After I get it compiled, I set TERM=ANSI;export ANSI???
and choose ANSI as my Emulator option???
d)Above are you saying I should type &quot;tput setb1&quot; at the unix prompt? And then type something in the terminal? I guess a blank screen is supposed to come up and I type something?

Thanks.
-David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top