|
I have the following code that is an attempt to read a physical file and
output the contents into a temporary PF. The temporary file doesn't
exist and when I try to open the second file (in hopes that it will
create the file) the return code is -1. Can a PF be created like this?
D OpenFlag S 10I 0
D OpenFlag2 S 10I 0
D FilNamPath S 200A VARYING
D FilNamPath2 S 200A VARYING
D TempStmfFile S 300A VARYING
D RC S 10I 0
D RC2 S 10I 0
D RC3 S 10I 0
D StringVal S 5000A
/Free
FilNamPath ='QSYS.LIB/'+ %Trim(inLibrary)+'.LIB/'+
%TRIM(inFile) +'.FILE/' +
%TRIM(inFile) +'.MBR' + x'00';
OpenFlag = O_RDONLY;
RC = Open(%Trim(FilNamPath):OpenFlag);
TempStmfFile = 'QSYS.LIB/GGPRD.LIB/TMPSTMF.FILE/TMPSTMF.MBR' + x'00';
OpenFlag2 = O_CREAT + O_RDWR + O_APPEND + O_TEXTDATA + O_CODEPAGE +
S_IWUSR+S_IRUSR+S_IRGRP+S_IROTH;
RC2=unlink(TempStmfFile);
RC2 = Open(%Trim(TempStmfFile):OpenFlag2);
RC3 = Read(RC:%Addr(StringVal):%Size(StringVal));
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.