Thanks for the replies, Carl and Craig:

Carl wrote:

Please send us the output of the following:

directory/full (of the output file produced by your C++ program

dump/header/block:count:1 (of the same file)

I suspect there's some interesting file/record type here (streamlf or something similar)

It would also be interesting to compare the above with the same utility output for the earlier version of the C++ program (without ANSI-standard iostream support).

--------------------------------------------

Craig wrote:


To follow up on Carl's comment, how is the file being created?  Do you have control over the creation?  If it's created by DCL (e.g. by the PIPE command) you may be hard-pressed to get a stream-oriented file.  Sometimes, though, I think you can solve this problem by using freopen and passing "rat=cr","rfm=stmlf" as the optional arguments.

--------------------------------------------

Travis replies:

We have control over the source of the program that is producing the output.  The output normally goes to the screen, which still works fine.  We don't have any control that I know of over the type of file that is created when one

 - pipes the output to a file
 - spawns the program with the output going to a log file
 - uses Perl to execute the program and pull the output into an internal data structure

When you use the DCL TYPE command on the files, they all appear on the screen with full lines, the same as they look when coming directly from the program, but in the file there are multiple records per line.  Looking in the dumps, you can see the carriage control information that is being used by TYPE to do that.

While we probably can use the sync_with_stdio( false ) trick to change the format of the output for the particular program that is causing a problem right now, we don't know where people may have written Perl or DCL scripts to parse the output of this or other programs, so I'm wondering whether there are any other tricks that people have used to correct the problem at the script level.  I believe one could write a little intermediate program to process its stdin from the original program and put out the desired lines of text to its stdout, but that would involve some details of VMS file processing that I'd rather avoid.  Not having written anything like that, I'm not sure what the input looks like, but I see that piping it to SORT results in a file that still has the carriage control information.

--------------------------------------------

I have four sample executables to illustrate the situation.  The basic program is:

#include <iostream>

void main ()
{
    cout << "AAA" << "BBBB" << "CCCCC" << endl;
    cout << "AAA" << "BBBB" << "CCCCC" << endl;
}

--------------------------------------------

I compiled it without any qualifiers to produce oldlib.exe (uses the pre-ANSI-standard library).

I compiled it with the /define=__use_std_iostream qualifier to produce sync.exe (uses the ANSI-standard library).

I changed the cout lines in the basic program to the following to produce syncslashn.exe (uses the ANSI-standard library):

cout << "AAA" << "BBBB" << "CCCCC\n";

I added the following line to the basic program to produce nosync.exe (uses the ANSI-standard library):

ios_base::sync_with_stdio( false );

----------------------------------------------------------------

I defined a foreign command for each executable and ran the following Perl script:

@oldlibresults = `oldlib`;
print "\nAbout to do oldlib.\n";
foreach (@oldlibresults)
{
    print "Record: $_";
}

@syncresults = `sync`;
print "\nAbout to do sync.\n";
foreach (@syncresults)
{
    print "Record: $_";
}

@syncslashnresults = `syncslashn`;
print "\nAbout to do syncslashn.\n";
foreach (@syncslashnresults)
{
    print "Record: $_";
}

@nosyncresults = `nosync`;
print "\nAbout to do nosync.\n";
foreach (@nosyncresults)
{
    print "Record: $_";
}

----------------------------------------------------------------

The results were:

About to do oldlib.
Record: AAABBBBCCCCC
Record: AAABBBBCCCCC

About to do sync.
Record: AAA
Record: BBBB
Record: CCCCC
Record:
Record: AAA
Record: BBBB
Record: CCCCC
Record:

About to do syncslashn.
Record: AAA
Record: BBBB
Record: CCCCC
Record: AAA
Record: BBBB
Record: CCCCC

About to do nosync.
Record: AAABBBBCCCCC
Record: AAABBBBCCCCC

-----------------------------------------------------------------

I piped each command to a file (e.g. $ pipe sync > sync.temp) and the full directory of the files follows, with some redundant and irrelevant fields left out:

OLDLIB.TEMP;1                 File ID:  (40789,10,0)
Linkcount:  1
Size:            1/69
File organization:  Sequential
Shelved state:      Online
Caching attribute:  Writethrough
File attributes:    Allocation: 69, Extend: 0, Global buffer count: 0, No version limit
Record format:      VFC, 2 byte header, maximum 0 bytes, longest 12 bytes
Record attributes:  Print file carriage control
RMS attributes:     None
Journaling enabled: None
File protection:    System:RWED, Owner:RWED, Group:RWED, World:RE
Access Cntrl List:  None
Client attributes:  None

SYNC.TEMP;1                   File ID:  (26678,34,0)
Size:            1/69
File organization:  Sequential
Shelved state:      Online
Caching attribute:  Writethrough
File attributes:    Allocation: 69, Extend: 0, Global buffer count: 0, No version limit
Record format:      VFC, 2 byte header, maximum 0 bytes, longest 5 bytes
Record attributes:  Print file carriage control

SYNCSLASHN.TEMP;1             File ID:  (40781,11,0)
Size:            1/69
File organization:  Sequential
Shelved state:      Online
Caching attribute:  Writethrough
File attributes:    Allocation: 69, Extend: 0, Global buffer count: 0, No version limit
Record format:      VFC, 2 byte header, maximum 0 bytes, longest 5 bytes
Record attributes:  Print file carriage control

NOSYNC.TEMP;1                 File ID:  (40780,12,0)
Size:            1/69
File organization:  Sequential
Shelved state:      Online
Caching attribute:  Writethrough
File attributes:    Allocation: 69, Extend: 0, Global buffer count: 0, No version limit
Record format:      VFC, 2 byte header, maximum 0 bytes, longest 12 bytes
Record attributes:  Print file carriage control

-----------------------------------------------------------------

The dumps follow, again with redundant and irrelevant lines left out:


Identification area
    File name:                            OLDLIB.TEMP;1

Header area
    Identification area offset:           40
    Map area offset:                      100
    Access control area offset:           255
    Reserved area offset:                 255
    Extension segment number:             0
    Structure level and version:          2, 1
    File identification:                  (40789,10,0)
    Extension file identification:        (0,0,0)
    VAX-11 RMS attributes
        Record type:                      Variable with fixed control
        File organization:                Sequential
        Record attributes:                Print carriage control
        Record size:                      12
        Highest block:                    69
        End of file block:                1
        End of file byte:                 32
        Bucket size:                      0
        Fixed control area size:          2
        Maximum record size:              0
        Default extension size:           0
        Global buffer count:              0
        Directory version limit:          0
    File characteristics:                 <none specified>
    Caching attribute:                    Writethrough
    Map area words in use:                3
    Access mode:                          0
    Back link file identification:        (77197,14,0)
    Journal control flags:                <none specified>
    Active recovery units:                None
    File entry linkcount:                 0
    Highest block written:                69
    Client attributes:                    None

Virtual block number 1 (00000001), 512 (0200) bytes

 43434343 43424242 42414141 8D01000E ....AAABBBBCCCCC 000000
 43434343 43424242 42414141 8D01000E ....AAABBBBCCCCC 000010
 00000000 00000000 00000000 0000FFFF ................ 000020
 00000000 00000000 00000000 00000000 ................ 000030

-----------------------------------------------------------------

Identification area
    File name:                            SYNC.TEMP;1

Header area
    VAX-11 RMS attributes
        Record type:                      Variable with fixed control
        File organization:                Sequential
        Record attributes:                Print carriage control
        Record size:                      5
        Highest block:                    69
        End of file block:                1
        End of file byte:                 60
        Bucket size:                      0
        Fixed control area size:          2
        Maximum record size:              0
        Default extension size:           0
        Global buffer count:              0
        Directory version limit:          0
    File characteristics:                 <none specified>
    Caching attribute:                    Writethrough
    Map area words in use:                3
    Access mode:                          0
    File entry linkcount:                 0
    Highest block written:                69
    Client attributes:                    None

Virtual block number 1 (00000001), 512 (0200) bytes

 42424242 00000006 00414141 00010005 ....AAA.....BBBB 000000
 00050000 00020043 43434343 00000007 ....CCCCC....... 000010
 00074242 42420000 00060041 41410001 ..AAA.....BBBB.. 000020
 0000FFFF 00000002 00434343 43430000 ..CCCCC......... 000030
 00000000 00000000 00000000 00000000 ................ 000040

-----------------------------------------------------------------

Identification area
    File name:                            SYNCSLASHN.TEMP;1

Header area
    VAX-11 RMS attributes
        Record type:                      Variable with fixed control
        File organization:                Sequential
        Record attributes:                Print carriage control
        Record size:                      5
        Highest block:                    69
        End of file block:                1
        End of file byte:                 52
        Bucket size:                      0
        Fixed control area size:          2
        Maximum record size:              0
        Default extension size:           0
        Global buffer count:              0
        Directory version limit:          0
    File characteristics:                 <none specified>
    Caching attribute:                    Writethrough
    Map area words in use:                3
    Access mode:                          0
    File entry linkcount:                 0
    Highest block written:                69
    Client attributes:                    None

Virtual block number 1 (00000001), 512 (0200) bytes

 42424242 00000006 00414141 00010005 ....AAA.....BBBB 000000
 41410001 00050043 43434343 8D000007 ....CCCCC.....AA 000010
 43438D00 00074242 42420000 00060041 A.....BBBB....CC 000020
 00000000 00000000 0000FFFF 00434343 CCC............. 000030
 00000000 00000000 00000000 00000000 ................ 000040

-----------------------------------------------------------------

Identification area
    File name:                            NOSYNC.TEMP;1

Header area
    VAX-11 RMS attributes
        Record type:                      Variable with fixed control
        File organization:                Sequential
        Record attributes:                Print carriage control
        Record size:                      12
        Highest block:                    69
        End of file block:                1
        End of file byte:                 32
        Bucket size:                      0
        Fixed control area size:          2
        Maximum record size:              0
        Default extension size:           0
        Global buffer count:              0
        Directory version limit:          0
    File characteristics:                 <none specified>
    Caching attribute:                    Writethrough
    Map area words in use:                3
    Access mode:                          0
    File entry linkcount:                 0
    Highest block written:                69
    Client attributes:                    None

Virtual block number 1 (00000001), 512 (0200) bytes

 43434343 43424242 42414141 8D01000E ....AAABBBBCCCCC 000000
 43434343 43424242 42414141 8D01000E ....AAABBBBCCCCC 000010
 00000000 00000000 00000000 0000FFFF ................ 000020
 00000000 00000000 00000000 00000000 ................ 000030


--Travis

ALSTOM's T&D Energy Automation & Information Business
Bellevue, WA

CONFIDENTIALITY: This e-mail and any attachments are confidential and may be privileged. If you are NOT a named recipient: please notify the sender immediately, do NOT disclose the contents to another person, do NOT use the contents for any purpose, do NOT store or copy the information in any medium.

CONFIDENTIALITE : Ce message et les �ventuelles pi�ces attach�es sont confidentiels. Si vous n'�tes pas dans la liste des destinataires, veuillez informer l'exp�diteur imm�diatement et ne pas divulguer le contenu � une tierce personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas stocker ou copier l'information qu'il contient sur un quelconque support.

Reply via email to