× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am trying to write to the IFS.  Here is the situation...  I create a new
IFS file, close it, then reopen it (to resolve codepage issues).  I then
open a different IFS file and save the contents to a variable.  I manipulate
the contents and write the variable to the open IFS file.  I then read a
different IFS file and save it to a variable.  I manipulate it and write to
the original IFS file.  I am trying to merge several IFS files into one
large IFS file.

I open the files with no problems.  When I try to write to the file, I
constantly get error 3450 (Descriptor Not Valid).  The file was opened with
no problems, but I can not write to it.  The documentation at IBM's site is
not very good for this error.

Any Ideas?

Below is the code:

 *
 * open the file (the original open)
 *
C                   Eval      FileNameNull = %Trim(P$Attachment) + Null
 *
C                   Eval      FileDesc = open(%ADDR(FileNameNull)
C                               : O_CREAT + O_RDWR + O_TRUNC +
C                                 O_CODEPAGE
C                               : S_IRWXU + S_IRWXO
C                               : AsciiCodePage)
C                   If        FileDesc < 0
C                   Eval      errorcode = IFSError
C                   EndIf
C                   Eval      ReturnInt = close(FileDesc)
C                   If        ReturnInt < 0
C                   Eval      errorcode = IFSError
C                   EndIf
 *
 *  Open the file to write to it
 *
C                   Eval      FileDesc = open(%ADDR(FileNameNull)
C***                            : O_RDWR)
C                               : O_RDWR + O_CODEPAGE
C                               : S_IRWXU + S_IRWXO
C                               : AsciiCodePage)
C                   If        FileDesc < 0
C                   Eval      errorcode = IFSError
C                   EndIf
 *
 * set the number of attachments to 0 so the data structure is not used
 *
C                   Eval      P$NumberAttach = 0
 *
 * get the number of attachments for this email
 *
C                   Eval      counter = 0
C     EMI003List1   Chain     Emi003P
C                   DoW       %Found(Emi003P)
C                   Eval      counter = counter + 1
C                   Read      Emi003P
C                   If        (%Trim(SalesRepNumber) <>
C                               %Trim(E3SLSREP))  OR
C                             (NextNumber <> E3NXTNBR)
C                   Leave
C                   EndIf
C                   EndDo
 *
 * loop through the records and save the information
 *
C                   Eval      recordnumber = 0
C     EMI003List1   Chain     EMI003P
C                   Eval      recordnumber = recordnumber + 1
 *
 * read & process the records
 *
C                   Do        counter
C                   Select
 * first record
C                   When      recordnumber = 1
C                   Eval      holdfile = %Trim(holdfile) +
C                                %Trim(stripHtmlHeader(%Trim(E3PATH):'B'))
 * last record
C                   When      recordnumber = counter
C                   Eval      holdfile = %Trim(holdfile) +
C                                %Trim(stripHtmlHeader(%Trim(E3PATH):'E'))
 * all other records
C                   Other
C                   Eval      holdfile = %Trim(holdfile) +
C                                %Trim(stripHtmlHeader(%Trim(E3PATH)))
C                   EndSL
 *
 * write the IFS info
 *
C                   Eval      BytesWrt = write(FileDesc
C                               : %ADDR(HoldFile)
C                               : %LEN(%TRIMR(HoldFile)))
C                   If        BytesWrt < 1
C                   Eval      errorcode = IFSError
C                   EndIf
 *
C                   Read      Emi003P
C                   EndDo
 *
 * close the file
 *
C                   Eval      ReturnInt = close(FileDesc)
 *
C                   EndSr



================================
Mike Silvers
AS/400 Senior Programmer/Analyst
AS/400 IBM Certified RPG IV Developer
AS/400 IBM Certified Solutions Expert
Hainey Business Systems
8 E. Canal St
Dover, PA 17315
Branch Office:  (410) 397-8739
Phone:  (800) 932-3380 ext. 237
Fax:  (717) 292-9474
Web: http://www.hbs-inc.com
________________________________
Providing E-Commerce, EDI, AS/400
Development, Java Development,
and related services nationwide.
================================




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.