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

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)

Shifting to tn5250

I got another terminal for logging into iSeries from ubuntu through just 'tn5250'. The GREEN screens makes more feeling that I am working in AS400 :-)

This has given by the http://www.rzkh.de/ as400 service administrators

See wiki.

http://en.wikipedia.org/wiki/IBM_5250

Tuesday, February 9, 2010

RPGLE - Concatenate two strings,addition


Simple programs are always helpful to get good step to learn a new language. See below how easy this is to write RPGLE ( am learning from basic ) rather than jumping to big things


INZ keyword is used to initialize the 'surname' and 'forename'. But before concatenating the variables using 'CAT' the valued changed using EVAL opcode.

Addition can be done using 'ADD'.

Arithmetic operations:

http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/evferlsh354.htm