B4700230 AND AS/400 IFS

ngreco

ngreco

Member
Hi guys need some help, I would like to use business function B4700230 to copy a flat file from one IFS folder to another, with new name, however for whatever reason I am unable to access object. I have opened up authorty to both folder and object, so security should not be a problem, I can execute simalar function on local client, and preform ok, however when running on server, cannot access IFS folder

I assume syntax for directory is /Work Files/Flatfile.txt

Any suggestions would be greatly appreciated
 
My AS400 knowledge is not good but as far as I know you cannot use that BSFN as it stands. The reason for this is that the default AS400 compiler flags do not set a flag SYSIFCOPT(*IFSIO). This flag is required to access the IFS using the buffered i/o functions (fopen() fread() etc as used by B4700230) but if you turn it on you can no longer access the regular AS400 libraries!

However the unbuffered i/o functions such as open(), read(), write() etc will work with the IFS. Therefore the solution is to write your own duplicate of the original BSFN, but use the unbuffered i/o functions. Someone at JDE has had the same problem as there is an include file <ifs_io.h> which gives you most of the #defines to write your code portably using the buffered i/o functions.

Hope that helps. I managed to get my code to read and write IFS text files this way.

JohnO
 
Hi Jolly

Can you please post your code because i am not very familiar on how to approach on your suggestion.

As it might help lot of people on the board

Thanks
OW 810 AS400 V5R3
 
Sure: There is a sample attached.

I chose to use the ifs_io.h file in order to try to make my code portable to non-AS400 systems. The result works on AS400 servers and Win32 clients. I'm pretty sure it won't work on non AS400 servers but don't actually care about them in this case.

This code is used to open up a given UBE's log file (these live on the IFS in th case of AS400's) in order to determine what time it started executing. The Job Master table annoyingly lacks this information.

Anyway, I still use the "f" calls but the ifs_io.h macros translate them to non "f" calls that work with the IFS. In other words, "fopen" gets translated to "open" by the c compiler. I had to provide my own macros to define the file handle type and return code for a bad file open.

Hope this helps.
JohnO
 

Attachments

  • 85529-b5898614.c.txt
    11.3 KB · Views: 334
Thank you for suggestions guys greatly appreciated, I agree that business function does not seem to work as is with IFS, to resolve problem, I ended up using B34A1030(Extecute External Program), which I used to call AS/400 CMD CPY(Copy Object) and was therfore able to preform same results, which was basically to copy file from IFS to another directory within IFS, with different name, which I constructed within UBE
 
Oh sure, you go on ahead and use a simple straight forward approach that works. Put contractors out of business people like you do! ;-)
 
Back
Top Bottom