All posts in IBM i

Dins un bloc monitoritzat amb MONITOR a RPGLE, si hi ha cap excepció, tindrem el codi d’excepció a la variable %STATUS.

Aquest codi pot ser:

Normal Codes

Code
Condition
00000
No exception/error occurred
00001
Called program returned with the LR indicator on.
00050
Conversion resulted in substitution.
Exception/Error Codes

Code
Condition
00100
Value out of range for string operation
00101
Negative square root
00102
Divide by zero
00103
An intermediate result is not large enough to contain the result.
00104
Float underflow. An intermediate value is too small to be contained in the intermediate result field.
00105
Invalid characters in character to numeric conversion functions.
00112
Invalid Date, Time or Timestamp value.
00113
Date overflow or underflow. (For example, when the result of a Date calculation results in a number greater than *HIVAL or less than *LOVAL.)
00114
Date mapping errors, where a Date is mapped from a 4-character year to a 2-character year, and the date range is not 1940-2039.
00115
Variable-length field has a current length that is not valid.
00120
Table or array out of sequence.
00121
Array index not valid
00122
OCCUR outside of range
00123
Reset attempted during initialization step of program
00202
Called program or procedure failed; halt indicator (H1 through H9) not on
00211
Error calling program or procedure
00222
Pointer or parameter error
00231
Called program or procedure returned with halt indicator on
00232
Halt indicator on in this program
00233
Halt indicator on when RETURN operation run
00299
RPG IV formatted dump failed
00301
Class or method not found for a method call, or error in method call.
00302
Error while converting a Java array to an RPG parameter on entry to a Java native method.
00303
Error converting RPG parameter to Java array on exit from an RPG native method.
00304
Error converting RPG parameter to Java array in preparation for a Java method call.
00305
Error converting Java array to RPG parameter or return value after a Java method.
00306
Error converting RPG return value to Java array.
00333
Error on DSPLY operation
00351
Error parsing XML document
00352
Invalid option for %XML
00353
XML document does not match RPG variable
00354
Error preparing for XML parsing
00401
Data area specified on IN/OUT not found
00402
*PDA not valid for non-prestart job
00411
Data area type or length does not match
00412
Data area not locked for output
00413
Error on IN/OUT operation
00414
User not authorized to use data area
00415
User not authorized to change data area
00421
Error on UNLOCK operation
00425
Length requested for storage allocation is out of range
00426
Error encountered during storage management operation
00431
Data area previously locked by another program
00432
Data area locked by program in the same process
00450
Character field not entirely enclosed by shift-out and shift-in characters
00451
Conversion between two CCSIDs is not supported.
00501
Failure to retrieve sort sequence.
00502
Failure to convert sort sequence.
00802
Commitment control not active.
00803
Rollback operation failed.
00804
Error occurred on COMMIT operation
00805
Error occurred on ROLBK operation
00907
Decimal data error (digit or sign not valid)
00970
The level number of the compiler used to generate the program does not agree with the level number of the RPG IV run-time subroutines.
09998
Internal failure in ILE RPG compiler or in run-time subroutines
09999
Program exception in system routine.


