Sending tilde (~) using COZBATCH

Discussion of the free COZBATCH utility for z/OS
Post Reply
the1nfamous
Posts: 9
Joined: Wed May 21, 2014 4:19 am

Sending tilde (~) using COZBATCH

Post by the1nfamous » Wed May 21, 2014 4:33 am

I am using COZBATCH (COZ.V2R4M1) to send a file from a mainframe host to a unix host. The tilde (~) character gets changed during the sending process to a ¯ - example below:

Mainframe data:

F000027359 |F000027359~0015

becomes:

F000027359 |F000027359¯0015

JCL parms being used are:

coz_bin="/usr/local/coz/bin"
remoteuser="XXXXXXXX"
server="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
servercp="ISO8859-1"
export PASSWD_DSN="XXXXXXXXXXXXXXXXXXXXX"
export SSH_ASKPASS=£coz_bin/read_std_passwd_dsn.sh
export DISPLAY=none
ssh_opts="-obatchmode=no"
ssh_opts="£ssh_opts -oconnecttimeout=60"
ssh_opts="£ssh_opts -oserveraliveinterval=60"
ssh_opts="£ssh_opts -ostricthostkeychecking=no"
ssh_opts="£ssh_opts -oUserKnownHostsFile=/dev/null"
sendfile='//IMA11.JI.LR.BDK.JICL201J.NEWPARTY.F140521'
£coz_bin/cozsftp £ssh_opts -b- -vvv £remoteuser@£server <<EOB
lzopts mode=text,notrim servercp=£servercp
cd /Directory/Blah/Blah
PUT £sendfile NEW_PARTY_20140521.TXT
EOB


I am aware that the tilde (~) is a special character in unix that can denote directories - but surely within a file this is ok?

Anyone come across this before? Searched the forum but found nothing.... help appreciated, thanks!

the1nfamous
Posts: 9
Joined: Wed May 21, 2014 4:19 am

Re: Sending tilde (~) using COZBATCH

Post by the1nfamous » Thu May 22, 2014 3:24 am

UPDATE: Have tried using:

lzopts mode=text,notrim servercp=UTF-8 clientcp=IBM-1047

to no avail also.

also believe the TRTAB option is only available from v2.4.4...

Tried a Standard FTP and this changed the ~ to an upside down question mark...

dovetail
Site Admin
Posts: 1770
Joined: Thu Jul 29, 2004 12:12 pm

Re: Sending tilde (~) using COZBATCH

Post by dovetail » Fri May 23, 2014 1:31 pm

When faced with data translation problems, here is what we suggest:

1) It is necessary to pin point the underlying binary (hex) representation of the characters that are not being translated as expected. Otherwise, you will be displaying character glyphs that can be affected by the codepage used to display the data, which might be anything and confuse the issue.

So, examine the source file and the target file with a hex editor / display
Under z/OS ISPF: HEX (ON) in browse or edit
Under Linux / Unix: several options depending on your distro:
hexdump -C filename
xxd filename
od -Ax -tx1 filename
Under Windows:
nothing built-in that I know of, but there are hundreds of free programs available to view data in hex

2) once you have pinpointed the from->to hex value that is not correct, you can verify against the translate tables used by Co:Z.
The "showtrtab" command in Co:Z can be used from a z/OS unix shell to display the translate table that will be used.
Note: directory <coz_install>/bin must be in your PATH to find this command.

for example:

> showtrtab -s IBM-1047 -t ISO8859-1
00: 00 01 02 03 9C 09 86 7F 97 8D 8E 0B 0C 0D 0E 0F
10: 10 11 12 13 9D 0A 08 87 18 19 92 8F 1C 1D 1E 1F
20: 80 81 82 83 84 85 17 1B 88 89 8A 8B 8C 05 06 07
30: 90 91 16 93 94 95 96 04 98 99 9A 9B 14 15 9E 1A
40: 20 A0 E2 E4 E0 E1 E3 E5 E7 F1 A2 2E 3C 28 2B 7C
50: 26 E9 EA EB E8 ED EE EF EC DF 21 24 2A 29 3B 5E
60: 2D 2F C2 C4 C0 C1 C3 C5 C7 D1 A6 2C 25 5F 3E 3F
70: F8 C9 CA CB C8 CD CE CF CC 60 3A 23 40 27 3D 22
80: D8 61 62 63 64 65 66 67 68 69 AB BB F0 FD FE B1
90: B0 6A 6B 6C 6D 6E 6F 70 71 72 AA BA E6 B8 C6 A4
A0: B5 7E 73 74 75 76 77 78 79 7A A1 BF D0 5B DE AE
B0: AC A3 A5 B7 A9 A7 B6 BC BD BE DD A8 AF 5D B4 D7
C0: 7B 41 42 43 44 45 46 47 48 49 AD F4 F6 F2 F3 F5
D0: 7D 4A 4B 4C 4D 4E 4F 50 51 52 B9 FB FC F9 FA FF
E0: 5C F7 53 54 55 56 57 58 59 5A B2 D4 D6 D2 D3 D5
F0: 30 31 32 33 34 35 36 37 38 39 B3 DB DC D9 DA 9F

This above table (for single byte code pages) shows a 256-byte table. If the byte at position X is Y, then the source character X will be translated to Y.

3) The question that we can't really answer is "what codepages should I use?"
This really depends on the encoding of your data: what encoding is the source (EBCDIC) file? What encoding are you expecting on your target system?

- In IBM-1047 or IBM-037, 0xA1 is a tilde - http://en.wikipedia.org/wiki/EBCDIC_1047
- In ISO-8859-1 or UTF-8, 0x7E is a tilde - http://en.wikipedia.org/wiki/ISO/IEC_8859-1

So if your source (z/OS) tilde is 0xA1, then it should be translated to 0x7E using ISO8859-1 or UTF-8.

the1nfamous
Posts: 9
Joined: Wed May 21, 2014 4:19 am

Re: Sending tilde (~) using COZBATCH

Post by the1nfamous » Wed May 28, 2014 4:24 am

Have managed to get file over in correct format using ftp in dos (with a get) and command quote site sbdataconn=(ibm-285,utf-8) - and file views correctly in wordpad/notepad. What is the equivalent command in COZ ?

dovetail
Site Admin
Posts: 1770
Joined: Thu Jul 29, 2004 12:12 pm

Re: Sending tilde (~) using COZBATCH

Post by dovetail » Wed May 28, 2014 7:18 am

If I understand, you want to use a remote Windows sftp client (like PuTTY) to connect to Co:Z SFTP server on z/OS, correct?

From a remote client, you can use "ls /+" to send options to Co:Z SFTP server:

ls /+mode=text,s=ibm-285,c=utf-8
get //my.dataset local.file

See for more information: http://dovetail.com/docs/sftp/using.html

the1nfamous
Posts: 9
Joined: Wed May 21, 2014 4:19 am

Re: Sending tilde (~) using COZBATCH

Post by the1nfamous » Wed May 28, 2014 9:10 am

No, sorry, that was a test to see if I could get the file in the correct format (the only successful one of many!). The actual route is using COZSFTP from Zos to a Linux box - so I'm guessing it would be :

lzopts mode=text,s=ibm-285,c=utf-8 ?

dovetail
Site Admin
Posts: 1770
Joined: Thu Jul 29, 2004 12:12 pm

Re: Sending tilde (~) using COZBATCH

Post by dovetail » Wed May 28, 2014 11:21 am

Almost.... the same conversion, from the Co:Z SFTP client on z/OS would be:

lzopts mode=text,c=ibm-285,s=utf-8

c=clientcp (z/OS client)
s=servercp (Linux server)

Post Reply