Easycom For PHP - By AURA Equipements

API Functions.

Easycom For PHP is a regular PHP extension, available on Linux, Windows and IBM i platforms.
It provides access to IBM i (AS/400) resources, from PHP applications: Databases, Programs, Procedures, System Commands, APIs, Spool files, Data Areas, Data Queues, ...

On IBM platform, Easycom for PHP is also known as the "PHP ToolKit". It is part of PHP for IBM i, pre-installed with IBM operating system V6R1 and V5R4.
On LAMP (Linux) and WAMP (Windows) servers, Easycom For PHP is a loadable module, referred in the"PHP.INI" configuration file.

When Easycom For PHP is installed on a PHP server, a set of functions become available for the web application.
All Easycom For PHP API function names have the prefix i5_.

Connection
i5_connect ()
i5_pconnect ()
i5_private_connect ()
i5_set_property ()
i5_get_property ()
i5_close ()
i5_pclose ()
i5_adopt_authority ()
i5_transaction ()
i5_commit ()
i5_rollback ()

PHP Script can connect to multiple AS/400 systems, or multiple jobs on AS/400.

A Web session can get a private persistent connection. All the scripts across the web session will connect to the same job on OS/400.

  • Environment is maintained.
  • QTEMP library is maintained
  • Active programs keep their local data and open files.

Program and Procedure calls
i5_program_prepare ()
i5_program_prepare_pcml ()
i5_program_call ()
i5_program_close ()

i5_XmlCallProgram ()
i5_XmlLoadDefinition ()
i5_XmlDefine ()
i5_XmlBindSrvPgm ()
i5_XmlCrtPgmRequest ()
i5_XmlSetInputValue ()
i5_XmlExecRequest ()
i5_XmlGetOutputValue ()
i5_XmlGetReturnValue ()

Easycom can call any RPG, CL, C or COBOL Program or ILE Procedure, from a PHP script, from any platform (Linux, Windows, IBM i).

  • Parameters are passed to the called program or procedure.
  • Caller retrieves parameter values on return.
  • Program interface is locally described by the script, or externally described in a PCML file.
  • PHP application also call System APIs.

Commands and System values
i5_command ()
i5_cmd ()
i5_cmdget ()
i5_remotecmd ()
i5_get_system_value ()

Call CL commands (*CMD Objects), passing parameters, and retrieving potential result variables.

SQL Queries and Procedures
i5_query ()
i5_prepare ()
i5_setparam ()
i5_execute ()
i5_next_result ()
i5_affected_rows ()
i5_free_query ()

Queries and stored procedures are executed in the AS/400 job associated to the connection.

When the connection is Persistent and Private for the PHP session, Queries can access overridden files, and QTEMP library.

Native Database Access
i5_open ()
i5_seek ()
i5_match ()
i5_range_from ()
i5_range_to ()
i5_range_clear ()
i5_edit ()
i5_addnew ()
i5_update ()
i5_delete ()
i5_setvalue ()
i5_cancel_edit ()
i5_new_record ()
i5_update_record ()
i5_delete_record ()
i5_free_file ()

Easycom provides a native record level access to DB2 physical and logical files.

PHP applications act on DB2 tables exactly like a native program compiled on AS/400, not using SQL features.
PHP developers fetch data from native open files, in the same way they fetch from SQL queries, using i5_fetch_xxx() function calls.

Files are open in the job associated to the connection.
When the connection is persistent and private, files can be overridden, or created in QTEMP.
Properties and overrides are maintained across the PHP script execution.

Fetching and setting data
i5_fetch_row ()
i5_fetch_array ()
i5_fetch_assoc ()
i5_fetch_object ()
i5_result ()
i5_getblob ()
i5_setblob ()
i5_setparam ()
i5_getparam ()
i5_bookmark ()
i5_bind_param ()
i5_bind_result ()
i5_num_rows ()
i5_seek ()
i5_data_seek ()
i5_match ()

Like any other database PHP extension, Easycom for PHP provides a set of functions to retrieve database record values, and move it to PHP variables and arrays.
All AS/400 – IBM i data types are supported.

PHP developers don't have to care about data conversion, and special OS/400 decimal formats.

Columns & parameters information
i5_num_fields ()
i5_get_keys ()
i5_list_fields ()
i5_field_len ()
i5_field_name ()
i5_field_type ()
i5_field_scale ()
i5_info ()
Easycom gives all the information and properties about database fields, data types, size, …
Data Queues
i5_dtaq_prepare ()
i5_dtaq_send ()
i5_dtaq_receive ()
i5_dtaq_close ()
With Easycom, a data queue has a record format.
Data is converted according to the description.
All the data queues are accessed, keyed or not keyed.
Data Areas
i5_data_area_create ()
i5_data_area_read ()
i5_data_area_write ()
i5_data_area_delete ()

All data areas can be read and write from a PHP application.

With a private connection, the local data area (LDA) can be maintained along the PHP session.

User Spaces
i5_userspace_create ()
i5_userspace_prepare ()
i5_userspace_get ()
i5_userspace_put ()
Read data from User spaces, and Write data.
Data is converted according to the given description.
Spool Files
i5_spool_list ()
i5_spool_list_read ()
i5_spool_list_close ()
i5_spool_get_data ()
Spool file data is retrieved, and returned to PHP script as character strings.
Jobs

i5_job_list ()
i5_job_list_read ()
i5_job_list_close ()

List active jobs, and retrieve job properties.
Objects

i5_objects_list ()
i5_objects_list_read ()
i5_objects_list_close ()

List objects from libraries, and get the properties.
Job Logs
i5_jobLog_list ()
i5_jobLog_list_read ()
i5_jobLog_list_close ()
Retrieve the job log
Error Handling
i5_errno ()
i5_error ()
i5_errormsg ()
The PHP program can receive the original native error message (CPFxxxx) sent by the AS/40à connection job.