Duey,

The hard space, char(255), was called that back in the DOS days when it looked 
like a space.
In Windows, the same character is visible is often displayed, depending on the 
font you use.

Unlike the space, CHAR(32), RBASE never drops it as it does with some spaces.

Per much discussion recently, I would avoid using it.

Larry Lustig proposed something which I find to be the cleanest, simplest, and 
least error prone way to generate a data file

SET VAR vCRLF TEXT = (CHAR(13)+CHAR(10))
SET VAR vDataLine TEXT
SET VAR vDataLength INT = 512
SET VAR vPastEnd INT = (.vDataLength+1)
SET VAR vTotalLength = (.vDataLength+2)
OUTPUT anyfile
SET VAR vLineNo INT = 1
WHILE vLineNo <= 10 THEN

   SET VAR vDataLine TEXT = NULL
   -- Build up the data line in any way you choose

   -- SPUT is the easiest way to insert specific data into the string at 
precise positions
   -- Most files of this type are fixed field data (each piece starts at a 
precise location in the line)
  Set var vDataLine = (SPUT(.vDataLine,.'SOME TEXT',100))

   -- Repeat as necessary to insert all data in to the line.

   --Add CarriageReturn/LineFeed charaters to the line
  Set var vDataLine = (SPUT(.vDataLine,.vCRLF,.vPastEnd))

  --Make sure no trash data exists beyond CR/LF
  Set var vDataLine = (SGET(.vDataLine,..vTotalLength,1))

  --Write the line, telling RBASE not to add its own CRLF
 WRITE .vDataLine  CONTINUE

 SET VAR vLineNo = (.vLineNo + 1)
ENDW
OUTPUT SCREEN

If you were to run the code above, assuming I have no typos, you would get a 
file with 10 identical lines of 512 spaces with 'SOME TEXT' pasted at position 
100 in each line.

This method gives you total control.  Exercise due care to make sure you are 
getting what you expect.
Use a text editor with a fixed space font to check your file for correctness.

Dennis McGrath















________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Heffelfinger, 
Duane
Sent: Sunday, March 08, 2009 11:37 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Stripping "blanks" off the end of file lines

Dennis or others,

Can you expand a little bit further on the hard space?  What it is?  What the 
difference is between a hard and soft space?

When I see a file with CHAR(255) it produces this character (ΓΏ) when I view the 
file.  Is that expected?  Will the IRS computers accept this as a space?

I have another method that I've used for a very long time by placing a 
character at position 513, then stripping it using another piece of software I 
developed.

This year I've added the state data to the irs  record and would consider 
changing to something purely Rbase if I could get it to pass the irs computer 
system.

Thanks for any input.

Duey


From: [email protected] [mailto:[email protected]] On Behalf Of Dennis McGrath
Sent: Wednesday, February 25, 2009 3:57 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Stripping "blanks" off the end of file lines

You don't have to work that hard.

Build up your text string and then use my sput suggestion to drop a hard space 
at position 255 and you are done!
It is dead simple.  You will wind up with soft blanks with a hard blank at the 
end.  RBASE automatically fills a string with spaces when you sput beyond the 
length of the string.

Example:
Set var vtmp = 'xxx'
Set var vtmp = (SPUT(.vTmp,char(255),512))

This will create a string of 3 x's followed by 508 spaces followed by a hard 
space.


Dennis

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Gray, Damon
Sent: Wednesday, February 25, 2009 3:47 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Stripping "blanks" off the end of file lines

I believe I can make this work, because the last data element for each employee 
record is at position 489.  thus I can append the required hard blanks with 
SPUT at position 490 to get the required 512 length.

You have all be VERY helpful ... as always!  ;-)



________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, February 25, 2009 1:38 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Stripping "blanks" off the end of file lines

Oh wow, if Dennis is right then that would be a problem....    If this is a 
fixed-length file, with everything in the same "columns", then you could create 
2 variables of 250 each and then concatenate them together.   But if the 
individual data elements are variable in length then that wouldn't work ...

Karen




Damon,

I just checked the docs.

SFIL only works to 500 characters!



Dennis

Reply via email to