FTP: convert dataset to UTF-8



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

FTP: convert dataset to UTF-8

Postby davidinmotion » Wed Jan 20, 2016 4:25 pm

I need to convert a Host dataset from EBCDIC to UTF-8, and transfer it to my PC.
is there any jcl, I can put into the FTP step to convert the dataset while transfering to the PC?

i work on IBM ZOS, Complete

Here is the JCL for my usual FTP Host to PC:

//FTP EXEC PGM=FTP,PARM='(EXIT'                   
//SYSTCPD  DD DSN=SYS1.TCPPARMS(TCPDATA),DISP=SHR   
//SYSFTPD  DD *                                     
TRAILINGBLANKS TRUE                                 
SBDATACONN TCPIP.STANDARD.GERSOND                   
//SYSPRINT DD SYSOUT=*                             
//OUTPUT   DD SYSOUT=*                             
//INPUT DD DSN=Library(Member with server login data),DISP=SHR       
//      DD *                                       
ascii                                               
CD ..                                               
CD /Directory/folder                                   
PUT 'Dataset01' Textfile01.TXT

I found something like:

quote site en=mbcs mb=(utf-8,utf-8)
quote site unicodefilesystembom=never


but dont know if this works for what I want to do, and dont know where to place these two statements.

can anyone help?

[coded for you]
davidinmotion
 
Posts: 3
Joined: Wed Jan 20, 2016 3:57 pm
Has thanked: 2 times
Been thanked: 0 time

Re: FTP: convert dataset to UTF-8

Postby prino » Wed Jan 20, 2016 6:10 pm

Given the right host and PC code pages, your FTP should do a one-to-one translation of EBCDIC to ASCII, and there are about a zillion tools to convert ASCII to UTF.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy

These users thanked the author prino for the post:
davidinmotion (Wed Jan 20, 2016 6:27 pm)
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: FTP: convert dataset to UTF-8

Postby davidinmotion » Wed Jan 20, 2016 6:24 pm

OK, the thing is, I need to convert the dataset within the JCL because this schould be part of an automatic host-batch-process. I have also an Natural program that does the conversion but I just wondered if I could do this without an extra step and the Natural program or other tool? Just if there is a JCL for the conversion, it would be great if you could post an example!
davidinmotion
 
Posts: 3
Joined: Wed Jan 20, 2016 3:57 pm
Has thanked: 2 times
Been thanked: 0 time

Re: FTP: convert dataset to UTF-8

Postby Robert Sample » Wed Jan 20, 2016 6:35 pm

You are asking at the wrong place. FTP in JCL is CLIENT FTP, so you need to find out if the server you are using supports EBCDIC to UTF-8 translation (and if so, how). Unless you are sending to another mainframe, z/OS will NOT be involved in the translation when it is done in the FTP.

You could transfer the data set to a Unix file and use iconv on the Unix file to convert from IBM-1047 to UTF-8, then FTP the converted Unix file directly from Unix to the server.

These users thanked the author Robert Sample for the post:
davidinmotion (Wed Jan 20, 2016 6:41 pm)
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: FTP: convert dataset to UTF-8

Postby davidinmotion » Fri Jan 22, 2016 6:14 pm

Thank you, I did it like you suggested above and now it works!

copy to unix file:

//COPY01  EXEC PGM=IEBGENER,REGION=1M         
//SYSPRINT DD SYSOUT=*                       
//SYSUT1 DD DSN=Dataset,DISP=SHR     
//SYSUT2    DD PATH='/srv/directory/file',           
//          PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
//          PATHMODE=(SIRWXU,SIRWXG,SIRWXO), 
//          FILEDATA=TEXT                     
//SYSIN    DD DUMMY   


conversion with iconv:

//CONV01   EXEC PGM=BPXBATCH,                                     
// PARM='SH iconv -f IBM-1047 -t UTF8 /srv/directory/file > /srv/directory/fileNew


//*******************************************************         
//* RUN BPXBATCH TO CKSUM PASSED FILE *                           
//*******************************************************         
//BPXBATCH EXEC PGM=BPXBATCH,                                     
// PARM='SH cksum /srv/directory/fileNew'                                   
//STDOUT DD PATH='/srv/directory/cksmout.fileNew',PATHOPTS=(OWRONLY,OCREAT),
// PATHDISP=(KEEP,DELETE),PATHMODE=(SIWUSR,SIXUSR,SIRUSR),       
// FILEDATA=TEXT,LRECL=27994,RECFM=VB,BLKSIZE=27998


copy converted unix file back to Host dataset:

//COPY02    EXEC PGM=COZBATCH
//SYSPRINT DD SYSOUT=*       
//STDIN    DD *             
cp -B  /srv/directory/fileNew Ö       
 "//'OutputDataset'"       
//SYSOUT   DD SYSOUT=*


And then just the usual FTP to PC '

{coded for you - please do your own next time}
davidinmotion
 
Posts: 3
Joined: Wed Jan 20, 2016 3:57 pm
Has thanked: 2 times
Been thanked: 0 time

Re: FTP: convert dataset to UTF-8

Postby Robert Sample » Fri Jan 22, 2016 6:30 pm

Glad to hear you got it working.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post