Table 8. Exception/Error Codes
Code Device1 RC2 Condition
01011 W,D,SQ n/a Undefined record type (input record does not match record identifying indicator).
01021 W,D,SQ n/a Tried to write a record that already exists (file being used has unique keys and key is duplicate, or attempted to write duplicate relative record number to a subfile).
01022 D n/a Referential constraint error detected on file member.
01023 D,SQ n/a Error in trigger program before file operation performed.
01024 D,SQ n/a Error in trigger program after file operation performed.
01031 W,D,SQ n/a Match field out of sequence.
01041 n/a n/a Array/table load sequence error.
01042 n/a n/a Array/table load sequence error. Alternate collating sequence used.
01051 n/a n/a Excess entries in array/table file.
01071 W,D,SQ n/a Numeric sequence error.
011214 W n/a No indicator on the DDS keyword for Print key.
011224 W n/a No indicator on the DDS keyword for Roll Up key.
011234 W n/a No indicator on the DDS keyword for Roll Down key.
011244 W n/a No indicator on the DDS keyword for Clear key.
011254 W n/a No indicator on the DDS keyword for Help key.
011264 W n/a No indicator on the DDS keyword for Home key.
01201 W 34xx Record mismatch detected on input.
01211 all n/a I/O operation to a closed file.
01215 all n/a OPEN issued to a file already opened.
012163 all yes Error on an implicit OPEN/CLOSE operation.
012173 all yes Error on an explicit OPEN/CLOSE operation.
01218 D,SQ n/a Record already locked.
01221 D,SQ n/a Update operation attempted without a prior read.
01222 D,SQ n/a Record cannot be allocated due to referential constraint error
01231 SP n/a Error on SPECIAL file.
01235 P n/a Error in PRTCTL space or skip entries.
01241 D,SQ n/a Record number not found. (Record number specified in record address file is not present in file being processed.)
01251 W 80xx 81xx Permanent I/O error occurred.
01255 W 82xx 83xx Session or device error occurred. Recovery may be possible.
01261 W n/a Attempt to exceed maximum number of acquired devices.
01271 W n/a Attempt to acquire unavailable device
01281 W n/a Operation to unacquired device.
01282 W 0309 Job ending with controlled option.
01284 W n/a Unable to acquire second device for single device file
01285 W 0800 Attempt to acquire a device already acquired.
01286 W n/a Attempt to open shared file with SAVDS or IND options.
01287 W n/a Response indicators overlap IND indicators.
01299 W,D,SQ yes Other I/O error detected.
01331 W 0310 Wait time exceeded for READ from WORKSTN file.
Notes:

"Device" refers to the devices for which the condition applies. The following abbreviations are used: P = PRINTER; D = DISK; W = WORKSTN; SP = SPECIAL; SQ = Sequential. The major/minor return codes under column RC apply only to WORKSTN files.
The formula mmnn is used to described major/minor return codes: mm is the major and nn the minor.
Any errors that occur during an open or close operation will result in a *STATUS value of 1216 or 1217 regardless of the major/minor return code value.
See Figure 9 for special handling.

En aquesta plana de Midrange els trobarem tots i en forma de constants.

Per a comprimir en format ZIP un arxiu del sistema d’arxius IFS de l’AS/400 emprarem la instrucció JAR.

JAR és un format per a distribuir aplicacions java, agrupant classes de diferents arxius en un de sol. Amb el temps es va adoptar un mètode de compressió, el ZIP de Phil Katz, vet aquí perquè les dues primeres posicions dels arxius .ZIP comencen amb les inicials PK.

Per a procedir a comprimir en format ZIP, arrencarem una sessió de shell QSH de l’AS/400
STRQSH

I indicarem la instrucció
jar cfM arxiu.zip arxiu.cvs

Les opcions seran:

  • c Crear un JAR
  • f Crear-ho en un arxiu de disc
  • M No incloure el manifest java

path i nom de l’arxiu comprimit, indicar extensió .zip

path i nom de l’arxiu a comprimir.
I obtindrem un arxiu enzipat a la carpeta on ens trobem.
Si executem jar sense cap paràmetre, obtindrem una ajuda dels paràmetres que es poden emprar.

També es pot fer d’una tacada passant com a paràmetre de STRQSH la instrucció a executar.

Al darrer RPG & DB2 Summit, es va comentar bastant una novetat força interesant, l’Open I/O for RPG.

Sembla ser que la V7R1, que sortirà a la primavera del 2010, ja inclou aquesta especificació que permet als programes escrits en RPG accedir a arxius plans directament, sense haver de fer tot el muntatge d’API’s de l’IFS.

Segons hem llegit, aquesta opció també s’afegirà a l’actual V6R1.

Una modernització de l’RPG que serà benvinguda per la comunitat de desenvolupadors d’AS/400.

