Hi Gary,
i can write to streamfile then save the streamfile to tape, but it will occupy large temporary space as the file(s) being processed are big (tens of gigs).
Main Topics
Browse All TopicsHi all,
Anybody can help me, please. I need to read file in Java with IFSFileInputStream, then write to tape. I figured that IFSFileOutputStream can't write to tape, no?
If you have a solution, small sample will be great.
Thanks a lot.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Do you need to write to tape in standard labeled format, or can you write in IBM's Save/Restore format? If Save/Restore format is OK, then you can just use the CL command SAV (http://publib.boulder.ibm
Using Save/restore format, you'll only be able to restore it on another AS/400, and version restrictions may apply between the two machines.
If the SAV command isn't an option, and the temp space is going to be a problem, then I suppose you could write an RPG (or other native HLL) program that received passed block-sized chunks of data from your Java program and wrote them out to tape a block at a time.
Of course, if you are going to go to that much trouble, you might as well just write a HLL program to do the whole job: open the stream file, read a block, write to tape file, repeat until done, close tape file, and not fool with the Java-to-Native application-to-application
This really is one of those tasks that probably lends itself to a native HLL rather than Java.
- Gary Patterson
Tom,
So are you suggesting that the Java program issue the OVRTAPF command, and then write to an overridden database file?
If so, I don't think SQL will let you override to a non-database file (confirmed - just tried using OVRPRTF and a STRSQL INSERT - SQL7011 - FILE01 in *LIBL not table, view, or physical file.)
That failing, I considered AS400 Toolbox for Java Record Level Access.
Problem I see here here is that the Java Toolbox RLA classes hand off work like this to a DDM server job. If the IO is performed out-of-process, the override will not be in effect, so I think that may be a deal-killer.
I think this is a job most easily accomplished with C, C++, RPG, or COBOL.
- Gary Patterson
Gary:
Not exactly OVRTAPF... My (very) foggy memory is more like a way to redirect output to /qsys.lib/somelib.lib/some
Device files are IFS objects after all, and the system knows what methods work with them.
If I can track down explicit references, maybe I'll have more available. I was mostly hoping that you'd seen something similar and I could spark an idea from you. If nothing comes out of it, nothing's lost. But maybe...?
Tom
Tom,
Now that you've mentioned it, it sounds familiar to me because you can write a binary stream to a tape file in AS400 C/C++. Never tried it in Java. Once you mentioned it, though, I was a bit surprised when it didn't work.
I did a bit of reading, and it looks like tape support is notoriously lacking in Java, and not just on AS400.
- Gary Patterson
Do you have the AS400 C/C++ compiler? Most shops don't. It isn't bundled with the OS, and it isn't free.
By FAR the most common compiler is RPG, and you can call ILE RPG programs from Java just like you can C/CPP programs.
I probably have an RPG example laying around, but I know I don't have any tape IO in C - might be able to find it on the internet, but like I said, C is not a popular compiler on AS400.
- Gary Patterson
Note that all IBM compilers in version 5 of OS/400 are available if any one is licensed, i.e., WDS is licensed. So, if RPG is there, any of the others can be installed (if not already) at no added cost. But it's probably easier in RPG or COBOL than C anyway. It's been maybe 15 years since I did any programmed tape I/O. I'm pretty sure I have no examples.
Regardless, maybe it's time to step back and find out what the actual business requirement is here.
Tom
Here's a simple little ILE C Program to write to a tape file right out of the IBM ILE C Programmer's guide:
http://publib.boulde
To
- Gary Patterson
Business Accounts
Answer for Membership
by: Gary_The_IT_ProPosted on 2009-03-25 at 20:05:09ID: 23986987
Tape device handling is very OS-specific, and as far as I know there is no native java way to do it. I've never needed to access a tape drive from Java, but if I did, I would probably write the data out to a DB2/400 database file and call the CL Command CPYTOTAP via the AS/400 Toolbox for Java commandCall class.
com/iserie s/v5r2/ic2 928/index. htm? info/c l/cpytotap .htm
CPYTOTAP Command Description:
http://publib.boulder.ibm.
I've provided a little clip of code, but you will probably need to tune the CPYTOTAP command to suit your equipment and purposes.
- Gary Patterson
Select allOpen in new window