i5/OS Programmer's Toolkit: as-400
0.2.16
Go back to
main page of i5/OS Programmer's Toolkit.
The name of the subproject is an acronym for "ActionScript and AS/400". This subproject provides supports for ActionScript 3.0 (the core programming language of Adobe Flash) to access an IBM i server via the
IBM i host servers . With the supports of the ActionScript (AS3) programming language and the Flex Framework, Flash have became an applicable choice for building Web-based, client/server model, or distributed applications that need extremely beautiful and highly interoperable UI. But there is still a lack of means by which an AS3 program (aka. a .swf file) can access resources of an IBM i server directly via IBM i host servers, such as the database server, the remote command server, the file server, etc. The ability to access these IBM i host servers can bring the following benefits to a programming language:
- Efficiency in communication. Communicating with IBM i via the host servers is the most efficient way to communicate with an IBM i server.
- Tremendous accessibility to resources on an IBM i server that exposed by the host servers. You can call programs or procedures in a service program; you can access the RDBMS; you can access IFS directories and files; you can access system objects in the library file system; and so on.
- Communicating with IBM i via the host servers is a pure client/server model and hence does NOT need to deploy any server side components.
At the other hand, the benefits for IBM i to allow ActionScript to connect to it are the following:
- Flash can bring extra UI support for applications backed by IBM i servers.
- More AS3/Flex developers can be attracted to the IBM i platform.
This subproject has just been launched at June 1, 2011 with a single demo Flash file that calls an IBM i program via the Remote command and distributed program call server (See Demenstrations). We're eager to hear your feedbacks and opinions of this subproject. Here're what we want to know from you:
- Which function among all that are exposed by the IBM i host servers do you want to be implemented first? For example, calling IBM i programs, accessing IFS files and directories, operating system objects (such as data queue or user queue objects).
Any advice or opinion from you is welcome. You can post your comments in our open discussion forum .
Contents
You can get the source of the subproject like the following:
Here's an example. Say you want to call a program called SOMEPGM that resides in library SOMELIB on your IBM i server from a Flash program, Hello.as, and SOMEPGM takes a single CHAR(8) output parameter. You can:
- Get the source files of as-400 as what's described in How to get as-400?
- Create a symbolic link to the top-level directory, as400, of the downloaded source in your working directory
ln -s /some-dir/as400 as400
- Edit your source AS program in your working directory
private function pgmcall_callback(rc:int,
argl:Vector.<ProgramArgument>,
msg:String = null) : void {
trace("The only output parameter of SOMELIB/SOMEPGM:", argl[0].value_);
}
private function test_call() : void {
var pgm_call:RemoteCommand
= new RemoteCommand("www.your-ibm-i-server.com",
"****",
"****",
"SOMELIB",
"SOMEPGM"
);
var argl:Vector.<ProgramArgument>
= new <ProgramArgument>[new ProgramArgument(new EBCDIC(8),
ProgramArgument.OUTPUT)];
pgm_call.callx(this, pgmcall_callback, argl);
}
- Compile Hello.as into a .swf file (optionally with debug option -compiler.debug)
mxmlc -compiler.debug Hello.as
- Enjoy what you've just produced by open Hello.swf with either a web-browser or flashplayer that is provided by the Flex SDK
firefox Hello.swf
# or
flashplayer Hello.swf
view all
Here're a list of techniqual tips on using AS3 classes provided by as-400.