Saturday, February 20, 2010

CHAIN AND SETLL -- RPGLE

Where to use SETLL and CHAIN

If the programmer is using SETLL and READE to get a single record you could change the program to CHAIN and get quicker results. The SETLL and READE is good only for situations where you need to read a group of records with the same propertie

The below program is for fetching Employee Name and Employee Salary based on the Employee Number Entered through the screen.

Based on the input ( Employee Nmber - EMPIDS ) the CHAIN opcode will directly point to the record . READE will read that records and passing the values to Screen variables ... quite easy and simple.




I will publish the SETLL program in the next------------------------------

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:
=======