Now, before you get all bent out of shape and point your grubby little index finger at me cackling “you called it an AS400 na-na-nu-na-naaah“, I do have a legitimate reason. It’s a shallow SEO based one (the grey haired brigade keep searching for “zip AS400 library”) but it’s legitimate.
I only used the wrong machine name in this blog title because I noticed that variations on “email AS400 library” and “ZIP AS400 library” keep appearing my website search logs. So, if people are searching for it, I can write an easy tip on how to do it. Obviously, since it’s not the 1990’s anymore, we will be using the IBM i Power System. The grandson of the AS400. Hopefully, one day, you lot will stop calling the IBM i System an AS400 – you filthy animals!
(anyone thats read my blogs knows I tend to rant about this, but today is a beautiful sunny warm summer morning, my iced coconut milk coffee is calming, my desert view is peaceful so please accept my apologies and lets get on with things)
We have a library on our AS400 IBM i System and we want to send it to another IBM i system using email. So, what is the best way to transfer SAVE FILES from IBM i Server to Another over the network?
Assuming you are an IBM I Fresher, or just not experienced with saving objects and restoring them on other machines, the concept behind it all is very simple.
Lets do a simple example of just saving a library to a *SAVF:
CRTSAVF MYLIB/MYSAVF SAVLIB LIB('Library-to-be-saved') DEV(*SAVF) SAVF(MYLIB/MYSAVF) DTACPR(*YES)
This uses IBM i’s built-in compression and will make any save file a few percent smaller than standard.
Now we have the *SAVF in the smallest standard IBM i save file size… let’s squish it up even smaller.
We are going to use JAVA to squish that *SAVF into a *ZIP file. Of course this assumes Java installed on your IBM i Server as a licensed program.
Remember we can access that *SAVF using the IFS naming formats. ie: LIB(MYLIB/MYSAVF) can also be referenced as /QSYS.LIB/MYLIB.LIB/MYSAVF.FILE/MYSAVF.SAVF
The ZIP file will be an IFS object that lives in a directory and can be shared with your network or easily copy/pasted onto your PC
Lets assume we are creating the zip file in an IFS directory called MyIFSgubbbins
Of course you could use an existing directory (aka folder) if you wish. Now, from the 5250 Terminal Emulator you can simply ask Java to ZIP that *SAVF up for you.
The command is easy we say “use QSHELL” to run the “JAR” (Java compress — think “winzip”) and create a new zip file “/myIfsGubbins/myZippedStuff.zip” from the existing *SAVF at “/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE”
STRQSH CMD('JAR -cf /myIfsGubbins/myZippedStuff.zip /QSYS.LIB/MYLIB.LIB/MYSAVF.FILE')
The Java “Jar” command basically creates a Java Jar file which is nothing more than a zip file. It’s transparent and real time compression is quick.
So, now you have a smaller ZIP file called myZippedStuff.zip that you can FTP, email, copy/paste or send by snail mail.
You can access this ZIP file using its IFS address of /myIfsGubbins/myZippedStuff.zip
You can email it from the command line or download it and have your wicked way with it:
SNDSMTPEMM RCP((email@example.com)) SUBJECT('This is a test email from IBM i V7R1') NOTE('<H1>This is the body of the email</H1> <p>I can enter things using HTML and format things in a most pretty way</p> <p><i>cool</i>') ATTACH(('/myIfsGubbins/myZippedStuff.zip' *OCTET *BIN)) CONTENT(*HTML)
If you are signed on using the wonderful IBM ACS then simply click the Integrated IFS Button and download the ZIP file to your PC:
Hope this is useful 🙂
Ps: stopping searching for “ZIP AS400 library” and search for “Zip IBM i Library” instead you numpty
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
How to rename Fresche (BCD) Presto Library – XL_PRESTO
Cleaning messy IBM i Integrated File System (IFS) file names
IBM i ACS 5250 EMULATOR FONT – and other ridiculous mumbo jumbo
The State of AS400 iSeries Application Modernization
Email every spool file in an output queue – EMLOUTQ for IBM i
Send IBM i Email including SQL Table Data automatically
I remember the IBM AS400
Interview Question and Answer – AS400 iSeries
An old AS400 Quiz willed with technical questions and plain old fashioned AS/400 brainteasers