PreviousNext
Help > API Functions > Error management > i5_errno
i5_errno

 

Returns last error number.

 

int i5_errno ([resource connection] )

 

Parameters

 

 

connection

Result of i5_connect

 

 

Return

 

Returns last error number or FALSE if no error occurs.

 

 

 

Details

 

Use i5_errormsg function to get error message.

Use i5_error to get full error information's (number, category, message, and details).

 

 

Code

Description

I5_ERR_OK

0

No error.

I5_ERR_ERROR

1

Error occurred

I5_ERR_TOOMUCHOPENFILE

2

Too many open files

I5_ERR_MEMALLOC

3

Not enough memory

I5_ERR_INVALIDPTR

4

Invalid pointer (handle); specific message

I5_ERR_FILENOTFOUND

5

File not found

I5_ERR_FIELDNOTFOUND

6

Field not found

I5_ERR_INVALIDFIELDNBR

7

Field number invalid

I5_ERR_INVALIDKEYLEN

8

Wrong key length

I5_ERR_INVALIDKEYNBR

9

Wrong key field number

I5_ERR_NOTENABLETOUPDATE

10

File not allowed to be changed

I5_ERR_INVALIDOPENMODE

11

File open mode not valid for operation

I5_ERR_RECORDNOTFOUND

12

Record not found

I5_ERR_RECORDLOCKED

13

Record locked

I5_ERR_BEOF

14

End or begin of file reached

I5_ERR_FILELIMITS

15

Reads out of the file (before or after EOF)

I5_ERR_NOTCONNECTED

16

Not connected

I5_ERR_INVALIDSEQ

17

Operation sequence not valid

I5_ERR_NORANGESET

18

Range not defined

I5_ERR_NOLINKDEFINED

19

Link not defined

I5_ERR_NOCURRENTRECORD

20

No current record

I5_ERR_NULLNOTALLOWED

21

Null operation not applicable (field does not support nulls)

I5_ERR_BADSESSION

22

AS/400 session not valid

I5_ERR_WRONGLOGIN

23

Bad login user or password

I5_ERR_NOTENOUGHRIGHTS

24

User rights problem

I5_ERR_INVALIDTYPE

25

INVALID TYPE

I5_ERR_INVALIDINFO

26

Info variable height not enough

I5_ERR_NOTTYPEPROPERTY

27

Bad property ID

I5_ERR_RECORDCHANGED

28

The record has changed before update

I5_ERR_ALREADYINTRAN

29

Already in a transaction (nested transaction are not supported)

I5_ERR_NOTINTRAN

30

Not in a transaction

I5_ERR_INCORRECTVALUE

36

unable to set the value (out of range; ...)

I5_ERR_PARAMNOTFOUND

37

Requested parameter does not exist in the description.

I5_ERR_ENDOFOCC

38

Number of occurrences greater than the maximum set in the description.

I5_ERR_DESC_UNEXP

39

Unexpected error while processing description

I5_ERR_DQDESC_UNSUPP

40

Unsupported description for a data queue

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipements. error number 42

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_HDLCONN

257

This resource has no connection active.

I5_ERR_PHP_HDLBAD

258

Bad connection handle

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

I5_ERR_PHP_RESOURCE_BAD

261

No resource found.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

I5_ERR_PHP_NBPARAM_BAD

263

Wrong parameter count

I5_ERR_PHP_TYPEGET

264

The x function is unable to translate this type (-1).

I5_ERR_PHP_OPERATOR_BAD

265

Unknown operator (x)

I5_ERR_PHP_BAD_LEN_PROP

266

The length of the property x is too large; -2 instead of -3 max.

I5_ERR_PHP_LIST_PROP

267

This element 0¡ is not accepted.

I5_ERR_PHP_SPOOL_FILE_FOPEN

269

Internal Error on tempory file(x); code error: -1.

I5_ERR_PHP_API_LENGTH

270

The length of element -1 of parameter is too big (max: -2).

I5_ERR_PHP_BAD_TYPE_KEYNAME

271

The name property n°-1 must be a string.

I5_ERR_PHP_BOOKMARK

272

Bookmark value expected for this operator

I5_ERR_PHP_NOT_BOOKMARK

273

Bookmark value unexpected for this operator

I5_ERR_PHP_GETPARAM

275

specific message

I5_ERR_PHP_BINDPARAM

276

Internal error; please contact Aura Equipements. error number 276

I5_ERR_PHP_PARAM_DESC

277

specific message

I5_ERR_PHP_BLOBSIZE

278

the blob size received (-1) is different of the announced size(-2).

I5_ERR_PHP_SEEK_FIRSTLAST

279

Bookmark value expected for this operator

I5_ERR_PHP_PROPERTY_NUMBER

280

This (-1) property number is not valid.

I5_ERR_PHP_BAD_ADDNEW_CST

282

The only constant accpeted are I5_ADDNEW_NOCLEAR or I5_ADDNEW_CLEAR.