A l’AS/400 crearem l’objecte de tipus SAVF a la biblioteca que ens interesi, en aquest cas CORRETGE1.
CRTSAVF CORRETGE1/ITKSRC
Al PC iniciarem una connexió FTP amb l’AS/400
ftp as400.corretge.ct
Un cop loginejats, indicarem que ens volem moure amb el format de noms complert teclejant
quote site namefmt 1
quote site listfmt 1

Si ho fem desde FileZilla, a l’apartat de log premem botó dret del ratolí Introdueix una ordre específica… i introduim les ordres sense quote.

I ens situarem a la biblioteca on hem creat els SAVF.
cd /qsys.lib/corretge1.lib
Ara ens situarem a la carpeta del PC on tenim els arxius
lcd /home/usuari/arxius
Podem certificar que estem on toca amb la comanda pwd.
Indiquem al servidor FTP que enviarem dades en format binary fent
bin
i pujarem l’arxiu
put itksrc.savf
Un cop pujat, finalitzarem la connexió ftp amb ç
quite

A l’AS/400 visualitzarem informació del SAVF, sobretot esbrinarem com s’ha creat si amb SAVOBJ o amb SAVLIB fent
DSPSAVF CORRETGE1/ITKSRC

Captura-Google-Insights-for-Search-Web-Search-Volume-as-400-vs.-iseries-vs.-i5-vs.-power6-Worldwide-2004-present-Mozilla-Firefox

La nefasta política de marketing d’IBM per a l’AS/400 canviant-li de nom cada quatre anys te la seva repercussió a InterNet, els usuaris quan cerquem continguts no sabem com fer-ho si per AS/400, iSeries, i5 o Power System o Power6.

Fent servir l’eina Google Insights podem veure com actua la població a l’hora de buscar informació sobre aquest sistema.


Observem que majoritariament s’empra el terme iSeries. A Corretgé.com també el feiem servir, però després del darrer canvi de nom, vam optar per emprar el clàssic AS/400. De fet a les estadístiques del Google Insights es detecta un repunt el darrer mes de les recerques per AS/400.

Google Insights mostra una comparativa entre mots cercats, sent 100 el cop que es va consultar més una de les paraules comparades. En base a aquesta dada, calcula la resta de proporcionalitats.

No hem fet la recerca per Power System, i si per Power6 doncs l’interpretava com un sistema d’alimentació elèctric :-)

Per a indicar als programes SQLRPGLE que les dates es tractaran en un format concret, per exemple *EUR, cal executar aquesta instrucció:
c/EXEC SQL SET OPTION DATFMT = *EUR, TIMFMT = *ISO
c/END-EXEC

Per a poder cridar desde RPGLE procediments escrits en C amb EXTPROC *CWIDEN cal mapejar correctament els tipus de dades que hi ha en un llenguatge i en altri de l’AS/400.

Aquesta taula extreta del web http://www.opensource400.org/callc.html ens mostra la correlació:


C | RPG
------------------------+-----------------------------------
int x | D x 10I 0 VALUE
long x | D x 10I 0 VALUE
long long x | D x 20I 0 VALUE
unsigned int x | D x 10U 0 VALUE
unsigned long x | D x 10U 0 VALUE
unsigned long long x | D x 20U 0 VALUE
double x | D x 8F VALUE
|
short *x | D x 5I 0
int *x | D x 10I 0
long *x | D x 10I 0
long long *x | D x 20I 0
unsigned short *x | D x 5U 0
unsigned int *x | D x 10U 0
unsigned long *x | D x 10U 0
unsigned long long *x | D x 20U 0
float *x | D x 4F
double *x | D x 8F



C | RPG
------------------------+------------------------------------------
struct SSS s | D s VALUE LIKE(SSS)
struct SSS *s | D s LIKE(SSS)
TTT t | D t VALUE LIKE(TTT)
TTT *t | D t LIKE(TTT)
char *s | D s * VALUE OPTIONS(*STRING)
|OR D s nA
void *p | D p * VALUE
|OR D s LIKE(SSS)
wchar_t a | D a 1C VALUE
wchar_t a |OR D a 1G VALUE
wchar_t *a | D a nC
wchar_t *a |OR D a nG

