Preserve non-character data in a text mode transfer

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Preserve non-character data in a text mode transfer

Post by lrabbe »

I'd like to know if I can preserve non-character data while using text mode to transfer a file.

I'm using the Co:Z SFTP server on z/OS and a SunOS SFTP client.

The data is text data but the source file also contains non-character data, specifically x'0D'. In this case x'0D' is not used as a carriage return. The process which uses the file expects the x'0D'.

The x'0D' is translated to x'40' when I use the default linerule parameter, which I believe is 'flexible' for a write. Changing the linerule parameter doesn't work in this case because x'0D' isn't used as an end-of-line character.

The client has the following options in effect:

NOlinerule
clientcp=ISO8859-1
servercp=IBM-1047
mode=text
trim

Is there a way to execute a text mode transfer that will also preserve non-character data?
coz
Posts: 392
Joined: Fri Jul 30, 2004 5:29 pm

Re: Preserve non-character data in a text mode transfer

Post by coz »

This is for a "put" from the Sun system to z/OS, right?

If you don't want any line termination processing, use linerule=none rather than NOlinerule (this will cause the default of 'flexible' to be used if you are doing a put).

Is it possible that you have a file pattern setup that is overriding your settings?

To verify, set loglevel=D prior to your put command, then check the Co:Z sftp log on z/OS to see if a pattern is being used and if it is changing the linerule.

Also, just to be sure you have the right codepages, run the Co:Z command: showtrtab -s iso8859-1 -t ibm-1047 and check the results. You should see "0D" in the 0x0D position of the table.
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Re: Preserve non-character data in a text mode transfer

Post by lrabbe »

Thank you for the suggestions.

I'm not using a file pattern. I verified by setting loglevel=D.

I ran the showtrtab command. It shows x'0D' translating to x'0D'.
coz
Posts: 392
Joined: Fri Jul 30, 2004 5:29 pm

Re: Preserve non-character data in a text mode transfer

Post by coz »

This transfer should preserve the 0x0d in the file.

You can turn on tracing with the following option:

ls /+loglevel=F,Translator=F

Please run your failing transfer again and send the log to info@dovetail.com - we'll take a look. If you can include a non-confidential version of the file that fails (in binary) that would be helpful.
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Re: Preserve non-character data in a text mode transfer

Post by lrabbe »

The Translator option is unknown at my installation.
coz
Posts: 392
Joined: Fri Jul 30, 2004 5:29 pm

Re: Preserve non-character data in a text mode transfer

Post by coz »

There's a typo in my command. Use a dot instead of a comma.

Are you trying to transfer a POSIX file or a dataset?
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Re: Preserve non-character data in a text mode transfer

Post by lrabbe »

It's a POSIX file being put to an MVS dataset.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Preserve non-character data in a text mode transfer

Post by dovetail »

I tested this with your test source file, and I can't reproduce this problem.

Here is what I did (from remote OpenSSH client; my input in blue)

> # display your test source ascii file in hex
> od -tx1 test_bin.txt
0000000 32 30 31 32 30 37 33 30 30 30 30 0d 0d 0a 32 30
0000020 31 32 30 37 33 30 30 30 30 0d 0a
>sftp kirk@zos
sftp>
sftp> ls /+mode=text,linerule=none
/+mode=text,linerule=none
sftp> ls /+recfm=fb,lrecl=80,space=trk.1.1
/+recfm=fb,lrecl=80,space=trk.1.1
sftp> ls /+ (display current options)
/+/clientcp=ISO8859-1 /+/error.log /+/linerule=none /+/loglevel=I /+/lrecl=80 /+/mode=text
/+/recfm=fb /+/servercp=IBM-1047 /+/space=trk.1.1 /+/trim
sftp> put test_bin.txt //kirk.testbin.txt
Uploading test_bin.txt to //kirk.testbin.txt
test_bin.txt 100% 27 0.0KB/s 00:00

In SPF Browse, I see this result:

Code: Select all

BROWSE    KIRK.TESTBIN.TXT                           Line 00000000 Col 001 080
********************************* Top of Data **********************************
 ------------------------------------------------------------------------------
20120730000...20120730000..                                                     
FFFFFFFFFFF001FFFFFFFFFFF0144444444444444444444444444444444444444444444444444444
20120730000DD520120730000D500000000000000000000000000000000000000000000000000000
This is exactly what I would expect - ascii -> ebcdic translation, including control characters with no line to record converion.
Can you reproduce these results?
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Re: Preserve non-character data in a text mode transfer

Post by lrabbe »

I get the same result when I use linerule=none.

The extra x'0D' on the first line isn't preserved when I let linerule default to flexible.

I'd like to be able transfer this file so that the line breaks are as they are in the source file, the CRLF is translated to x'4040', and the extra x'0D' on the first line is preserved. Is that possible?

Thank you
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Preserve non-character data in a text mode transfer

Post by dovetail »

linerule=flexible (the default) means that any combination of CR, NL, LF is treated as a line break.

linerule=none means that no line terminators are used to break lines into records

If you only want LF (0x0A) to be considered, then use linerule=lf

Then you get:

Code: Select all

 BROWSE    KIRK.TESTBIN.TXT                           Line 00000000 Col 001 080
********************************* Top of Data **********************************
 ------------------------------------------------------------------------------
20120730000..                                                                   
FFFFFFFFFFF004444444444444444444444444444444444444444444444444444444444444444444
20120730000DD0000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
20120730000.                                                                    
FFFFFFFFFFF044444444444444444444444444444444444444444444444444444444444444444444
20120730000D00000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
lrabbe
Posts: 6
Joined: Fri Jul 20, 2012 12:51 pm

Re: Preserve non-character data in a text mode transfer

Post by lrabbe »

My issue is resolved.

I understand the linerule parameter better now. Thank you for your help.
atrivino
Posts: 17
Joined: Wed Jul 13, 2011 9:28 am

Re: Preserve non-character data in a text mode transfer

Post by atrivino »

Does linerule=none would handle not placing end of line into the file or is this another option?
Post Reply