I5_ERR_PHP_NOT_RPIVATE_CONNECTION

283

The restore connection is not allowed.

I5_ERR_PHP_ALREADY_PGMNAME

284

You cannot call this function; because it was already called, or x was called.

I5_ERR_PHP_PRIVATE_CONNECTION_NOT_FOUND

285

the -1 connection has not been found.

I5_ERR_PHP_LOCALHOST_NOT_PERMIT

286

you must specify the AS/400 address

I5_ERR_PHP_INTERNAL

288

Internal error; please contact Aura Equipements. error number 288

I5_ERR_PHP_EXECUTE

289

You cannot read a request with parameters without calling the I5_execute function.

I5_ERR_PHP_NO_COMMAND

290

Empty command line or name

I5_ERR_PHP_EMPTY_ARRAY

291

Internal error; please contact Aura Equipements. error number 291

I5_ERR_PHP_NO_KEYNAME

292

Unspecified name for array item -1.

I5_ERR_PHP_NO_PARMNAME

293

Internal error; please contact Aura Equipements. error number 293

I5_ERR_PHP_NO_ZVALUE

294

Internal error; please contact Aura Equipements. error number 294

I5_ERR_PHP_COMMAND_ERROR

295

The command returned an error: x.

I5_ERR_PHP_DATAREA_READ

296

The command returned an error: x.

I5_ERR_PHP_GET_SYSVAL

297

The command returned an error: x.

I5_ERR_PHP_UNAVIABLE_PASE

298

This feature is not available on i5/OS environment.

I5_ERR_PHP_ELEMENT_MISSING

304

An element of the array has a wrong type within function_name(type) function.

I5_ERR_PHP_BAD_DEF

305

You cannot define an occurrence number; and an occurrence reference for the same parameter -1.

I5_ERR_PHP_BAD_KEYNAME

306

Name x is not a property name for a program description

I5_ERR_PHP_NO_DS_VALUE

307

You cannot set a value for 'Data Structure' x.

I5_ERR_PHP_BAD_DS_INPUT

308

Values for 'Data Structure' parameter -1 does not match the description.

I5_ERR_PHP_DTAQ_BADKEY

309

The key is not correct.

I5_ERR_PHP_DESC_EMPTY

310

The description array is empty.

I5_ERR_PHP_BAD_PROG_NAME

311

Program not found.

I5_ERR_PHP_AS400_MESSAGE

312

Internal error; please contact Aura Equipements. error number 312

I5_ERR_PHP_NOT_DTAQ_KEY

313

No key defined.

I5_ERR_PHP_EMPTY_NAME

314

Object name can not be empty

I5_ERR_PHP_BAD_DTAARA_LENGTH

315

Data area x should be from -1 to -2

I5_ERR_PHP_EMPTY_PCML

316

PCML can not be empty

I5_ERR_PGM_DONT_EXIST

530

Internal error; please contact Aura Equipements. error number 530

I5_ERR_FIELDNULL

4097

Field value is NULL

 

 

Example

 

$query = i5_query("SELECT * FROM EASYCOM/SP_CUST");

 

if($query == FALSE){

    echo "SQL error code: " . i5_errno($query) . "<br>";

     echo "Error message: " . i5_errormsg($query) . "<br>";}

 

/* Connection test */

$conn = i5_connect("MYAS","USER","PASSWORD");

if ($conn == FALSE) {

 $err = i5_error();

 switch  ($err["cat"]) {

  case I5_CAT_TCPIP:

   echo "TCP/IP problem – Connection not possible";

   exit;

  case I5_CAT_INTERNAL:

   echo " Easycom error - Connection not possible ";

 }

 echo "error number". i5_errno() . "<BR>";

 echo "error message". i5_errormsg() ."<BR>";

}

 

/* File edition test */

$edition = i5_edit($file);

if ($edition == FALSE) {

 switch  (i5_errno()) {

  case I5_ERR_INVALIDOPENMODE:

   echo "Opens file in writing to enable modification";

  case I5_ERR_RECORDNOTFOUND:

   echo "Points a record before modification";

 

  case I5_ERR_RECORDLOCKED:

   echo "Locked record...";

 }

}

 

 

/* Command test */

$ret = i5_cmd("NB=CHAR(20); RTVSYSVAL SYSVAL(QSRLNBR) RTNVAR(&NB)");

if ($ret) { // correct syntax

 $res = i5_cmdget("RC");

 if ($res == 0) {...} // correct execution

 else {echo "Command provoked error ". $res;}

 else {

  echo "Check command syntax";

 }

 

 

 /* SQL request test */

 $query = i5_query("SELECT * FROM EASYCOM/SP_CUST");

 

 if($query == FALSE){

  echo "SQL error code: " . i5_errno($query) . "<br>";

  echo "Error message: " . i5_errormsg($query) . "<br>";

 }

}

 

 

See also

 

i5_errormsg

i5_error