Professional Documents
Culture Documents
Sample Code:: Output: Shouhil, Fazal, Syeduzm
Sample Code:: Output: Shouhil, Fazal, Syeduzm
Sample Code:: Output: Shouhil, Fazal, Syeduzm
EVALR:
It is used to evaluate any kind of expression.
Sample code:
Dfld1
s
10a inz('shouhil')
C fld1
dsply
C
eval
fld1='shouhil'
C fld1
dsply
C
evalr fld1='shouhil'
C fld1
dsply
C
seton
lr
Output
: SHOUHIL,
SHOUHIL
SHOUHIL
MOVE:
The MOVE operation transfers characters from factor 2 to the result field.
Sample code:
FPHS
IF E
K DISK
FE
CF E
WORKSTN
/FREE
READ PHS;
EVAL DID=EMPID;
EVAL DNAM=EMPNAM;
EVAL DADD=EMPADD;
EXFMT DEPREC;
*INLR=*ON;
/END-FREE
Output : 100
fazal
syeduzma
DOW:
DOW means program could never perform the loop (If the
condition is false). .
Sample code:
FPHS
IF E
K DISK
/FREE
DOW not %eof(phs);
READ PHS;
DSPLY EMPID;
ENDDO;
*INLR=*ON;
/END-FREE
**********************************************
Output
: 100,200,300,400
DOU:
With DOU, program will perform the loop at least once.
Sample code:
FPHS
IF E
/FREE
DOU %eof;
READ PHS;
DSPLY EMPID;
ENDDO;
*INLR=*ON;
/END-FREE
K DISK
**********************************************
Output
: 100
FOR:
Sample code:
DCOUNT
S
2P 0 INZ(2)
C
FOR
COUNT=1 TO 6 BY 2
C
COUNT
DSPLY
C
ENDFOR
C
SETON
LR
**********************************************
Output
: 1
3
5
DIM(similar to occur)
Sample code:
DA
S
10P 0 DIM(10)
DRES
S
10P 0
/FREE
RES=1;
DSPLY RES;
*INLR=*ON;
/END-FREE
**********************************************
Output
: 1
DATE:
It will convert date, to another format.
Sample code:
Ddate
s
10a
Dres
s
d
/free
date='990302';
res=%date(date:*ymd0);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 1999-03-02
TIME:
It will convert time to another format.
Sample code:
Dtime
s
10a
Dres
s
t
/free
time='1134';
res=%time(time:*iso0);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 11.34.00
OCCUR
OCCUR sets the current position of a multiple-occurrence data structure..
Only one occurrence can be used at a time. First we need to set a pointer
and we can set the data and retrieve data from multi occurrence data
structure.
Sample code:
D mds
ds
D mn
s
/free
%occur(mds)=1;
mn=1;
dsply mn;
%occur(mds)=2;
mn=2;
dsply mn;
*inlr=*on;
/end-free
occurs(10)
10p 0
**********************************************
Output
: 10.12.15
SECOND(SUBSTRACTING):
It gives the number of seconds in correct format and it will substract.
Sample code:
Dsec
s
t inz(t'10.12.15')
Dres
s
t
/free
res=sec+%seconds(-2);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 10.12.14
MINUTES(ADDING):
It gives the number of minutes in correct format.
Sample code:
D sec
s
D res
s
/free
res=sec+%hours(2);
dsply res;
*inlr=*on;
/end-free
t inz(t'10.12.15')
t
**********************************************
Output
: 10.15.15
MINUTES(SUBSTRACTING):
It gives the number of minutes, and will be subtract.
Sample code:
D sec
s
t inz (t'10.12.15')
D res
s
t
/free
res=sec+%hours(-2);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 10.15.15
HOURS(ADDING):
It gives the number of hours in correct format.
Sample code:
D sec
s
t inz(t'10.12.15')
D res
s
t
/free
res=sec+%seconds(2);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 13.12.15
HOURS(SUBSRACTING):
It gives the number of hours in correct format and it will be substract.
Sample code:
D sec
s
t inz(t'10.12.15')
D res
s
t
/free
res=sec+%seconds(-2);
dsply res;
*inlr=*on;
/end-free
**********************************************
Output
: 13.12.15
: INDIA IS MY COUNTRY
DS
4a
1a inz('-')
2a
1a inz('-')
2a
: 2012-12-04