Page 2 of 2

Re: Adding char last in VB file

PostPosted: Wed Dec 14, 2011 11:14 pm
by harisukumaran
I have a variable length file that I need to send to a unix box. File is in UTF8 format and so I need to send it with translation to a unix box. I would like to append each record with x'0a before transferring the file

Re: Adding char last in VB file

PostPosted: Wed Dec 14, 2011 11:25 pm
by steve-myers
This is a new question; it should be opened in a new topic.

If the dataset is sent as a text file using FTP, FTP will automatically insert a new line character, which I presume is what X'0A' is, at the end of each logical record.

Re: Adding char last in VB file

PostPosted: Thu Dec 15, 2011 7:02 pm
by harisukumaran
I want to attach x'0a to the end of all records

Re: Adding char last in VB file

PostPosted: Thu Dec 15, 2011 7:17 pm
by BillyBoyo
Can you please describe your actual problem, not what you think is the solution.

If you put X'0A' at the end of each record and then ftp the data, how the last byte will arrive depends on the options you supply to the ftp program. X'0A' is Line Feed in ASCII.

I suspect that lots of files are transferred daily in similar scenarios to yours without having to "have a byte added" before being presented to ftp.

Re: Adding char last in VB file

PostPosted: Fri Dec 16, 2011 7:27 pm
by harisukumaran
I receive a multi code page ebcdic file from a remote system
The file a split based on code page
Each piece is converted to UTF8 using iconv
Pieces of the converted file are concatenated to whole
File needs to be transferred to downstream unix box via sftp
File would need to be transferred in binary as no translation should happen during transmission
Downstream system is expecting end of line marker at the end of each line

UTF8 converted file would be variable length. Iconv doesn't add end of line marker automatically neither is there any option to make it add the marker.

Does DFSORT have a way to add a character at the end of each variable length record? Or should I just do this using rexx ?

Re: Adding char last in VB file

PostPosted: Fri Dec 16, 2011 10:51 pm
by skolusu
harisukumaran wrote:Does DFSORT have a way to add a character at the end of each variable length record? Or should I just do this using rexx ?


Assuming that you don't have any embedded spaces and file lrecl=80 , you can use the following the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=Your input vb file,DISP=SHR       
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  INREC BUILD=(1,80,JFY=(SHIFT=LEFT,TRAIL=X'0A'))   
//*   


If you do have embedded spaces in between and you want to retain them you can code an E15 exit in cobol, assembler and plug it in to DFSORT.