Saturday, February 13, 2010

RPGLE - Compile Time Array

After a long struggle on Compile time array , I defined an array . The problem was while initializing compile time array at the end of the program .( actually we need to take shift+F7 and give values)

Compile time array get populated at the time compilation of the code.Mostly these type of array use for error message display.

** and then data in successive lines at the bottom of the source.Below example we have defined an COMARR compile time array using CTDATA




OUTPUT:
======




The COMARR compile time array data we can hard code as row wise. But while declaring we have to specify how many values entering per row . Below example entering 5 records ( all the array values) per row. Keyword PERRCD(5)



OUTPUT:
=====

Thursday, February 11, 2010

RPGLE - Runtime Array

In RPGLE the array concept same as collection of same data type. But it is classified according to time of intialization.

Runtime array got populated while program running

While declaring runtime array we have to specify the size of the array ( Dimension ):

See below sample program:



OUTPUT:
=======

Wednesday, February 10, 2010

Convert date format RPGLE

A variable can be declared as date data type using 'D' in internal data type.






C ....*USA....... MOVE.......Datetemp.....Dat
C .... Dat ...... DSPLY....

Dat declared as 8 D ( date data type with 8 length ) to compact with *USA format

OUTPUT:
======






Character (A)
Graphic (G)
Numeric - Integer format (I)
Numeric – Packed decimal format (P)
Numeric - Zoned format (S)
Numeric - Unsigned format (U)
Float (F)
Date (D)
Time (T)
Timestamp (Z)