|
Need some help with IFS stream file.
Client requires a file to be sent to them with no trailing spaces and no CRLF or EOR.
I thought the best way to accomplish this was to write to a stream file on the IFS directly from RPGLE program and then FTP stream file to client from CL program.
The program does create the stream file. I can see it using WRKLNK and can display that there is data, however when trying to FTP the file, I get the error message:
“No such path or directory: /edi/out/myfolder/edi7850.txt. The directory or a component of the path name does not exist.”
Also receive CPFA0A9 Object not found when trying to use IFS command on file. Also receive error message when trying to use QShell to convert ccsid:
iconv: 001-0023 Error found opening file /edi/out/myfolder/edi7850.txt.
However, if manually using WRKLNK green screen, I use option 7- Rename, and rename the file I can then successfully work with the file and use the QShell command and FTP the file. So, there must be something I’m missing when creating the file to begin with. If anyone can lend some insight I would appreciate it.
RPG Code to write to IFS:
**********************************************************************
* Write the IFS Ascii file directly
**********************************************************************
/free
begsr writeIFS;
flags = O_WRONLY + O_CREAT + O_TRUNC;
mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IROTH + S_IWOTH;
filename = '/edi/out/myfolder/edi7850.txt';
fd = open(filename : flags : mode);
if fd < 0;
Msg = 'open() : failed for writing';
eval *Inlr = *on;
return;
endif;
// write the line of data to the IFS file
wrdata = %trim(edata);
callp write(fd: %addr(wrdata): %len(%trim(wrdata)));
//close the file
callp close(fd);
endsr;
Qshell Command used for conversion:
iconv -f 37 -t 819 /edi/out/myfolder/edi7850.txt > /edi/out/pleatco/edi7850c.txt &&setccsid 819 /edi/out/myfolder/edi7850c.txt
Thanks in advance for any help or insights.
MLR
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.