Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#27 W # on sequential files

closed
nobody
5
2008-03-20
2008-03-13
Sid
No

Writing a FormFeed to a sequential file using # generates LF+FF+LF $C(10,12,10)

Try this code:

GTM>S file="myFile.dat"
GTM>O file:(NEW:STREAM:NOWRAP)
GTM>U file W "abc",#
GTM>C file
GTM>ZSYS "ls -l myFile.dat"
-rw-rw-rw- 1 sid dba 6 Mar 13 12:43 myFile.dat

As you can see, the length is 6 instead of 4 as expected. When I take a look at the content, I get "abc" + $C(10,12,10). GT.M wraps the FormFeed character $C(12) with 2 LineFeeds $C(10).
I noticed that if I change the Write statement to W "abc",*12 it' OK and adds only the $C(12) as expected.
If I change the Open parameters to NEW:WRAP:FIXED:RECORDSIZE=1:BLOCKSIZE=1
and let the Write statement as before: W "abc",# it works fine as well, but using these paremeters in large file could slower performance.

Is there a better way to avoid the $C(10) characters without changing the original code W "abc",# ?

Discussion

  • K.S. Bhaskar
    K.S. Bhaskar
    2008-03-20

    Logged In: YES
    user_id=82850
    Originator: NO

    The first LF is due to terminating the record. It can be avoided by setting $X to
    zero before the "w #". The second LF is part of "w #" as implemented and can't be suppressed.

     
  • K.S. Bhaskar
    K.S. Bhaskar
    2008-03-20

    • status: open --> closed