compile errors

longhair

Member
afternoonall,
any suggestions would be greatly appreciated.
progress 9.1c
hpux 11
attempting to generate a file with the proper headings to accept font / formatting commands that word pad will understand but the following code is producing errors:
Code:
put "{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier                      
New;}{\f1\fmodern\fprq1\fcharset0 Courier New;}}" skip 0.                       
put "{\colortbl ;\red0\green0\blue0;}" skip 0.                                  
put "{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\f0\fs20" 
skip 0.
the errors it produces are:
warning 'unable to understand compiler messages'
then in the compiler messages dialog
'** "colortbl" was not found. (293)'
'** Could not understand line 51. (193)'
'** Unmatched curly braces ({}) found in procedure. (374)'
'** Could not understand line 51. (193)'
any ideas?
regards,
longhair
 

joey.jeremiah

ProgressTalk Moderator
Staff member
curly braces ({}) have a special meaning, even in a string. for example message " the current os is {&opsys} ".

try a simple example and add a tilde (~) or, i think, a forward slash (\) in character mode. see if that fixes the problem.
 

longhair

Member
joey.jeremiah,
thanks. thought it might be that i need to 'escape' a character or two.
no longer receiving the error messages, however, output result is not as expected.
progress is interpreting (one of its greatest and worst features) what it thinks i want done. i'll play with it some more. might wind up use a .vbs or a .bat script or perhaps awk or sed or a shell script to get it done. just thought it would be easier to keep all the code in one place.
from my previous code posted i would expect the 1st 3 lines of the file (when viewed with an editor) to be:
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}{\f1\fmodern\fprq1\fcharset0 Courier New;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\f0\fs20\
what i'm getting is:
{
tf1ansideff0{ onttbl{ 0 nil charset0 Courier New;}{ 1 modern prq1 charset0 Courier New;}}
0{colortbl ;
ed0green0lue0;}
0{*generator Msftedit 5.41.15.1507;}viewkind4uc1pardlang1033 0 s20
it looks to me that progress may also be having an issue with the '\'
regards,
longhair
 

Casper

ProgressTalk.com Moderator
Staff member
Works for me:
You musn't use skip 0 but skip (0). Skip 0 means skip (1) (newline) and put a 0 in the text.

Code:
DEF STREAM s_out.
OUTPUT STREAM s_out TO c:\temp\cas.
put STREAM s_out "~{\rtf1\ansi\deff0~{\fonttbl~{\f0\fnil\fcharset0 Courier
New;~}~{\f1\fmodern\fprq1\fcharset0 Courier New;~}~}" skip (0).
put STREAM s_out "~{\colortbl ;\red0\green0\blue0;~}" skip (0).
put STREAM s_out "~{\*\generator Msftedit 5.41.15.1507;~}\viewkind4\uc1\pard\lang1033\f0\fs20" 
skip (0).

Casper
 

joey.jeremiah

ProgressTalk Moderator
Staff member
in some environments forward slash (\) has the same meaning as tilde (~), as i said in the first post, and you'll probably also need to escape the forward slash.

i'd try just a simple example with both slashes and curly brackets and use either tilde or forward slashes for escapes. there should be no problem outputing curly brackets, slashes or any other character. good lock !

joey.jeremiah,
thanks. thought it might be that i need to 'escape' a character or two.
no longer receiving the error messages, however, output result is not as expected.
progress is interpreting (one of its greatest and worst features) what it thinks i want done. i'll play with it some more. might wind up use a .vbs or a .bat script or perhaps awk or sed or a shell script to get it done. just thought it would be easier to keep all the code in one place.
from my previous code posted i would expect the 1st 3 lines of the file (when viewed with an editor) to be:
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}{\f1\fmodern\fprq1\fcharset0 Courier New;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\f0\fs20\
what i'm getting is:
{
tf1ansideff0{ onttbl{ 0 nil charset0 Courier New;}{ 1 modern prq1 charset0 Courier New;}}
0{colortbl ;
ed0green0lue0;}
0{*generator Msftedit 5.41.15.1507;}viewkind4uc1pardlang1033 0 s20
it looks to me that progress may also be having an issue with the '\'
regards,
longhair
 

longhair

Member
joey.jeremiah,
you are correct. escaped the '\' and now it puts the string correctly.

casper,
i realized the issue with skip 0 and skip(0) - was just a typo.

one more question is anyone has a solution.
i'm doing this to bold certain fields (in the outout) based upon certain conditions. when the conditions are not met progress is not aligning the fields the same as when conditions are met. any suggestions? it appears that progress is adding extra spaces for the control codes that are inserted when the conditions are met in the records where the conditions are not met.

regards,
longhair
 

Casper

ProgressTalk.com Moderator
Staff member
Do you mean you use constructions like:

PUT string(Condition,'oneway/ortherother')?

If you use these kinds of constructions then you can get rid of the extra spaces by trimming the string function:

e.g. PUT TRIM(string(Condition,'oneway/ortherother')).

Casper.
 

longhair

Member
casper,
what i'm doing is:
if condition then do:
display field1 field2 trim(varwithcontrolcodebegin) field3 trim(varwithcontrolcodeend) field4 with width 312 no-labels.
end.
else do:
display field1 field2 field3 field4 with width 312 no-labels.
end.
above is vastly simplified but gives the basic idea.
i'm going to try it with a put in a bit.
regards,
longhair
 

longhair

Member
joey.jeremiah & Casper,
thanks for the help. situation has been corrected. just had to embed spaces in my put statement. would give you each a star for the helpful posts if this forum had them.
thanks again.
regards,
longhair
 
would give you each a star for the helpful posts if this forum had them.

They are both stars. Click on the karma button against any post that particularly helped you (I only just figured this out myself, but have found to my dismay I can't up my own rep).
 
As longhair noted you need to be logged in to see it, presumably to stop people upping their own rating while anonymous (not exactly bullet-proof).

If anyone on this forum still isn't sure how to do it, feel free to test the button by clicking it against any of my posts (no, not the red triangle one).
 
Top