Skip to Content
0
Former Member
Apr 01, 2011 at 08:06 AM

Transports Linux -> Win : Converting cofiles from Unix ascii to Dos ascii

37 Views

Hello.

We are in the middle of a migration phase from Linux SLES to Win 2003 for a R/3 4.7 installation.

Currently only the sandbox has been migrated.

The old Linux sandbox is still running for testing purposes therefore and anyhow i don't want to include the migrated hosts in the existing transport domain.

With regards to transports i copy the data/cofiles from the saptranshost on Linux to the migrated windows host.

I have executed some transports without any problem, but i have realized that the cofiles are socalled Unix ascii formatted, meaning they have the LF without the CR.

The datafiles are binary so they are ok.

I know that i can change a TR parameter to create universally compatible cofiles.

But, what is the problem with importing the files as they are (Into windows R/3, without the proper CRLF) ?

Also i've created the following snippet to convert, is this enough ?

#include <stdio.h>

#include <string.h>

int main(int argc, char **argv)

{

if(argc != 2)

{

printf("\nConverts unix ascii to windows (LF -> CRLF)");

printf("\nUsage: %s filename", argv[0]);

return 1;

}

char buf[100];

sprintf(buf, "%s.out", argv[1]);

FILE *fp = fopen(argv[1], "r");

FILE *fout = fopen(buf, "w");

int ch = 0;

while((ch = fgetc(fp))!=EOF)

{

if(ch == 0x0A)

{

fputc(0x0D, fout);

}

fputc(ch, fout);

}

fclose(fp);

fclose(fout);

return 0;

}

Thank you for your response.