|
Emmanuel, Where are you storing the FileDescI value that you're sing on the read() function? I don't see you ever opening the file and saving the handle to that file in FileDescI. That is probably your problem. -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Emmanuel Zannis Sent: Thursday, November 10, 2005 7:03 AM To: rpg400-l@xxxxxxxxxxxx Subject: 3440:Operation not supported when trying to read an IFS file. List Hi, I still I can read my IFS file. I get the error 3440 (ENOTSUP 3440 Operation is not supported. EOPNOTSUPP 3440 Operation is not supported.). I am attaching a list of the program. I run the program in debug where I spotted the error. The path is passed as parameter: (/DIR/SUBDIR/FILE). The error occurs in line 123 attempting to read the file, nbytesread has a value of -1. DspError shows the error. Any help is welcomed. 0001.00 H BNDDIR('QC2LE') 0002.00 H DecEdit('0,') Debug DatFmt(*EUR) DatEdit(*YMD) TimFmt(*HMS) 0003.00 H ALWNULL(*USRCTL) Option(*SRCSTMT:*NODEBUGIO) 0004.00 0005.00 * Open - Open an IFS file 0006.00 D open PR 10I 0 ExtProc('open') 0007.00 D filename * Value 0008.00 D openflags 10I 0 Value 0009.00 D mode 10U 0 Value options(*nopass) 0010.00 D codepage 10U 0 Value options(*nopass) 0011.00 0012.00 0013.00 * Access - Check for existence of an IFS file 0014.00 D access PR 10I 0 ExtProc('access') 0015.00 D filename * Value 0016.00 D modeI 10U 0 Value 0017.00 0018.00 * Read - Read an IFS file 0019.00 D read PR 10I 0 extproc('read') 0020.00 D FileDescI 10I 0 value 0021.00 D bufI * Value 0022.00 D nbyte 10U 0 value 0023.00 0024.00 D write PR 10I 0 extproc('write') 0025.00 D fd 10I 0 value 0026.00 D buf * value 0027.00 D size 10I 0 value 0028.00 0029.00 * Close - Close Ifs file 0030.00 D close PR 10I 0 ExtProc('close') 0031.00 D filehandle 10I 0 Value 0032.00 0033.00 * Unlink - Delete IFS file 0034.00 D unlink PR 10I 0 ExtProc('unlink') 0035.00 D filename * Value 0036.00 0037.00 * Set file Details 0038.00 D Pr_SetFile PR 1 0 0039.00 0040.00 * Open PC File in IFS directory 0041.00 D Pr_OpnFile PR 1 0 0042.00 0043.00 * Open PC File in IFS directory 0044.00 D DspError PR 0045.00 0046.00 * Get Error number 0047.00 D GetErrNo PR * Extproc('__errno') 0048.00 0049.00 D StrError PR * Extproc('strerror') 0050.00 D errorNo 10I 0 Value 0051.00 0052.00 D FileDescI S 10I 0 Inz(0) 0053.00 D buf S 512A Inz(*Blank) 0054.00 D bufI S * Inz(%Addr(BufI)) 0055.00 D nbyteset S 10U 0 Inz(512) 0056.00 D nbytesread S 10I 0 0057.00 D Err_Flag S 10I 0 0058.00 D Oflag S 10I 0 0059.00 D rc S 10I 0 0060.00 D Filename S 80A Inz 0061.00 D L S 5P 0 Inz 0062.00 0063.00 D CodePage S 10U 0 Inz(437) 0064.00 D Omode S 10U 0 0065.00 D BufLen S 10U 0 0066.00 0067.00 * Values for oflag parameter, used by open() 0068.00 D O_APPEND S 10I 0 Inz(256) 0069.00 D O_CODEPAGE S 10I 0 Inz(8388608) 0070.00 D O_CREAT S 10I 0 Inz(8) 0071.00 D O_EXCL S 10I 0 Inz(16) 0072.00 D O_RDONLY S 10I 0 Inz(1) 0073.00 D O_RDWR S 10I 0 Inz(4) 0074.00 D O_TEXTDATA S 10I 0 Inz(16777216) 0075.00 D O_TRUNC S 10I 0 Inz(64) 0076.00 D O_WRONLY S 10I 0 Inz(2) 0077.00 0078.00 * User authorities for omode paramter, used by open() 0079.00 * from QSYSINC/SYS, member STAT 0080.00 D S_IRUSR S 10I 0 Inz(256) 0081.00 D S_IWUSR S 10I 0 Inz(128) 0082.00 D S_IXUSR S 10I 0 Inz(64) 0083.00 D S_IRWXU S 10I 0 Inz(448) 0084.00 0085.00 * Group authorities 0086.00 D S_IRGRP S 10I 0 Inz(32) 0087.00 D S_IWGRP S 10I 0 Inz(16) 0088.00 D S_IXGRP S 10I 0 Inz(8) 0089.00 D S_IRWXG S 10I 0 Inz(56) 0090.00 0091.00 * Other authorities 0092.00 D S_IROTH S 10I 0 Inz(4) 0093.00 D S_IWOTH S 10I 0 Inz(2) 0094.00 D S_IXOTH S 10I 0 Inz(1) 0095.00 D S_IRWXO S 10I 0 Inz(7) 0096.00 0097.00 D PrmPssrErr S 1A 0098.00 D PrmFileName S 80A 0099.00 D Wrk_1stErr S Like(*In01) 0100.00 D Wrk_FrstTime S 1A Inz('Y') 0101.00 D Null C Const(x'00') 0102.00 0103.00 /free 0104.00 0105.00 // Set Pc file details 0106.00 L = Pr_SetFile (); 0107.00 If L = -1; 0108.00 0109.00 ExSr *PSSR; 0110.00 0111.00 EndIf; 0112.00 0113.00 // Open PC file in IFS directory 0114.00 L = Pr_OpnFile (); 0115.00 If L = -1; 0116.00 0117.00 ExSr *PSSR; 0118.00 0119.00 EndIf; 0120.00 0121.00 /end-free 0122.00 0123.00 C eval nbytesread = read(FileDescI:%addr(bufI): 0124.00 C nbyteset) 0125.00 0126.00 C If nbytesread > 0 0127.00 C Eval *InLr = *On 0128.00 C Else 0129.00 C Callp DspError 0130.00 C EndIf 0131.00 /Eject 0132.00 ********************************************************************** 0133.00 * *Inzsr - Program level initialisation 0134.00 ********************************************************************** 0135.00 C *Inzsr BegSr 0136.00 0137.00 * Received Parameters 0138.00 C *Entry Plist 0139.00 C Parm PrmFileName 0140.00 C Parm PrmPssrErr 0141.00 0142.00 /free 0143.00 0144.00 // Default path name 0145.00 Filename = %Trim(PrmFileName); 0146.00 0147.00 /end-free 0148.00 0149.00 C EndSr 0150.00 0151.00 /Eject 0152.00 ********************************************************************** 0153.00 * *Pssr - Error Routine 0154.00 ********************************************************************** 0155.00 C *Pssr BegSr 0156.00 0157.00 * Dump program and terminate process 0158.00 /free 0159.00 If Wrk_1stErr <> *On; 0160.00 Wrk_1stErr = *On; 0161.00 Dump; 0162.00 PrmPssrErr = 'Y'; // Force Exit now 0163.00 *InLr = *On; 0164.00 EndIf; 0165.00 0166.00 /end-free 0167.00 0168.00 C EndSr '*CANCL' 0169.00 ********************************************************************** 0170.00 /Eject 0171.00 ********************************************************************** 0172.00 * Pr_SetFile - Set PC file details 0173.00 ********************************************************************** 0174.00 P Pr_SetFile B 0175.00 0176.00 D Pr_SetFile PI 1 0 0177.00 0178.00 /free 0179.00 0180.00 Oflag = O_CREAT + O_CODEPAGE + O_RDWR + O_TRUNC; 0181.00 0182.00 Omode = S_IRWXU + S_IRWXG + S_IROTH + S_IXOTH; 0183.00 0184.00 Filename = %Trim(FileName) + Null; 0185.00 0186.00 /end-free 0187.00 0188.00 C Eval Err_Flag = Open(%Addr(Filename) : OFLAG : 0189.00 C Omode: CodePage) 0190.00 0191.00 /free 0192.00 0193.00 If Err_Flag < 0; 0194.00 Return -1; 0195.00 Else; 0196.00 Return 0; 0197.00 EndIf; 0198.00 0199.00 /end-free 0200.00 0201.00 P Pr_SetFile E 0202.00 ********************************************************************** 0203.00 0204.00 0205.00 ********************************************************************** 0206.00 * Pr_OpnFile - Open PC File in IFS directory 0207.00 ********************************************************************** 0208.00 P Pr_OpnFile B 0209.00 0210.00 D Pr_OpnFile PI 1 0 0211.00 0212.00 /free 0213.00 0214.00 Oflag = O_WRONLY + O_TEXTDATA; 0215.00 0216.00 /end-free 0217.00 0218.00 C Eval Err_Flag = Open(%Addr(Filename) : Oflag) 0219.00 0220.00 /free 0221.00 0222.00 If Err_Flag < 0; 0223.00 Return -1; 0224.00 Else; 0225.00 Return 0; 0226.00 EndIf; 0227.00 0228.00 /end-free 0229.00 0230.00 P Pr_OpnFile E 0231.00 ********************************************************************** 0232.00 0233.00 ********************************************************************** 0234.00 * DspError - Display c function error 0235.00 ********************************************************************** 0236.00 P DspError B 0237.00 0238.00 D DspError PI 0239.00 0240.00 D text S 10A 0241.00 0242.00 D errorNo@ S * Inz 0243.00 D errorNo S 10I 0 Based(Errorno@) 0244.00 D errorMsg@ S * Inz 0245.00 D errorMsg S 100A Based(errorMsg@) 0246.00 D errortxt S 52A Inz(*Blanks) 0247.00 0248.00 0249.00 /free 0250.00 0251.00 errorNo@ = GetErrNo; 0252.00 0253.00 errormsg@ = StrError(errorNo); 0254.00 0255.00 errortxt = %trim(text) + '->' + 0256.00 %char(errorNo) + 0257.00 ':' + %subSt(errormsg:1:37); 0258.00 /end-free 0259.00 0260.00 0261.00 0262.00 P DspError E 0263.00 ********************************************************************** Regards, Emmanuel Zannis (Tel: 01252 372000 x3262 Fax: 01252 542261 e-mail:emmanuel.zannis@xxxxxxxxxxx The above information is confidential to the addressee and may be privileged. Unauthorised access and use is prohibited. If you received this message in error please tell us by reply (or telephone the sender) and delete all copies from your system. Internet communications are not secure and therefore this Company does not accept legal responsibility for the contents of this message. This e-mail message has been swept by Integralis e:)scan for the presence of detectable computer viruses, but we cannot guarantee that it is virus-free and you should scan this email for viruses prior to opening or saving any attachments. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Please note that communications sent by or to any person through our computer systems may be viewed by other members of the Hogg Robinson group. Hogg Robinson plc Registered Office: Global House, Victoria Street, Basingstoke, Hampshire RG21 3BT Registered in England and Wales No 2107443
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.