Relació dels atributs de pantalla 5250 necessaris per a mostrar, per exemple, alarmes en resultats SQL.

4.47.3.1 Valid P-field Values (Nonprotect)

+------------------------------------------------------------------------+
¦ Figure 4-66. P-field values (nonprotect) ¦
+------------------------------------------------------------------------¦
¦ Hex ¦ Limited Color ¦ Full Color ¦
+-----------------------+------------------------+-----------------------¦
¦ 20 ¦ Normal ¦ Green ¦
+-----------------------+------------------------+-----------------------¦
¦ 21 ¦ Reverse image ¦ Green, reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ 22 ¦ High intensity ¦ White ¦
+-----------------------+------------------------+-----------------------¦
¦ 23 ¦ High intensity, ¦ White, reverse image ¦
¦ ¦ reverse image ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 24 ¦ Underscore ¦ Green, underscore ¦
+-----------------------+------------------------+-----------------------¦
¦ 25 ¦ Underscore, reverse ¦ Green, underscore, ¦
¦ ¦ image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ 26 ¦ Underscore, high ¦ White, underscore ¦
¦ ¦ intensity ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 27 ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ 28 ¦ Blink ¦ Red ¦
+-----------------------+------------------------+-----------------------¦
¦ 29 ¦ Blink, reverse image ¦ Red, reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ 2A ¦ Blink, high intensity ¦ Red, high intensity ¦
+-----------------------+------------------------+-----------------------¦
¦ 2B ¦ Blink, high intensity, ¦ Red, high intensity, ¦
¦ ¦ reverse image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ 2C ¦ Blink, underscore ¦ Red, underscore ¦
+-----------------------+------------------------+-----------------------¦
¦ 2D ¦ Blink, underscore, ¦ Red, underscore, ¦
¦ ¦ reverse image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ 2E ¦ Blink, underscore, ¦ Red, underscore, ¦
¦ ¦ high intensity ¦ blink ¦
+-----------------------+------------------------+-----------------------¦
¦ 2F ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ 30 ¦ Column separator ¦ Turquoise, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ 31 ¦ Reverse image, column ¦ Turquoise, column ¦
¦ ¦ separator ¦ separator, reverse ¦
¦ ¦ ¦ image ¦
+-----------------------+------------------------+-----------------------¦
¦ 32 ¦ High intensity, column ¦ Yellow, column ¦
¦ ¦ separator ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ 33 ¦ High intensity, ¦ White, reverse image, ¦
¦ ¦ reverse image, column ¦ column separator ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 34 ¦ Underscore, column ¦ Turquoise, ¦
¦ ¦ separator ¦ underscore, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ 35 ¦ Underscore, reverse ¦ Turquoise, ¦
¦ ¦ image, column ¦ underscore, reverse ¦
¦ ¦ separator ¦ image, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ 36 ¦ Underscore, high ¦ Yellow, underscore, ¦
¦ ¦ intensity, column ¦ column separator ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 37 ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ 38 ¦ Blink, column ¦ Pink ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 39 ¦ Blink, reverse image, ¦ Pink, reverse image ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3A ¦ Blink, high intensity, ¦ Blue ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3B ¦ Blink, high intensity, ¦ Blue, reverse image ¦
¦ ¦ reverse image, column ¦ ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3C ¦ Blink, underscore, ¦ Pink, underscore ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3D ¦ Blink, underscore, ¦ Pink, underscore, ¦
¦ ¦ reverse image, column ¦ reverse image ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3E ¦ Blink, underscore, ¦ Blue, underscore ¦
¦ ¦ high intensity, column ¦ ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ 3F ¦ Nondisplay ¦ Nondisplay ¦
+------------------------------------------------------------------------+

4.47.3.2 Valid P-Field Values (Protect)

