× 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 have a service program which uses the unix API open() to create an IFS
file for writing data. I have several programs which utilize this service
program and they work correctly.

The problem that I am experiencing is with a new program which utilizes
the service program to create an IFS file prior to writing data. When
executing the Create_IFS_File procedure, I receive error code 3021
(EINVAL) "The value specified for the argument is not correct."

Most of the relevant code was copied from one of the other (working)
programs.

The ONLY change possible ( for the Create_IFS_File procedure) was to the
IFS file path name.
I did not change the directory name, ONLY the file name.
The file does not exist in the specified directory.

Has anyone experienced this problem before.

below is the relevant code.


Service Program:

P Create_IFS_File...
P B export

D Create_IFS_File...
D PI 10I 0
D p_File_Path 256 const

* Definitions for Procedure Defined Work Fields

D O_Flag S 10i 0
D O_Mode S 10u 0
D O_Code_Page S 10u 0
D w_FileHandle S 10i 0 inz
D w_ErrorDesc S 128a inz

* Prototypes

D Create_File PR 10i 0 extproc('open')
D p_File_Path * value options(*string)
D p_Open_Flags 10i 0 value
D p_Mode 10u 0 value options(*nopass)
D p_Code_Page 10u 0 value options(*nopass)

/free

O_Flag = O_RDWR
+ O_CREAT
+ O_EXCL
+ O_TEXTDATA
+ O_TEXT_CREAT
+ O_CCSID ;

O_Mode = S_IRWXG ;
O_Code_Page = 1252 ;

w_FileHandle = Create_File
( %trim(p_File_Path) :
O_Flag :
O_Mode :
O_Code_Page ) ;

If w_FileHandle < *ZERO ;
w_ErrorDesc = Get_Error_Description ;
endIf ;

return w_FileHandle ;

/end-free



Primary Program:

D c_File_Path C
'/Transfer_Files/MBFSUTA_01.csv'
D c_CR_LF C const(X'0D25')

* Prototypes

D Create_IFS_File...
D PR 10i 0
D p_File_Path 256 const

D Clear_IFS_File PR 10i 0
D p_File_Path 256 const

D Open_IFS_File_For_Write_Only...
D PR 10i 0
D p_File_Path 256 const

D Write_IFS_File PR 10i 0
D p_File_Handle 10i 0 const
D p_Data_Buffer * const
D p_Bytes_to_Write...
D 10u 0 const

D Close_IFS_File PR
D p_File_Handle 10i 0 const

/free

w_File_Handle = create_IFS_File
( c_File_Path ) ;

w_TodaysDate = %date() ;

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.