Saturday, June 29, 2013

A Display File in CL program.

Using A Display File in CL program.
I just designed one screen which has one input capable field while rest is screen constant .
Have a look at below screenshot:


So this screen has one input where you can enter any of the option.
Let us discuss how this is being called with in a CL program.
In this program we do not need to define opt variable as it will be picked from display file.
Let’s understand the code of the program one by one.
First line PGM shows start of the program.
2nd line DCLF – it stands for declare file which has the screen name. (Basically it is used to declare Display file, also the variables defined in this screen will be accessible to this CL program).
3rd line SNDRCVF --The Send/Receive File (SNDRCVF) command is used by a control language (CL) program to send data to and receive data from a device that is being used interactively by a user. 
(Basically it handles entering your response on screen and passes it to CL program).
4th and 5th line has IF condition whatever condition will be true on screen expected output will be processed as expected.
(like the above program has either F3 pressed or you enter choice 1 as option, on pressing F3 it will close the program and on taking option 1 it will call the program STMLE)

6th line is used to tell the program ends here.

Tuesday, June 25, 2013

Control Language Basic Part 1

Control Language:
Control language also knows as CL. CL is a language which is used in AS400 for controlling purpose. It is basically a well organized language as its basic is commands with different parameter.
Let’s study an example to study how CL works.
Steps to create a CL program:
1.    WRKMBRPDM
2.    Press F6
3.    Give the object name
4.    Type parameter should have value as CLP.






Press Enter
You will get a blank screen.
We will study a program which will display User Profile.
1-    PGM
2-    DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
3-    DCL        VAR(&MSG) TYPE(*CHAR) LEN(40)
4-    RTVUSRPRF  RTNUSRPRF(&USER)
5-    CHGVAR     VAR(&MSG) VALUE(&USER)
6-    SNDPGMMSG  MSG(&MSG)
7-    ENDPGM
Let’s see what each line will do in this program’
1st line show start of the program
2nd and 3rd line we declare two variable named User and Msg.
4th line shows a command which is used to retrieve user profile.
5th line moves value of user profile to msg variable.
6th line sends the user name to program message which is basically appears upon the bottom.
7th line shows how to end a CL program.
So If we try to understand basic structure of any CL Program:
ü  Start
ü  Declare variables
ü  Declare files
ü  Use calculation or assignment
ü  End program.
Just one more thing here, whenever we write any program its developer responsibility to add meaning full comments to programs. So in CL  /* */ are used to do comment.

/* This Program will send User Profile*/

Wednesday, May 1, 2013

Physical File and Unique Keyword

Physical File In AS400: 

Physical File is the file which holds the data. This is the file which holds the space in memory.
It’s Type is PF. It has only one record format. 
Maximum number of fields included in a PF is 8000. While maximum no of key fields are 120.

Steps to Create PF in AS400
  1. You should have a source file in your library. If you do not has the Source File. You should create one by using command CRTSRCPF.  
  2.  Go to that file using WRKMBRPDM ( Work with members using PDM)
  3.   Enter the source file and library name.
  4.  Take F6 option to create, you need to enter Source member name as your PF name and Type as PF for physical file. In text you can enter text with respect to your file.
  5. You can enter the source of physical file here.


Example of Unique keyword in PF:
I used Unique Keyword in this PF.When I compiled it I got the Error.



FIFO, LIFO, FCFO, Unique Keywords requires key fields.
So Now I defined Key Field in the file.
Then it got compiled successfully.
Now I am going to put values from SQL.
Use STRSQL on Command Line,

You Can See from Query First record is successfully entered. While I try to add the same record again with same Key value it states that Duplicate key value specified.
This is how unique keyword works.





Thursday, March 7, 2013

About AS400 -- I Systems

AS400 -- Many people who work in IT say AS400 stand from Application Server while it stand for Application System. The IBM System i is IBM's previous generation of midrange computer systems for IBM i users, and was subsequently replaced by the IBM Power Systems in April 2008.

AS/400 is the most successful commercial midrange computer system & also the most widely used business-computing system in the world. Today, there are about 800,000 installations of AS/400 around the world. More than 60% of the fortune 500 companies use AS/400 for their critical applications.

IBM introduced the AS/400 in 1988 into the business community where large data processing was involved. The majority of these machines are placed in medium sized businesses or at the departmental level of large corporations to handle line-of- business data processing chores. This includes applications like payroll, accounts receivable, accounts payable, order processing, billing, manufacturing, management, medical administration and other specialized applications.

Many ERPs like J.D.Edwards, BPCS and MAPICS have been successfully implemented worldwide on the AS/400 to handle these applications in these areas, the database capabilities inherent to AS/400 make it a natural selection for data intensive operations.

AS400 has Layered architecture.This insulates users from hardware characteristics. It enables them to move to new hardware technology at any time, without disrupting their application programs. ‘Licensed Internal Code’ translates instructions given to the machine so that they can be understood by the hardware. Hardware characteristics change as the technology changes, the user however still sees the same machine interface. The licensed internal code preserved this interface. Furthermore, some frequently used routines have been moved into licensed internal code. This runs faster than the HLL. Layered machine architecture means that as new hardware and software technologies emerge, they can be employed without affecting applications.


With AS/400 you can code in many programming languages but the following are most popular RPG, C, C++, Pascal, Java, COBOL, SQL, REXX.

The ILE (Integrated Language Environment) programming environment allows programs from ILE compatible languages (C, C++, COBOL, RPG, Fortran, and CL), to be bound into the same executable and call procedures written in any of the other ILE languages.

Commands in the Control Language (CL) are prompt-able using the keyboard F4 function key, and most provide cursor-sensitive help to make specifying command parameters simpler.