+------------------------------------------------------------------------+
¦ Figure 4-67. P-field values (protect) ¦
+------------------------------------------------------------------------¦
¦ Hex ¦ Limited Color ¦ Full Color ¦
+-----------------------+------------------------+-----------------------¦
¦ A0 ¦ Normal ¦ Green ¦
+-----------------------+------------------------+-----------------------¦
¦ A1 ¦ Reverse image ¦ Green, reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ A2 ¦ High intensity ¦ White ¦
+-----------------------+------------------------+-----------------------¦
¦ A3 ¦ High intensity, ¦ White, reverse image ¦
¦ ¦ reverse image ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ A4 ¦ Underscore ¦ Green, underscore ¦
+-----------------------+------------------------+-----------------------¦
¦ A5 ¦ Underscore, reverse ¦ Green, underscore, ¦
¦ ¦ image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ A6 ¦ Underscore,high ¦ White, underscore ¦
¦ ¦ intensity ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ A7 ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ A8 ¦ Blink ¦ Red ¦
+-----------------------+------------------------+-----------------------¦
¦ A9 ¦ Blink, reverse image ¦ Red, reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ AA ¦ Blink,high intensity ¦ Red, high intensity ¦
+-----------------------+------------------------+-----------------------¦
¦ AB ¦ Blink, high intensity, ¦ Red, high intensity, ¦
¦ ¦ reverse image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ AC ¦ Blink, underscore ¦ Red, underscore ¦
+-----------------------+------------------------+-----------------------¦
¦ AD ¦ Blink, underscore, ¦ Red, underscore, ¦
¦ ¦ reverse image ¦ reverse image ¦
+-----------------------+------------------------+-----------------------¦
¦ AE ¦ Blink, underscore, ¦ Red, underscore, ¦
¦ ¦ high intensity ¦ blink ¦
+-----------------------+------------------------+-----------------------¦
¦ AF ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ B0 ¦ Column separator ¦ Turquoise, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ B1 ¦ Reverse image, column ¦ Turquoise, column ¦
¦ ¦ separator ¦ separator, reverse ¦
¦ ¦ ¦ image ¦
+-----------------------+------------------------+-----------------------¦
¦ B2 ¦ High intensity, column ¦ Yellow, column ¦
¦ ¦ separator ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ B3 ¦ High intensity, ¦ White, reverse image, ¦
¦ ¦ reverse image, column ¦ column separator ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ B4 ¦ Underscore, column ¦ Turquoise, ¦
¦ ¦ separator ¦ underscore, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ B5 ¦ Underscore, reverse ¦ Turquoise, ¦
¦ ¦ image, column ¦ underscore, reverse ¦
¦ ¦ separator ¦ image, column ¦
¦ ¦ ¦ separator ¦
+-----------------------+------------------------+-----------------------¦
¦ B6 ¦ Underscore, high ¦ Yellow, underscore, ¦
¦ ¦ intensity, column ¦ column separator ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ B7 ¦ Nondisplay ¦ Nondisplay ¦
+-----------------------+------------------------+-----------------------¦
¦ B8 ¦ Blink, column ¦ Pink ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ B9 ¦ Blink, reverse image, ¦ Pink, reverse image ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BA ¦ Blink, high intensity, ¦ Blue ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BB ¦ Blink, high intensity, ¦ Blue, reverse image ¦
¦ ¦ reverse image, column ¦ ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BC ¦ Blink, underscore, ¦ Pink, underscore ¦
¦ ¦ column separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BD ¦ Blink, underscore, ¦ Pink, underscore, ¦
¦ ¦ reverse image, column ¦ reverse image ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BE ¦ Blink, underscore, ¦ Blue, underscore ¦
¦ ¦ high intensity, column ¦ ¦
¦ ¦ separator ¦ ¦
+-----------------------+------------------------+-----------------------¦
¦ BF ¦ Nondisplay ¦ Nondisplay ¦
+------------------------------------------------------------------------+