Sie sind auf Seite 1von 69

ARY1

RPGLE

COMPILE TIME ARRAY TO READ RECORDS FROM ARRAY

*************** Beginning of data *************************************


0001.00 dexp
s
2p 0 dim(5) ctdata ASCEND
0002.00 dI
s
2p 0 inz(0)
0004.00 C I
DOWLT 6
0005.00 C exp(I)
dsply
0006.00 C
EVAL I=I+1
0007.00 C
enddo
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 06
0011.00 04
0012.00 67
0013.00 45
0014.00 35
****************** End of data ****************************************
ARY2

RPGLE

COMPILE TIME ARRAY TO READ RECORDS (PERRECORD)

*************** Beginning of data *************************************


0001.00 dexp
s
2p 0 dim(5) ctdata PERRCD(5)
0002.00 dI
s
2p 0 inz(1)
0004.00 C I
DOWLT 6
0005.00 C exp(I)
dsply
0006.00 C
EVAL I=I+1
0007.00 C
enddo
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 0598765434
****************** End of data ****************************************
ARY3

RPGLE

COMPILE TIME ARRAY (XFOOT)

*************** Beginning of data *************************************


0001.00 dexp
s
2p 0 dim(5) ctdata PERRCD(5)
0002.00 dI
s
3p 0 inz(0)
0004.00 C
XFOOT EXP
I
0005.00 C I
dsply
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 0598765434

****************** End of data ****************************************


ARY4

RPGLE

COMPILE TIME ARRAY (SORT)

*************** Beginning of data *************************************


0001.00 dexp
s
2 dim(5) ctdata
0002.00 dI
s
2 0 inz(1)
0004.00 C
0005.01 C
SORTA EXP
0005.02 C I
DOWLE 5
0005.03 C EXP(I)
DSPLY
0005.04 C
EVAL I=I+1
0005.05 C
ENDDO
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 05
0011.00 90
0012.00 76
0013.00 01
0014.00 67
****************** End of data ****************************************
ARY5

RPGLE

COMPILE TIME ARRAY (SORT) (perrecord)

*************** Beginning of data *************************************


0001.00 dexp
s
2 dim(5) ctdata perrcd(5)
0002.00 dI
s
2 0 inz(1)
0004.00 C
0005.01 C
SORTA EXP
0005.02 C I
DOWLE 5
0005.03 C EXP(I)
DSPLY
0005.04 C
EVAL I=I+1
0005.05 C
ENDDO
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 1009786534
****************** End of data ****************************************
ARY6

RPGLE

COMPILE TIME ARRAY (lookup)

*************** Beginning of data *************************************


0001.00 dexp
s
2p 0 dim(5) ctdata
0001.01 dexp1
s
10a dim(5) ctdata
0004.00 C
0005.01 C 'enter(a)' dsply
a
20

0005.03 C exp(a)
lookup exp
0005.08 C exp1(a)
dsply
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 10
0011.00 20
0012.00 30
0013.00 40
0014.00 50
0015.00 ** ctdata exp1
0016.00 srini
0017.00 vamsi
0018.00 venkat
0019.00 tvs
0020.00 rk
****************** End of data ****************************************
ARY7

RPGLE

COMPILE TIME ARRAY (lookup) (perrecord)

*************** Beginning of data *************************************


0001.00 dexp
s
2p 0 dim(3) ctdata perrcd(3)
0001.01 dexp1
s
3a dim(3) ctdata perrcd(3)
0004.00 C
0005.01 C 'enter(a)' dsply
a
20
0005.03 C exp(a)
lookup exp
0005.08 C exp1(a)
dsply
0008.00 C
seton
0009.00 ** CTDATA EXP
0010.00 105020
0015.00 ** ctdata exp1
0016.00 srirk pstvsds
****************** End of data ****************************************
ARY8

RPGLE

COMPILE TIME ARRAY (MOVEA)

*************** Beginning of data *************************************


0001.00 dary1
s
2p 0 dim(5) ctdata perrcd(5)
0002.00 dary2
s
2p 0 dim(5) ctdata PERRCD(5)
0003.00 di
s
2p 0 INZ(1)
0004.00
0005.01 C
movea ary1
ary2
0005.02 C
SORTA ARY2
0006.00 C I
dowle 5
0007.00 C ARY2(I)
dsply
0008.00 C
eval I=I+1

0009.00 C
ENDDO
0010.00 C
SETON
0011.00
0012.00 ** CTDATA ARY1
0013.00 0446129056
****************** End of data ****************************************
ARY9

RPGLE

COMPILE TIME ARRAY (ALT)

*************** Beginning of data *************************************


0001.00 dary1
s
2A dim(5) CTDATA
0002.00 dary2
s
10A dim(5) ALT(ARY1)
0003.00 di
s
1p 0 INZ(1)
0004.00
0006.00 C I
dowle 5
0007.00 C 'ARY1'
dsply
ARY1(I)
0007.01 C 'ARY2'
DSPLY
ARY2(I)
0008.00 C
eval I=I+1
0009.00 C
ENDDO
0010.00 C
SETON
0011.00
0012.00 ** CTDATA ARY1
0013.00 01 JAN
0014.00 02 FEB
0015.00 03 MAR
0016.00 04 MAR
0017.00 05 APR
****************** End of data ****************************************
ARY10

RPGLE

PRERUNTIME ARRAY(RPGPF5)

*************** Beginning of data *************************************


0001.00 FRPGPF5 IT F 30
DISK
0002.00 DARY1
S
30 DIM(7) FROMFILE(RPGPF5)
0003.00 DI
S
2P 0 INZ(1)
0004.00 C
DOW
I<=7
0005.00 C ARY1(I)
DSPLY
0006.00 C
ADD
1
I
0007.00 C
ENDDO
0008.00 C
SETON
LR
****************** End of data ****************************************
ARY11

RPGLE

PRERUNTIME ARRAY(ARYPF)

*************** Beginning of data *************************************

0001.00 FARYPF IT F 30
DISK
0002.00 DARY1
S
30 DIM(5) FROMFILE(ARYPF)
0003.00 DI
S
2P 0 INZ(1)
0004.00 C
DOW
I<=5
0005.00 C ARY1(I)
DSPLY
0006.00 C
ADD
1
I
0007.00 C
ENDDO
0008.00 C
SETON
LR
****************** End of data ****************************************
ARY12

RPGLE

PRERUNTIME ARRAY(FROM FILE & TO FILE) ARYPF1

*************** Beginning of data *************************************


0001.00 Farypf IT F 30
DISK
0002.00 Farypf1 CT F 30
DISK
0003.00 DPfARY
S
30 DIM(5) FROMFILE(aryPF)
0004.00 D
TOFILE(ARYPF1)
0005.00 DJ
S
2S 0
0006.00 DI
S
2S 0 INZ(1)
0007.00
0008.00 C
EVAL J=%ELEM(PFARY)
0009.00 C*
MOVE *BLANKS
PFARY
0010.00 C J
DSPLY
0011.00 C I
DOWLE J
0012.00 C PFARY(I) DSPLY
0013.00 C
EVAL I=I+1
0014.00 C
ENDDO
0015.00 C
SETON
Lr
****************** End of data ****************************************

ARY13

RPGLE

RUNTIME ARRAY

*************** Beginning of data *************************************


0001.00 DARY1
S
2P 0 DIM(3)
0002.00 DVAR1
S
2P 0
0003.00 DVAR2
S
2P 0
0003.01 DI
S
1P 0 INZ(0)
0003.02
0004.00 C 'ENTER VAR1' DSPLY
VAR1
0005.00 C 'ENTER VAR2' DSPLY
VAR2
0006.00 C
MOVE VAR1
ARY1(1)
0007.00 C
MOVE VAR2
ARY1(2)
0008.00 C
EVAL ARY1(3)=ARY1(1)+ ARY1(2)
0009.00 C 'ARY1(1)' DSPLY
ARY1(1)

0009.02 C 'ARY1(2)' DSPLY


ARY1(2)
0009.03 C 'ARY1(3)' DSPLY
ARY1(3)
0010.00 C
SETON
LR
****************** End of data ****************************************
CL4

CLLE

RECEVING value FROM data queue (CLDTQ1)

*************** Beginning of data *************************************


0001.00 pgm
0002.00
DCLF
FILE(CHAKRI/CLDSP) RCDFMT(REC1)
0003.00
DCL
VAR(&NAME) TYPE(*CHAR)
0004.00
dcl
var(&lib) type(*char) len(10)
0005.00
dcl
var(&len) type(*dec) len(2 0) value(50)
0006.00
dcl
var(&data) type(*char) len(25)
0006.01
dcl
var(&wait) type(*dec) len(4 0) value(10)
0007.00
CALL
PGM(QSYS/QRCVDTAQ) PARM(CLDTQ1 CHAKRI &LEN +
0007.01
&DATA &wait)
0008.00
CHGVAR VAR(&OUTPUT) VALUE(&DATA)
0009.00
SNDRCVF RCDFMT(REC1)
0010.00
ENDPGM
****************** End of data ****************************************
DA1

RPGLE

DATA AREA(SRI1)

*************** Beginning of data *************************************


0001.00 C *DTAARA
DEFINE
SRI1
80
0002.00 C
IN
SRI1
0002.01 C
MOVE 12345678 SRI1
0003.00 C
MOVE SRI1
CHAKRI
80
0004.00 C 'CHAKRI' DSPLY
CHAKRI
0005.00 C
SETON
LR
****************** End of data ****************************************
DA2

RPGLE

DATA AREA SRI2 (IN,OUT,LOCK,UNLOCK)

*************** Beginning of data *************************************


0001.00 C *DTAARA
DEFINE
SRI2
10
0002.00 C *LOCK
IN
SRI2
0002.01 C 'SRI2'
DSPLY
SRI2
0002.02 C
MOVE 'SRINIVAS' SRI2
0003.00 C
MOVE SRI2
CHAKRI
10
0003.01 C
OUT
SRI2
0004.00 C 'CHAKRI' DSPLY
CHAKRI
0005.00 C
SETON
LR
****************** End of data ****************************************

DA3

RPGLE

DATA AREA SRI1 (*LIKE,BLANKS, MOVE)

*************** Beginning of data *************************************


0000.01 DVAR1
S
3P 0
0001.00 C *DTAARA
DEFINE
SRI1
80
0002.00 C
IN
SRI1
0002.01 C 'SRI1'
DSPLY
SRI1
0002.02 C
MOVE *BLANKS
SRI1
0002.03 C *LIKE
DEFINE VAR1
VAR2
0002.04 C *LIKE
DEFINE VAR1
RES
0002.05 C 'ENTER VAR1' DSPLY
VAR1
0002.06 C 'ENTER VAR2' DSPLY
VAR2
0002.07 C
EVAL RES=VAR1+VAR2
0002.08 C
MOVE RES
SRI1
0004.00 C 'RES'
DSPLY
SRI1
0005.00 C
SETON
LR
****************** End of data ****************************************
DSP

DSPF

DSPLY FILE FOR ( A, B,C, D,E)

*************** Beginning of data *************************************


0000.01 A*%%TS SD 20040803 104544 DSRINIVAS REL-V4R2M0 5769-PW1
0001.00 A*%%EC
0002.00 A
DSPSIZ(24 80 *DS3)
0002.01 A
R FORM1
0002.02 A*%%TS SD 20040730 034409 DSRINIVAS REL-V4R2M0 5769-PW1
0002.03 A
CF03(03)
0002.04 A
10 14'ENTER EMPNO:'
0002.05 A
EMPNO R
B 10 35REFFLD(EMPREC/EMPNO CHAKRI/
0002.06 A
R FORM2
0002.07 A*%%TS SD 20040730 034409 DSRINIVAS REL-V4R2M0 5769-PW1
0002.08 A
CF03(03)
0004.00 A
8 8'EMPNO:'
0005.00 A
10 8'EMPNAME:'
A
12 8'ADDRESS:'
0001.50 A
EMPNO R
B 8 20REFFLD(EMPREC/EMPNO CHAKRI/
0001.60 A
EMPNAME R
B 10 20REFFLD(EMPREC/EMPNAME
CHAKR
0001.70 A
ADDRESS R
B 12 20REFFLD(EMPREC/ADDRESS CHAKR
0001.80 A
R FORM3
0001.90 A*%%TS SD 20040731 023028 DSRINIVAS REL-V4R2M0 5769-PW1
0002.00 A
CF03(03)
0002.10 A
7 12'ENTER NO1:'
0002.20 A
10 12'ENTER NO2:'

0002.30 A
13 12'ENTER NO3:'
0002.40 A
NO1
3 0B 7 27
0002.50 A
NO2
3 0B 10 27
0002.60 A
NO3
3 0B 13 27
0002.70 A
17 18'GREATEST OF THREE NOS IS:'
0002.80 A
COLOR(RED)
0002.90 A
RES
10 B 17 51
0003.00 A
R REGNO
0003.10 A*%%TS SD 20040801 082939 DSRINIVAS REL-V4R2M0 5769-PW1
0003.20 A
CF03(03)
0003.30 A
7 10'DATA AREA-DTA4'
0003.40 A
A
8 B 7 30
0003.50 A
14 10'CHGDTAARA -DTA4'
0003.60 A
COLOR(RED)
0003.70 A
B
8 B 14 31COLOR(RED)
0003.80 A
4 32'CHANGING DATA AREA'
0003.90 A
DSPATR(UL)
0004.00 A
COLOR(PNK)
0004.10 A
R REC6
0004.20 A*%%TS SD 20040803 104544 DSRINIVAS REL-V4R2M0 5769-PW1
0004.30 A
23 28' ABC S/W COMP'
0004.40 A
COLOR(RED)
0004.50 A
3 28'ABC S/W COMPANY'
0004.60 A
COLOR(RED)
0004.70 A
7 23'EMPNO'
0004.80 A
10 23'EMPNAME'
0004.90 A
EMPNO R
B 7 34REFFLD(EMPREC/EMPNO CHAKRI/
0005.00 A
EMPNAME R
B 10 33REFFLD(EMPREC/EMPNAME CHAKR
****************** End of data ****************************************

DSPMENU

DSPF

DSPLY SCREEN

*************** Beginning of data *************************************


0000.10 A*%%TS SD 20040729 104715 DSRINIVAS REL-V4R2M0 5769-PW1
0000.20 A*%%EC
0000.30 A
DSPSIZ(24 80 *DS3)
0000.40 A
R REC1
0000.50 A*%%TS SD 20040729 104715 DSRINIVAS REL-V4R2M0 5769-PW1
0000.60 A
CF03(03)
0000.70 A
2 37'WELCOME'
0000.80 A
DSPATR(UL)
0000.90 A
COLOR(GRN)
0001.00 A
7 13'**************************
0001.10 A
***************'

0001.20 A
COLOR(RED)
0001.30 A
9 18'READ RECORDS'
0001.40 A
COLOR(PNK)
0001.50 A
12 18'WRITE RECORDS'
0001.60 A
COLOR(WHT)
0001.60 A
COLOR(WHT)
0001.70 A
15 18'UPDATE RECORDS'
0001.80 A
18 18'DELETE RECORD'
0001.90 A
COLOR(RED)
0002.00 A
22 13' *************************
0002.10 A
***************'
0002.20 A
COLOR(BLU)
0002.30 A
9 37' '
0002.40 A
5 18'ENTER EMPNO:'
0002.50 A
DSPATR(UL)
0002.60 A
COLOR(WHT)
0002.70 A
23 64' F3 EXI'
0002.80 A
COLOR(GRN)
0002.90 A
CHOICE
1A I 20 57
0003.00 A
20 18'ENTER UR CHOICE ( R , W ,
0003.10 A
DSPATR(UL)
0003.20 A
EMPNO R
I 5 39REFFLD(EMPREC/EMPNO CHAKRI/
0003.30 A
R REC2
0003.40 A*%%TS SD 20040729 103357 DSRINIVAS REL-V4R2M0 5769-PW1
0003.50 A
CF03(03)
0003.60 A
5 28'SCREEN FOR READING RECORDS
0003.70 A
DSPATR(UL)
0003.80 A
9 13'EMPNO:'
0003.90 A
12 13'EMPNAME:'
0004.00 A
15 13'ADDRESS:'
0004.10 A
21 31'F3 = EXIT'
0004.20 A
EMPNO R
B 9 28REFFLD(EMPREC/EMPNO CHAKRI/
0004.30 A
EMPNAME R
B 12 28REFFLD(EMPREC/EMPNAME CHAKR
0004.40 A
ADDRESS R
B 15 28REFFLD(EMPREC/ADDRESS CHAKR
****************** End of data ****************************************
DS1

RPGLE

FILE INFORMATION DATA STRUCTURE(INFDS-ARYPF)

*************** Beginning of data *************************************


0001.00 FARYPF UF E
DISK INFDS(SRIDS) INFSR(SRISUB)
0002.00 DSRIDS
DS
0003.00 D A
*STATUS
0004.00 D B
*ROUTINE
0005.00 D C
*OPCODE
0006.00 D D
*FILE
0006.01 D E
*RECORD

0007.00
0008.00 C
EXSR ADDSR
0008.02 C
EXSR UPDATESR
0009.00 C
SETON
LR
0010.00
0011.00 C SRISUB
BEGSR
0012.00 C 'STATUS-ERR' DSPLY
A
0013.00 C 'ROUTINE-ERR' DSPLY
B
0014.00 C 'OPCODE-ERR' DSPLY
C
0015.00 C 'FILE-ERR' DSPLY
D
0015.01 C 'RECORD-ERR' DSPLY
E
0016.00 C
ENDSR
0017.00
0017.01 C ADDSR
BEGSR
0017.03 C 'VAR1 '
DSPLY
VAR1
50
0017.04 C 'VAR2 '
DSPLY
VAR2
50
0017.05 C VAR1
ADD
VAR2
RES
60
0017.06 C 'RES'
DSPLY
RES
0017.07 C
ENDSR
0018.00 C UPDATESR BEGSR
0019.00 C
READ ARYPF
0020.00 C
CLOSE ARYPF
0021.00 C
UPDATE REC
0022.00 C
ENDSR
****************** End of data ****************************************
DS2

RPGLE

PROGRAM STATUS DATA STRUCTURE

*************** Beginning of data *************************************


0001.00 DSRI
SDS
0002.00 DST
*STATUS
0003.00 DRT
*ROUTINE
0004.00 DA
S
3P 0 INZ(0)
0005.00 DB
S
3P 0 INZ(100)
0006.00 DRES
S
4P 0
0007.00
0008.00 C
EVAL RES=B/A
0009.00 C 'RESof B/A is'dsply
res
0010.00 C
seton
lr
0011.00 C *pssr
begsr
0012.00 C 'status' dsply
st
0013.00 C 'routine' dsply
rt
0014.00 C
endsr
****************** End of data ****************************************
MAINMOD

RPGLE

main module for (addmod , submod , mulmod)

*************** Beginning of data *************************************


0001.00 c
callb 'add'
0002.00 C
callb 'sub'
0003.00 C
callb 'mul'
0004.00 C
seton
lr
****************** End of data ****************************************
MAINMOD1 RPGLE

main module for (addmod , submod , mulmod)

*************** Beginning of data *************************************


0001.00 c
callp add
0002.00 C
callp sub
0003.00 C
callp mul
0004.00 C
seton
lr
****************** End of data ****************************************

MULMOD

RPGLE

this is a mul module for mainmod

*************** Beginning of data *************************************


0001.00 c
z-add 4
a
40
0002.00 C
z-add 5
b
40
0003.00 C a
sub
b
e
50
0004.00 C 'e is:'
dsply
e
0005.00 C
seton
rt
****************** End of data ****************************************
RPGPRTF1 RPGLE

RPG PRINTER FILE FOR EMPLOYEE RECORD (RLU)

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
DISK
0002.00 FPRT1 O E
PRINTER
0003.00
0004.00 C
WRITE RCD001
0005.00 C
READ RPGPF4
90
0006.00 C *IN90
DOWEQ *OFF
0006.01 C
WRITE RCD002
0007.00 C
WRITE RCD003
0008.00 C
READ RPGPF4
90
0008.01 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************

RPGPRTF2 RPGLE

RPG PRINTER RECORD FOR STUDENT RECORD(RLU)

*************** Beginning of data *************************************


0001.00 FRPGPF3 IF E
DISK
0002.00 FPRT2 O E
PRINTER
0003.00
0004.00 C
WRITE RCD002
0005.00 C
READ RPGPF3
90
0006.00 C *IN90
DOWEQ *OFF
0007.00 C
WRITE RCD004
0008.00 C
READ RPGPF3
90
0008.01 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPGPRTF3 RPGLE

RPG PRINTER FILE FOR TICKET (RLU)

*************** Beginning of data *************************************


0001.00 FRPGPF2 IF E
DISK
0002.00 FPRT3 O E
PRINTER
0003.00 C
0004.00 C
WRITE RCD001
0005.00 C
READ RPGPF2
90
0006.00 C *IN90
DOWEQ *OFF
0007.00 C
WRITE RCD002
0008.00 C
READ RPGPF2
90
0009.00 C
ENDDO
0010.00 C
SETON
LR
****************** End of data ****************************************
RPGPRTF4 RPGLE

IMPLICIT PRINTER FILE USING RPG(RLU)

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
DISK
0002.00 FQSYSPRT O F 132
PRINTER
0003.00
0003.01 C
READ RPGPF4
90
0003.02 C
EXCEPT LINE1
0003.03 C *IN90
DOWEQ *OFF
0003.05 C
EXCEPT LINE2
0003.06 C
read rpgpf4
90
0003.07 C
ENDDO
0003.08 C
SETON
LR
0003.09

0003.10 OQSYSPRT E
LINE1
0003.11 o
10 'empno'
0003.12 o
25 'empname'
0003.13 o
50 'address'
0003.15
0004.00 * IPO MUST BE TYPED ON SERIAL NO IT DISPLAYS CAPITAL 'O'- FOR HEADING
0004.01
0005.00 OQSYSPRT E
LINE2
0005.01
0005.02 *HERE ON SERIES PRESS 'I' AND USE SMALL 'O' AND F4 FOR RECORDS
0005.03
0006.00 o
empno
10
0007.00 o
empname
25
0008.00 o
address
50
0009.00
****************** End of data ****************************************
RPGPRTF5 RPGLE

RPG70

*************** Beginning of data *************************************


0001.00 FRPGPF3 IF E
DISK
0002.00 FQSYSPRT O F 132
PRINTER
0003.00 C
READ RPGPF3
90
0004.00 C
EXCEPT LINE1
0005.00 C *IN90
DOWEQ *OFF
0006.00 C
EXCEPT LINE2
0007.00 C
READ RPGPF3
90
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00
0011.00 OQSYSPRT E
LINE1
0012.00 o
10 'sno'
0013.00 o
20 'sname'
0014.00 o
50 'address'
0015.00 OQSYSPRT E
LINE2
0016.00 o
sno
10
0017.00 o
sname
20
0018.00 o
address
50
****************** End of data ****************************************

RPGPRT111 RPGLE

RPG PRINTERFILE FOR EMPLOYEERECORD(RLU)(explicit)

*************** Beginning of data *************************************


0001.00 FRPGPF1 IF E
DISK
0002.00 FRLU111 O E
PRINTER
0003.00
0004.00 C
WRITE RCD001
0005.00 C
READ RPGPF1
90
0006.00 C *IN90
DOWEQ *OFF
0007.00 C
WRITE RCD003
0008.00 C
READ RPGPF1
90
0008.01 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPGPRT222 RPGLE

RPG PRINTERFILE FOR EMPLOYEERECORD(RLU)(explicit)

*************** Beginning of data *************************************


0001.00 FRPGPF1 IF E
DISK
0002.00 FRLU222 O E
PRINTER
0003.00
0004.00 C
WRITE RCD001
0005.00 C
READ RPGPF1
90
0006.00 C *IN90
DOWEQ *OFF
0007.00 C
WRITE RCD003
0008.00 C
READ RPGPF1
90
0008.01 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG1

RPGLE

add,sub,mul,div

*************** Beginning of data *************************************


0001.00 D no1
S
3P 0
0002.00 D no2
S
3p 0
0003.00 D res
s
3p 0
0004.00 d res1
s
3p 0
0005.00 c 'enter no1' dsply
no1
0006.00 c 'enter no2' dsply
no2
0007.00
0008.00 *---------------add---------------------------------0009.00
0010.00 c no1
add
no2
res
0011.00 c 'add result' dsply
res
0012.00
0013.00 *---------------sub---------------------------------0014.00

0015.00 c no1
sub
no2
res
0016.00 c 'sub result' dsply
res
0017.00
0018.00 *---------------mul---------------------------------0019.00
0020.00 c no1
mult no2
res
0021.00 c 'mul result' dsply
res
0022.00
0023.00 *---------------div---------------------------------0024.00
0025.00 c no1
div
no2
res
0026.00 c
mvr
res1
0027.00 c 'div result' dsply
res
0028.00 c 'R result' dsply
res1
0029.00 *---------------------------------------------0030.00 c
seton
lr
****************** End of data ****************************************
RPG2

RPGLE

z-add,z-sub,sqrt,eval

*************** Beginning of data *************************************


0001.00 D A
S
3P 0
0002.00 D B
S
3P 0
0003.00 D C
S
3P 0
0004.00 D D
S
3P 0
0005.00 dsquare
s
4p 0
0006.00 dcube
s
5p 0
0007.00 C 'ENTER A' DSPLY
A
0008.00 C 'ENTER 2' DSPLY
B
0009.00 C
Z-ADD B
C
0010.00 C
Z-SUB B
D
0011.00 c
dsply
c
0012.00 c
dsply
d
0013.00 c
sqrt a
c
0014.00 c 'sqrt of a is'dsply
c
0015.00 c
eval square = a*a
0016.00 c
eval cube=b*b*b
0017.00 c
dsply
square
0018.00 c
dsply
cube
0019.00 c
seton
lr
****************** End of data ****************************************
RPG3

RPGLE

CAT

*************** Beginning of data *************************************


0001.00 dstr1
s
8 inz('SRINIVAS')

0002.00 DSTR2
S
6 INZ('CHAKRI')
0003.00 DRES1
S
15
0004.00
0005.00 *---------------CAT---------------------------------------0006.00 C STR1
CAT
STR2
RES1
0007.00 C 'CONCAT' DSPLY
RES1
0008.00 C
SETON
LR
****************** End of data ****************************************
RPG4

RPGLE

CHECK

*************** Beginning of data *************************************


0001.00 DSTR1
S
8A INZ('SRINIVAS')
0002.00 DSTR2
S
6A INZ('SBC')
0003.00 dres
s
5p 0
0004.00
0005.00 * FACTOR2 WILL COMPARE FACTOR1 FROM LEFT TO RIGHT AND COUNT L TO R
0006.00 C 'IVU '
CHECK STR2
RES
0007.00 C 'IVU'
DSPLY
0008.00 C 'SBC'
DSPLY
0009.00 C 'RESULT1' DSPLY
RES
0010.00 C STR1
CHECK STR1
RES
0011.00 C 'SRINIVAS' DSPLY
0012.00 C 'SRINIVAS' DSPLY
0013.00 C 'RESULT2' DSPLY
RES
0014.00 C 'SVZS'
CHECK STR1
RES
0015.00 C 'SVZS'
DSPLY
0016.00 C 'SRINIVAS' DSPLY
0017.00 C 'RESULT3' DSPLY
RES
0018.00 C 'ABS'
CHECK STR2
RES
0019.00 C 'ABS'
DSPLY
0020.00 C 'SBC'
DSPLY
0021.00 C 'RESULT4' DSPLY
RES
0022.00 C ' '
CHECKR FACTOR1
RES
0023.00 C
DSPLY
RES
0024.00 C
0025.00 C
SETON
LR
****************** End of data ****************************************
RPG4A
RPGLE
CHECK
*************** Beginning of data *************************************
0001.00 DSTR1
S
3A INZ('LHE')
0002.00 DSTR2
S
6A INZ('HELP')
0003.00 dres
s
5p 0

0004.00
0005.00 * FACTOR2 WILL COMPARE FACTOR1 FROM LEFT TO RIGHT AND COUNT L TO R
0006.00 C STR1
CHECK STR2
RES
0007.00 C 'LHE'
DSPLY
0008.00 C 'HELP'
DSPLY
0009.00 C 'RESULT1' DSPLY
RES
0009.01 C 'LO'
SCAN 'HELLO'
RES
0009.02 C
DSPLY
RES
0010.00 C
SETON
LR
****************** End of data ****************************************
RPG5

RPGLE

CHECKR

*************** Beginning of data *************************************


0001.00 D STR1
S
6A INZ('SRINIA')
0002.00 D STR2
S
4A INZ('VASU')
0003.00 D RES
S
15P 0
0004.00
0005.00 * FACTOR2 WILL COMPARE FACTOR1 FROM RIGHT TO LEFT AND COUNT R TO L
0006.00
0007.00 C STR2
CHECKR STR1
RES
0008.00 C 'VASU'
DSPLY
0009.00 C 'SRINIA' DSPLY
0010.00 C 'RESULT1' DSPLY
RES
0011.00 C STR1
CHECKR STR2
RES
0012.00 C 'SRINIA' DSPLY
0013.00 C 'VASU'
DSPLY
0014.00 C 'RESULT' DSPLY
RES
0015.00 C 'ABC'
CHECKR STR1
RES
0016.00 C 'ABC'
DSPLY
0017.00 C 'SRINIA' DSPLY
0018.00 C 'RESULT' DSPLY
RES
0019.00 C 'SRI'
CHECKR STR2
RES
0020.00 C 'SRI'
DSPLY
0021.00 C 'VASU'
DSPLY
0022.00 C 'RESULT' DSPLY
RES
0023.00 C ' '
CHECKR STR2
RES
0024.00 C
DSPLY
RES
0025.00 C ' '
CHECKR 'X YZ A ' RES
0026.00 C
DSPLY
RES
0027.00 C
0028.00 C
SETON
LR
****************** End of data ****************************************
RPG6

RPGLE

scan

*************** Beginning of data *************************************


0001.00 * contents of factor 1 must
0002.00 dstr1
S
8A INZ('hello')
0003.00 dSTR2
S
4A INZ('ello')
0004.00 DRES
S
5P 0
0005.00 C STR2
scan STR1
RES
0006.00 C 'hello'
DSPLY
0007.00 C 'ello'
dsply
0008.00 C
DSPLY
RES
0008.01 c 'ENTER F1' DSPLY
A
5
0008.02 C 'ENTER F2' DSPLY
B
10
0008.03 C A
SCAN B
RES
0008.04 C
DSPLY
RES
0009.00 c
seton
lr
****************** End of data ****************************************
RPG7

RPGLE

IF ELSE

*************** Beginning of data *************************************


0001.00 DNO1
S
2P 0
0002.00 DNO2
S
2P 0
0003.00 DRES
S
2P 0
0004.00
0005.00 C 'ENTER NO1' DSPLY
NO1
0006.00 C 'ENTER NO2' DSPLY
NO2
0007.00 C NO1
IFEQ NO2
0008.00 C 'NO1 = NO2' DSPLY
RES
0009.00 C
ELSE
0010.00 C 'NO1NOTEQNO2' DSPLY
RES
0011.00 C
ENDIF
0012.00 C
SETON
LR
****************** End of data ****************************************
RPG8

RPGLE

INCREMENTING A,B USING IF

*************** Beginning of data *************************************


0001.00 DA
S
2P 0
0002.00 DB
S
2P 0
0003.00 DRES
S
2P 0
0004.00
0005.00
0006.00 C 'ENTER A' DSPLY
A
0007.00 C 'ENTER B' DSPLY
B
0008.00 C A
IFEQ B

0009.00 C 'A EQ B' DSPLY


0010.00 C
ELSE
0011.00 C A
IFGT B
0012.00 C
EVAL B=A+1
0013.00 C 'B ='
DSPLY
B
0014.00 C
ELSE
0015.00 C
EVAL A=B+1
0016.00 C 'A ='
DSPLY
A
0017.00 C
ENDIF
0018.00 C
ENDIF
0019.00 C
SETON
LR
****************** End of data ****************************************
RPG9

RPGLE

GREATEST OF THREE NO

*************** Beginning of data *************************************


0001.00 DNO1
S
2P 0
0002.00 DNO2
S
2P 0
0003.00 DNO3
S
2P 0
0004.00
0005.00 C 'ENTER NO1' DSPLY
NO1
0006.00 C 'ENTER NO2' DSPLY
NO2
0007.00 C 'ENTER NO3' DSPLY
NO3
0008.00 C NO1
IFEQ NO2
0009.00 C NO1
ANDEQ NO3
0010.00 C '1=2=3'
DSPLY
0011.00 C
ELSE
0012.00 C NO1
IFGT NO2
0013.00 C NO1
ANDGT NO3
0014.00 C '1 IS GREATER'DSPLY
0015.00 C
ELSE
0016.00 C NO2
IFGT NO3
0017.00 C '2 IS GREATER'DSPLY
0018.00 C
ELSE
0019.00 C '3 IS GREATER'DSPLY
0020.00 C
ENDIF
0021.00 C
ENDIF
0022.00 C
ENDIF
0023.00 C
SETON
LR
****************** End of data ****************************************
RPG10

RPGLE

USING GOTO FINDING NO IS EVEN OR ODD

*************** Beginning of data *************************************


0001.00 DNO
S
2P 0

0002.00 DRES
S
2P 0
0003.00 DRES1
S
2P 0
0004.00
0005.00 C 'ENTER NO' DSPLY
NO
0006.00 C NO
IFEQ 0
0007.00 C 'ENTERNO GT 0'DSPLY
0008.00 C
GOTO END
0009.00 C
ELSE
0010.00 C NO
DIV
2
RES
0011.00 C
MVR
RES1
0012.00 C RES1
IFEQ 0
0013.00 C 'NO IS EVEN' DSPLY
0014.00 C
ELSE
0015.00 C 'NO IS ODD' DSPLY
0016.00 C
ENDIF
0017.00 C
ENDIF
0018.00 C END
TAG
0019.00 C
SETON
LR
****************** End of data ****************************************
RPG11

RPGLE

FACT

*************** Beginning of data *************************************


0001.00 D NO
S
2P 0
0002.00 D F
S
3P 0 INZ(1)
0003.00 D I
S
2P 0 INZ(1)
0004.00
0005.00 C 'ENTER NO' DSPLY
NO
0006.00 C LOOP
TAG
0007.00 C
IF
I<=NO
0008.00 C
EVAL F=F*I
0009.00 C 'FACT'
DSPLY
F
0010.00 C
EVAL I=I+1
0011.00 C
GOTO LOOP
0012.00 C
ENDIF
0013.00 C 'FACTORIAL' DSPLY
F
0014.00 C
SETON
LR
****************** End of data ****************************************
RPG12

RPGLE

TO GENERATE NATURAL NUMBERS

*************** Beginning of data *************************************


0001.00 D NUM
S
2P 0
0002.00 * INCREMENT NUM BY 1

0003.00 C 1
DO
10
NUM
0004.00 C NUM
DSPLY
0005.00 C
ENDDO
0006.00
0007.00 * INCREMENT NUM BY 2
0008.00 C 1
DO
10
NUM
0009.00 C NUM
DSPLY
0010.00 C
ENDDO 2
0011.00
0012.00 * INCREMENT THE NUM BY 3
0013.00 C 1
DO
10
NUM
0014.00 C NUM
DSPLY
0015.00 C
ENDDO 3
0016.00
0017.00 C
SETON
LR
****************** End of data ****************************************
RPG13

RPGLE

DO WHILE

*************** Beginning of data *************************************


0001.00 * DOWHILE CHECKS THE CONDITION AND THEN ENTER THE LOOP
0002.00
0003.00 D*NO
S
3P 0
0004.00 D A
S
2P 0
0005.00 D B
S
2P 0
0006.00
0007.00 C* 'ENTER NO' DSPLY
NO
0008.00
0009.00 C* NO
DOWLE 30
0010.00 C* NO
DSPLY
0011.00 C*
EVAL NO=NO+1
0012.00 C*
ENDDO
0013.00
0014.00 C 'ENTER A' DSPLY
A
0015.00 C 'ENTER B' DSPLY
B
0016.00 C
DOW
A>=5 AND B<=15
0017.00 C LOOP
TAG
0018.00 c A
IFEQ B
0019.00 C 'A=B'
DSPLY
0020.00 C
GOTO END
0021.00 C
ELSE
0022.00 C
EVAL A=A+1
0023.00 C 'A = '
DSPLY
A
0024.00 C
EVAL B=B-1
0025.00 C 'B = '
DSPLY
B
0026.00 C A
IFGT B

0027.00 C 'A IS GT B' DSPLY


0028.00 C
GOTO END
0029.00 C
ELSE
0030.00 C
GOTO LOOP
0031.00 C
ENDIF
0032.00 C
ENDIF
0033.00 C
ENDDO
0034.00 C END
TAG
0035.00 C
SETON
LR
****************** End of data ****************************************
RPG14

RPGLE

CONDITIONS IN DOWHILE

*************** Beginning of data *************************************


0001.00 D A
S
2P 0
0002.00 D B
S
2P 0
0003.00 D RES1
S
2P 0
0004.00 D RES2
S
2P 0
0005.00
0006.00 C 'ENTER NO A' DSPLY
A
0007.00 C 'ENTER NO2' DSPLY
B
0008.00 C A
DOWGT B
0009.00 C
EVAL A=A-B
0010.00 C 'A-B = ' DSPLY
A
0011.00 C A
DIV
B
RES1
0012.00 C
MVR
RES2
0013.00 C 'DIV RESULT' DSPLY
RES1
0014.00 C 'REM RESULT' DSPLY
RES2
0015.00 C
ENDDO
0016.00 C
SETON
LR
****************** End of data ****************************************
RPG15

RPGLE

USING LEAVE OPERATOR

*************** Beginning of data *************************************


0001.00 DNO
S
2P 0
0002.00
0003.00 C 'ENTER NO' DSPLY
NO
0004.00 C NO
DOWLT 20
0005.00 C NO
IFLT 10
0006.00 C
LEAVE
0007.00 C
ENDIF
0008.00 C NO
DSPLY
0009.00 C
EVAL NO =NO +1

0010.00 C
ENDDO
0011.00 C
SETON
LR
0012.00
****************** End of data ****************************************
RPG16

RPGLE

SELECT STATEMENT

*************** Beginning of data *************************************


0001.00 Dcolor
S
2A
0002.00 C 'ENTER R,G,B' DSPLY
COLOR
0003.00 C
SELECT
0004.00 C COLOR
WHENEQ 'R'
0005.00 C 'RED'
DSPLY
0006.00 C COLOR
WHENEQ 'G'
0007.00 C 'GREEN'
DSPLY
0008.00 C COLOR
WHENEQ 'B'
0009.00 C 'BLUE'
DSPLY
0010.00 C
OTHER
0011.00 C 'SORRY'
DSPLY
0012.00 C
ENDSL
0013.00 C
SETON
LR
****************** End of data ****************************************
RPG17

RPGLE

SUM OF 10 NATURAL NUMBERS

*************** Beginning of data *************************************


0001.00 DN
S
3P 0
INZ(1)
0002.00 DSUM
S
3P 0
0003.00
0004.00 C LOOP
TAG
0005.00 C 1
DO
10
N
0006.00 C N
DSPLY
0007.00 C
EVAL SUM=SUM+N
0008.00 C 'SUM'
DSPLY
SUM
0009.00 C
ENDDO
0010.00 C
SETON
LR
****************** End of data ****************************************

RPG19
RPGLE
simple SUBROUTING(ADD,SUB,ADDING NATURAL NO)
*************** Beginning of data *************************************
0001.00 DA
S
2P 0 INZ(20)
0002.00 DB
S
2P 0 INZ(15)
0003.00 DRES
S
4P 0

0004.00 DSUM
S
4P 0
0005.00 C
EXSR ADD1
0006.00 C RES
DSPLY
0007.00 C
EXSR SUB1
0008.00 C RES
DSPLY
0009.00 C
EXSR NO
0010.00 C RES
DSPLY
0011.00 C
SETON
LR
0012.00 C ADD1
BEGSR
0013.00 C A
ADD
B
RES
0014.00 C
ENDSR
0015.00 C SUB1
BEGSR
0016.00 C A
SUB
B
RES
0017.00 C
ENDSR
0018.00 C NO
BEGSR
0019.00 C 1
DO
10
N
30
0020.00 C N
DSPLY
0021.00 C
EVAL SUM=SUM+N
0022.00 C 'SUM'
DSPLY
SUM
0023.00 C
ENDDO
0024.00 C
ENDSR
0025.00
****************** End of data ****************************************
RPG20

CAS(conditionally invoke subroutine)

*************** Beginning of data *************************************


0001.00 DA
S
2P 0 INZ(10)
0002.00 DB
S
2P 0 INZ(5)
0003.00 DSUM
S
2P 0
0004.00 dopt
s
1a
0005.00
0005.01 c 'enter option'dsply
opt
0006.00 C OPT
CASEQ 'A'
ADD1
0007.00 C OPT
CASEQ 'B'
SUB1
0008.00 C
END
0012.01 C
SETON
0012.02
0013.00 C ADD1
BEGSR
0014.00 C A
ADD
B
SUM
0014.01 C 'SUM'
DSPLY
SUM
0015.00 C
ENDSR
0016.00 C SUB1
BEGSR
0017.00 C A
SUB
B
SUM
0017.01 C 'SUM'
DSPLY
SUM
0018.00 C
ENDSR

****************** End of data ****************************************


RPG21

RPGLE

CALL PGM (FOR INCREMENTING NO)

*************** Beginning of data *************************************


0001.00
0002.00 D A
S
2P 0
0003.00 D B
S
2P 0
0004.00
0005.00
0006.00 C PARMLIST PLIST
0007.00 C
PARM
A
0008.00 C
PARM
B
0009.00
0010.00 C 'ENTER A = ' DSPLY
A
0011.00 C 'ENTER B = ' DSPLY
B
0012.00
0013.00 C
CALL 'RPG21A' PARMLIST
0014.00 C 'A'
DSPLY
A
0015.00 C 'B'
DSPLY
B
0016.00 C
SETON
lr
****************** End of data ****************************************
RPG21A

RPGLE

CALLED PGM

*************** Beginning of data *************************************


001.00 D A
S
2P 0
002.00 D B
S
2P 0
003.00
004.00
005.00 C *ENTRY
PLIST
006.00 C
PARM
A
007.00 C
PARM
B
008.00
009.00 C
EVAL A=A+10
010.00 C* 'A'
DSPLY
A
011.00 C
EVAL B=B+10
012.00 C* 'B'
DSPLY
A
013.00 C
SETON
LR
014.00 C
RETURN
****************** End of data ****************************************
RPG22

RPGLE

call pgm for simple intrest

*************** Beginning of data *************************************

0001.00
0002.00 D P
S
5P 0
0003.00 D R
S
2P 0
0004.00 D T
S
2P 0
0005.00 D SI
S
5P 0
0006.00 D AMT
S
5P 0
0007.00
0008.00 C PARMLIST PLIST
0009.00 C
PARM
P
0010.00 C
PARM
R
0011.00 C
PARM
T
0012.00 C
PARM
SI
0013.00 C
PARM
AMT
0014.00
0015.00 C 'ENTER P' DSPLY
P
0016.00 C 'ENTER R' DSPLY
R
0017.00 C 'ENTER T' DSPLY
T
0018.00
0019.00 C
CALL 'RPG22A' PARMLIST
0020.00 C 'ST = '
DSPLY
SI
0021.00 C 'AMT = ' DSPLY
AMT
0022.00 C
SETON
LR
****************** End of data ****************************************

RPG22A

RPGLE

called pgm for simple intrest

*************** Beginning of data *************************************


0001.00 D P
S
5P 0
0002.00 D R
S
2P 0
0003.00 D T
S
2P 0
0004.00 D SI
S
5P 0
0005.00 D AMT
S
5P 0
0006.00
0007.00 C *ENTRY
PLIST
0008.00 C
PARM
P
0009.00 C
PARM
R
0010.00 C
PARM
T
0011.00 C
PARM
SI
0012.00 C
PARM
AMT
0013.00 C
EVAL SI =(P*R*T) / 100
0014.00 C
EVAL AMT=SI+ P
0015.00 C
SETON
LR
0016.00 C
RETURN

RPG23

RPGLE

call pgm add,sub,mul,div

*************** Beginning of data *************************************


0001.00 D NO1
S
3P 0
0002.00 D NO2
S
3P 0
0003.00 D RES1
S
4P 0
0004.00 D RES2
S
4P 0
0005.00 D RES3
S
4P 0
0006.00 D RES4
S
4P 0
0007.00 D RES5
S
4P 0
0008.00
0009.00 C PARMLIST PLIST
0010.00 C
PARM
NO1
0011.00 C
PARM
NO2
0012.00 C
PARM
RES1
0013.00 C
PARM
RES2
0014.00 C
PARM
RES3
0015.00 C
PARM
RES4
0016.00 C
PARM
RES5
0017.00
0018.00 C 'ENTER NO1' DSPLY
NO1
0019.00 C 'ENTER NO2' DSPLY
NO2
0020.00
0021.00 C
CALL 'RPG23A' PARMLIST
0022.00 C 'ADD = ' DSPLY
RES1
0023.00 C 'SUB = ' DSPLY
RES2
0024.00 C 'MUL = ' DSPLY
RES3
0025.00 C 'DIV = ' DSPLY
RES4
0026.00 C 'REM = ' DSPLY
RES5
0027.00 C
SETON
LR
****************** End of data ****************************************
RPG23A

RPGLE

called pgm for add, sub,mul div

*************** Beginning of data *************************************


0001.00 C *ENTRY
PLIST
0002.00 C
PARM
NO1
30
0003.00 C
PARM
NO2
30
0004.00 C
PARM
RES1
40
0005.00 C
PARM
RES2
40
0006.00 C
PARM
RES3
40
0007.00 C
PARM
RES4
40
0008.00 C
PARM
RES5
40
0009.00
0010.00 C NO1
ADD
NO2
RES1

0011.00 C
0012.00 C
0013.00 C
0014.00 C
0015.00 C
0016.00 C
RPG24

NO1
NO1
NO1

RPGLE

SUB
NO2
RES2
MULT NO2
RES3
DIV
NO2
RES4
MVR
RES5
SETON
RETURN

LR

WRITING RECORD INTO PF FROM DSPLY FILE

*************** Beginning of data *************************************


0001.00 FRPG24A O E
DISK
0002.00 FRPGDSP CF E
WORKSTN
0003.00 C
EXFMT REC1
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
WRITE REC
0006.00 C
CLEAR
REC1
0007.00 C
EXFMT REC1
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00 C
RETURN
****************** End of data ****************************************
RPG25

RPGLE

READING RECORDSfrom pf to display file

*************** Beginning of data *************************************


0001.00 FRPG24A IF E
DISK
0002.00 FRPGDSP CF E
WORKSTN
0003.00 C
READ RPG24A
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
EXFMT REC1
0006.00 C
READ RPG24A
0007.00 C
ENDDO
0008.00 C
SETON
LR
0009.00 C
RETURN
****************** End of data ****************************************
RPG26

RPGLE

USING SWITHCH ,GOTO ,SUBROUTINE(ADD,SUB,MUL,DIV)

*************** Beginning of data *************************************


0001.00 DNO1
S
3P 0
0002.00 DNO2
S
3P 0
0003.00 DRES
S
7P 0
0004.00 *CHOICE
S
1A
0005.00 DREM
S
3P 0
0006.00 DOPTION
S
1A
0007.00

0008.00 C 'ENTER NO1' DSPLY


NO1
0009.00 C 'ENTER NO2' DSPLY
NO2
0010.00
0011.00 C LOOP1
TAG
0012.00 C '+,-,*,/,=' DSPLY
0013.00 C 'ENTER CHOICE'DSPLY
CHOICE
0014.00
0015.00 ******************SELECT STATEMENTS****************
0016.00 C CHOICE
DSPLY
0017.00 *****************>>>
0018.00 C
SELECT
0019.00 C CHOICE
WHENEQ '+'
0020.00 C
EXSR ADD
0021.00 C CHOICE
WHENEQ '-'
0022.00 C
EXSR SUB
0023.00 C CHOICE
WHENEQ '*'
0024.00 C 'MULTI'
DSPLY
0025.00 C
EXSR MUL
0026.00 C CHOICE
WHENEQ '/'
0027.00 C
EXSR DIV
0028.00 C CHOICE
WHENEQ '='
0029.00 C
GOTO END
0030.00 C
ENDSL
0031.00
0032.00 C 'END CASE' DSPLY
0033.00 *****************>>>
0034.00
0035.00 C 'CONTINUE Y/N'DSPLY
OPTION
0036.00 C
SELECT
0037.00 C OPTION
WHENEQ 'Y'
0038.00 C
EVAL OPTION=' '
0039.00 C
EVAL CHOICE=' '
0040.00 C
GOTO LOOP1
0041.00 C
OTHER
0042.00 C
GOTO END
0043.00 C
ENDSL
0044.00
0045.00 C END
TAG
0046.00 C
SETON
LR
0047.00
0048.00
0049.00 ******************SUBROUTINE*******************
0050.00
0051.00 C ADD
BEGSR
0052.00 C
EVAL RES=NO1+NO2
0053.00 C 'RES FOR ADD' DSPLY
RES

0054.00 C
ENDSR
0055.00
0056.00 C SUB
BEGSR
0057.00 C
EVAL RES=NO1-NO2
0058.00 C 'RES FOR SUB' DSPLY
RES
0059.00 C
ENDSR
0060.00
0061.00 C MUL
BEGSR
0062.00 C
EVAL RES= NO1*NO2
0063.00 C 'RES OF MUL' DSPLY
RES
0064.00 C
ENDSR
0065.00
0066.00 C DIV
BEGSR
0067.00 C NO1
DIV
NO2
RES
0068.00 C
MVR
REM
0069.00 C 'RES OF DIV ' DSPLY
RES
0070.00 C 'REM'
DSPLY
REM
0071.00 C
ENDSR
****************** End of data ****************************************
RPG27

RPGLE

READING RECORDS INTO DSPLY FILES

*************** Beginning of data *************************************


0001.00 FRPGPF1 IF E
DISK
0002.00 FRPGDSP CF E
WORKSTN IGNORE(REC1)
0003.00
0004.00 C
READ RPGPF1
90
0005.00 C *IN03
DOWEQ *OFF
0006.00 C
EXFMT REC2
0007.00 C
READ RPGPF1
90
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00 C
RETURN
0011.00
****************** End of data ****************************************
RPG28

PPGLE

WRITING RECORDS FROM DSPLY FILE TO PF

*************** Beginning of data *************************************


0001.00 FRPGPF1 O E
DISK
0002.00 FRPGDSP CF E
WORKSTN IGNORE(REC1)
0003.00 C
EXFMT REC2
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
WRITE REC1

0006.00 C
CLEAR
REC2
0007.00 C
EXFMT REC2
0008.00 C
ENDDO
0009.00 C
SETON
0010.00 C
RETURN
****************** End of data ****************************************

RPG29

RPGLE

READING RECORDS FROM (RPGPF2)USINF DS

*************** Beginning of data *************************************


0001.00 FRPGPF2 IF E
DISK
0002.00 FRPGDSP CF E
WORKSTN
0003.00
0004.00 C
READ FORM1
90
0005.00 C *IN03
DOWEQ *OFF
0006.00 C
EXFMT REC3
0007.00 C
READ FORM1
90
0008.00 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG30

RPGLE

WRITING RECORDS INTO (RPGPF2)USING DS

*************** Beginning of data *************************************


0001.00 FRPGPF2 O E
DISK
0002.00 FRPGDSP CF E
WORKSTN
0003.00
0004.00
0005.00 C
EXFMT REC3
0006.00 C *IN03
DOWEQ *OFF
0007.00 C
WRITE FORM1
0008.00 C
CLEAR
REC3
0009.00 C
EXFMT REC3
0010.00 C
ENDDO
0011.00 C
SETON
LR
****************** End of data ****************************************
RPG31

RPGLE

WRITING RECORDS INTO RPGPF3 USING DSP

*************** Beginning of data *************************************


0001.00 FRPGPF3 O E
DISK
0002.00 FRPGDSP CF E
WORKSTN
0003.00
0004.00 DTOTAL
S
4P 0

0005.00 DSUB1
S
3P 0
0006.00 DSUB2
S
3P 0
0007.00 DSUB3
S
3P 0
0008.00
0009.00 C
EXFMT REC4
0010.00 C *IN03
DOWEQ *OFF
0011.00 C
WRITE SREC
0012.00 C
EVAL TOTAL=SUB1+SUB2+SUB3
0013.00 C
EXFMT REC4
0014.00 C
0015.00 C
0016.00 C
CLEAR
REC4
0017.00 C
EXFMT REC4
0018.00 C
ENDDO
0019.00 C
SETON
LR
****************** End of data ****************************************
RPG32

RPGLE

READ(READING RECORDS FROM PF-RPGPF3)

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF A E
K DISK
0002.00 DSNAME
S
10A
0003.00 DADDRESS
S
15A
0004.00 C 'ENTERNO' DSPLY
SNO
50
0005.00 C SNO
SETLL RPGPF3
0006.00 C
READ RPGPF3
60
0007.00 C *IN60
DOWEQ *OFF
0008.00 C SNAME
DSPLY
0009.00 C ADDRESS
DSPLY
0010.00 C
READ RPGPF3
60
0011.00 C 'EQ-IND' DSPLY
*IN60
0012.00 C
ENDDO
0013.00 C
SETON
LR
****************** End of data ****************************************
RPG33

RPGLE

READ EQUAL RECORDS FROM PF-RPGPF3

*************** Beginning of data *************************************


0001.00 fRPGPF3 UF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DADDRESS
S
15A
0005.00
0006.00 C 'ENTER SNO' DSPLY
SNO
0007.00 C SNO
SETll rpgpf3
0008.00 C
READe RPGPF3
60

0009.00 C 'EQ-IND' DSPLY


*IN70
0010.00 C *IN70
DOWEQ *Off
0011.00 C 'SNO = ' DSPLY
SNO
0012.00 C 'SNAME'
DSPLY
SNAME
0013.00 C 'ADDRESS' DSPLY
ADDRESS
0014.00 C
READe RPGPF3
70
0014.01 C
ENDDO
0014.02 c *in70
ifeq *on
0014.03 c 'notfound' dsply
0014.04 c
endif
0016.00 C
SETON
LR
****************** End of data ****************************************
RPG34

RPGLE

READ PREVIOUS RECORDS FROM THE GIVEN POINTER

*************** Beginning of data *************************************


0001.00 FRPGPF3 IF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0006.00 C 'ENTER SNO' DSPLY
SNO
0007.00 C SNO
SETLL RPGPF3
0008.00 C
READ RPGPF3
55
0009.00 C *IN55
DOWEQ *OFF
0010.00 C 'EQ-IND' DSPLY
*IN55
0011.00 C 'SNO = ' DSPLY
SNO
0012.00 C 'SNAME = ' DSPLY
SNAME
0013.00 C 'ADDRESS = ' DSPLY
ADDRESS
0014.00 C 'CLASS = ' DSPLY
CLASS
0015.00 C
READP RPGPF3
55
0016.00 C 'EQ-IND =' DSPLY
*IN55
0017.00 C
ENDDO
0018.00 C
SETON
LR
****************** End of data ****************************************
RPG35

RPGLE

READ RECORDS USING *LOVAL AND *HIVAL (SETGT)

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0006.00

0007.00 *IN *LOVAL THE OPCODE WE HAVE TO USE IS SETLL


0008.00 C* 'ENTER SNO' DSPLY
SNO
0009.00 C *LOVAL
SETLL RPGPF3
60
0010.00 C
READ RPGPF3
0011.00 C 'EQ-IND ' DSPLY
*IN60
0012.00 C* *IN55
DOWEQ *OFF
0013.00 C 'SNO = ' DSPLY
SNO
0014.00 C 'SNAME = ' DSPLY
SNAME
0015.00 c 'ADDRESS = ' DSPLY
ADDRESS
0016.00 C 'CLASS = ' DSPLY
CLASS
0016.01 C 'EQ-IND ' DSPLY
*IN60
0017.00 C*
READ RPGPF3
55
0018.00 C* 'EQ-IND =' DSPLY
*IN55
0019.00 C*
ENDDO
0020.00
0021.00 ********************HIVAL*******************************
0022.00
0023.00 *IN *HIVAL THE OPCODE MUST BE SETGT ALONG WITH READP
0024.00
0025.00 C* *HIVAL
SETGT RPGPF3
0026.00 C*
READP RPGPF3
55
0027.00 C* 'EQ-IND ' DSPLY
*IN55
0028.00 C* *IN55
DOWEQ *OFF
0029.00 C* 'SNO = ' DSPLY
SNO
0030.00 C* 'SNAME = ' DSPLY
SNAME
0031.00 C* 'ADDRESS = ' DSPLY
ADDRESS
0032.00 C* 'CLASS = ' DSPLY
CLASS
0033.00 C*
READP RPGPF3
55
0034.00 C* 'EQ-IND =' DSPLY
*IN55
0035.00 C*
ENDDO
0036.00 C
SETON
LR
****************** End of data ****************************************
RPG35A

RPGLE

READ RECORDS USING setll

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0007.00 *IN *LOVAL THE OPCODE WE HAVE TO USE IS SETLL
0007.01
0008.00 C 'ENTER SNO' DSPLY
SNO
0009.00 C sno
SETLL RPGPF3
60

0010.00 C
READp RPGPF3
0011.00 C 'EQ-IND ' DSPLY
*IN60
0012.00 C* *IN55
DOWEQ *OFF
0013.00 C 'SNO = ' DSPLY
SNO
0014.00 C 'SNAME = ' DSPLY
SNAME
0015.00 c 'ADDRESS = ' DSPLY
ADDRESS
0016.00 C 'CLASS = ' DSPLY
CLASS
0016.01 C 'EQ-IND ' DSPLY
*IN60
0017.00 C*
READ RPGPF3
55
0018.00 C* 'EQ-IND =' DSPLY
*IN55
0019.00 C*
ENDDO
0020.00 c
seton
lr
****************** End of data ****************************************
RPG35B

RPGLE

READ RECORDS USING setgt

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0020.00
0021.00 ********************HIVAL*******************************
0022.00
0023.00 *IN *HIVAL THE OPCODE MUST BE SETGT ALONG WITH READP
0024.00
0024.01 c 'enter sno' dsply
sno
0025.00 C sno
SETGT RPGPF3
0026.00 C
READp RPGPF3
55
0027.00 C 'EQ-IND ' DSPLY
*IN55
0028.00 C *IN55
DOWEQ *OFF
0029.00 C 'SNO = ' DSPLY
SNO
0030.00 C 'SNAME = ' DSPLY
SNAME
0031.00 C* 'ADDRESS = ' DSPLY
ADDRESS
0032.00 C 'CLASS = ' DSPLY
CLASS
0033.00 C*
READP RPGPF3
55
0034.00 C* 'EQ-IND =' DSPLY
*IN55
0035.00 C
ENDDO
0036.00 C
SETON
LR
****************** End of data ****************************************

RPG35C

RPGLE

READ RECORDS USING chain

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0007.00 *IN *LOVAL THE OPCODE WE HAVE TO USE IS SETLL
0007.01
0008.00 C 'ENTER SNO' DSPLY
SNO
0009.00 C sno
chain RPGPF3
40
0011.00 C 'hi-IND ' DSPLY
*IN40
0012.00 C *IN40
DOWEQ *OFF
0013.00 C 'SNO = ' DSPLY
SNO
0014.00 C 'SNAME = ' DSPLY
SNAME
0015.00 c* 'ADDRESS = ' DSPLY
ADDRESS
0016.00 C 'CLASS = ' DSPLY
CLASS
0016.01 C* 'EQ-IND ' DSPLY
*IN60
0017.00 C*
READ RPGPF3
55
0018.00 C* 'EQ-IND =' DSPLY
*IN55
0019.00 C
ENDDO
0020.00 c
seton
lr
****************** End of data ****************************************

RPG36

RPGLE

READ PREVIOUS EQUAL RECORDS FROM THE POINTER

*************** Beginning of data *************************************


0001.00 FRPGPF3 IF A E
K DISK
0002.00 DSNO
S
5P 0
0003.00 DSNAME
S
10A
0004.00 DCLASS
S
3P 0
0005.00
0006.00 C 'ENTER SNO' DSPLY
SNO
0007.00 C SNO
SETGT RPGPF3
0008.00 C
READP RPGPF3
55
0009.00 C 'EQ-IND ' DSPLY
*IN55
0010.00 C *IN55
DOWEQ *OFF
0011.00 C 'SNO = ' DSPLY
SNO
0012.00 C 'SNAME = ' DSPLY
SNAME
0013.00 C 'ADDRESS = ' DSPLY
ADDRESS
0014.00 C 'CLASS = ' DSPLY
CLASS
0015.00 C
READPE RPGPF3
55

0016.00 C 'EQ-IND =' DSPLY


*IN55
0017.00 C
ENDDO
0018.00 C
SETON
LR
****************** End of data ****************************************
RPG37

RPGLE

CHAIN OPERATION

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF A E
K DISK
0002.00 DEMPNO
S
3P 0
0003.00 DEMPNAME
S
10A
0004.00 DADDRESS
S
15A
0005.00
0006.00 C 'ENTER EMPNO' DSPLY
EMPNO
0007.00 C EMPNO
CHAIN RPGPF4
60
0008.00 C *IN60
DOWEQ *OFF
0008.01 C 'HI-IND = ' DSPLY
*IN60
0009.00 C 'EMPNO =' DSPLY
EMPNO
0010.00 C 'EMPNAME = ' DSPLY
EMPNAME
0011.00 C 'ADDRESS =' DSPLY
ADDRESS
0012.00 C
READP RPGPF4
60
0013.00 C 'HI-IND = ' DSPLY
*IN60
0014.00 C
ENDDO
0015.00 C
SETON
LR
****************** End of data ****************************************
RPG38

RPGLE

UPDATE

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF E
K DISK
0002.00 FRPGDSP CF E
WORKSTN IGNORE(REC1:REC2:REC3:REC4)
0003.00 C LOOP
TAG
0004.00 C
EXFMT REC5
0005.00 C *IN03
DOWEQ *OFF
0006.00 C EMPNO
setll RPGPF4
50
0007.00 C
read rpgpf4
90
0008.00 C
EXFMT REC5
0009.00 C *IN50
IFEQ *ON
0010.00 C
UPDATE emprec
0011.00 C
ELSE
0012.00 C
CLEAR
REC5
0013.00 C
GOTO LOOP
0014.00 C
ENDIF
0015.00 C
CLEAR
REC5
0016.00 C
GOTO LOOP
0017.00 C
ENDDO

0018.00 C
SETON
LR
0019.00
****************** End of data ****************************************

RPG39

RPGLE

UPDATE(EMPPF4)

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF A E
K DISK
0002.00 FRPGDSP CF E
WORKSTN IGNORE(REC1:REC2:REC3:REC4:REC5)
0003.00
0003.01 C *IN03
DOWEQ *OFF
0004.00 C
EXFMT REC7
0005.00 C EMPNO
SETLL RPGPF4
50
0006.00 C
READ RPGPF4
90
0007.00 C
EXFMT REC7
0008.00 C *IN50
IFEQ *on
0009.00 C
UPDATE EMPREC
0010.00 C
ENDIF
0011.00 C
CLEAR
REC7
0011.01 C
ENDDO
0019.00 C
SETON
LR
****************** End of data ****************************************
RPG40

RPGLE

USING DISPLY SCREEN (READ,WRITE,UPDATE,DELETE)

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF A E
K DISK
0002.00 FDSPMENU CF E
WORKSTN
0003.02
0004.00 C
EXFMT REC1
0005.00 C CHOICE
CASEQ 'R'
READSR
0006.00 C CHOICE
CASEQ 'W'
WRITESR
0008.00 C CHOICE
CASEQ 'U'
UPDATESR
0009.00 C CHOICE
CASEQ 'D'
DELETESR
0010.00 C
END
0011.04 C
SETON
LR
0011.05
0011.06
0011.07 C READSR
BEGSR
0011.08 C
EXFMT REC2
0011.09 C *IN03
DOWEQ *OFF
0011.10 C EMPNO
SETLL RPGPF4
50
0012.00 C 50
READ RPGPF4

0012.01 C
EXFMT REC2
0012.02 C
ENDDO
0012.03 C
CLEAR
REC2
0017.00 C
ENDSR
0017.01
0018.00 C WRITESR
BEGSR
0019.00 C
EXFMT REC2
0020.00 C *IN03
DOWEQ *OFF
0021.00 C
WRITE EMPREC
0022.00 C
EXFMT REC2
0022.01 C
CLEAR
REC2
0023.00 C
ENDDO
0024.00 C
ENDSR
0025.00
0026.00 C UPDATESR BEGSR
0027.00 C *IN03
DOWEQ *OFF
0027.01 C EMPNO
setll RPGPF4
50
0027.02 C
read rpgpf4
90
0028.00 C
EXFMT REC2
0033.00 C *IN50
IFEQ *ON
0034.00 C
UPDATE EMPREC
0038.00 C
ENDIF
0039.00 C
CLEAR
REC2
0041.00 C
ENDDO
0041.01 C
ENDSR
0042.00
0043.00 C DELETESR BEGSR
0043.01 C *IN03
DOWEQ *OFF
0043.02 C EMPNO
setll RPGPF4
50
0043.03 C
read rpgpf4
90
0043.04 C
EXFMT REC2
0043.05 C *IN50
IFEQ *ON
0043.06 C
DELETE EMPREC
0043.07 C
ENDIF
0043.08 C
CLEAR
REC2
0043.09 C
ENDDO
0058.00 C
ENDSR
****************** End of data ****************************************
RPG41
FILE

RPGLE

READING ALL RECORDSFROM PF THROUGH DSPLY

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
K DISK
0002.00 FDSP
CF E
WORKSTN
0003.00

0004.00 C
EXFMT FORM1
0005.00 C EMPNO
SETLL RPGPF4
0006.00 C
READ RPGPF4
0006.01 C *IN03
DOWEQ *OFF
0007.00 C
EXFMT FORM2
0008.00 C
READ RPGPF4
0008.01 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG42

RPGLE

READ PREVIOUS PF RECORDS FROM DSPLY FILE

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
K DISK
0002.00 FDSP
CF E
WORKSTN
0003.00
0004.00 C
EXFMT FORM1
0005.00 C EMPNO
SETLL RPGPF4
0006.00 C
READP RPGPF4
0007.00 C *IN03
DOWEQ *OFF
0008.00 C
EXFMT FORM2
0009.00 C
READP RPGPF4
0010.00 C
ENDDO
0011.00 C
SETON
LR
****************** End of data ****************************************
RPG43

RPGLE

WRITE RECORS INTO PF FROM DSPLY FILE

*************** Beginning of data *************************************


0001.00 fRPGPF4 O E
DISK
0002.00 fDSP
CF E
WORKSTN IGNORE(FORM1)
0002.01
0003.00 C
EXFMT FORM2
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
WRITE EMPREC
0006.00 C
CLEAR
FORM2
0007.00 C
EXFMT FORM2
0008.00 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG44

RPGLE

UPDATING RECORDS FROM DSPLY FILE

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF A E
K DISK

0002.00 FDSP
CF E
WORKSTN
0002.01
0002.02 C LOOP
TAG
0003.00 C
EXFMT FORM1
0003.01 C EMPNO
SETLL RPGPF4
0004.00 C
READ RPGPF4
0004.01 C *IN03
DOWEQ *OFF
0005.00 C
EXFMT FORM2
0006.00 C
UPDATE EMPREC
0007.00 C
CLEAR
FORM2
0007.02 C
GOTO LOOP
0007.03 C
ENDDO
0008.00 C
SETON
LR
****************** End of data ****************************************
RPG45

RPGLE

DELETING A RECORD FROM DSPLY FILE

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF A E
K DISK
0002.00 FDSP
CF E
WORKSTN
0003.00
0003.01 C LOOP
TAG
0004.00 C
EXFMT FORM1
0005.00 C EMPNO
SETLL RPGPF4
0006.00 C
READ RPGPF4
0007.00 C *IN03
DOWEQ *OFF
0008.00 C
EXFMT FORM2
0009.00 C
DELETE EMPREC
0010.00 C
CLEAR
FORM2
0011.00 C
GOTO LOOP
0012.00 C
ENDDO
0013.00 C
SETON
LR
****************** End of data ****************************************
RPG46

RPGLE

CALL PGM FOR GREATEST OF THREE NO

*************** Beginning of data *************************************


0001.00
0001.01 FDSP
CF E
WORKSTN
0001.02 DRES1
S
10A INZ('NO1 IS GT')
0001.03 DRES2
S
10A INZ('NO2 IS GT')
0001.04 DRES3
S
10A INZ('NO3 IS GT')
0001.05 DRES
S
10A
0001.06
0001.07
0001.08 C PARMLIST PLIST

0001.09 C
PARM
NO1
30
0001.10 C
PARM
NO2
30
0001.11 C
PARM
NO3
30
0001.15 C
PARM
RES
0001.16
0001.17 C
EXFMT FORM3
0001.21 C
CALL 'RPG46A' PARMLIST
0001.23 C
EXFMT FORM3
0001.24 C
SETON
LR
0002.00
0003.00
****************** End of data ****************************************
RPG46A

RPGLE

CALLED PGM FOR GREATEST OF THREE NO(RPG46)

*************** Beginning of data *************************************


0001.00 DRES1
S
10A INZ('NO1 IS GT')
0001.01 DRES2
S
10A INZ('NO2 IS GT')
0001.02 DRES3
S
10A INZ('NO3 IS GT')
0001.03 DRES
S
10A
0001.04
0002.00 C *ENTRY
PLIST
0003.00 C
PARM
NO1
30
0004.00 C
PARM
NO2
30
0005.00 C
PARM
NO3
30
0005.04 C
PARM
RES
0005.05
0007.00 C NO1
IFGT NO2
0008.00 C NO1
ANDGT NO3
0009.00 C
EVAL RES=RES1
0010.00 C
ELSE
0011.00 C NO2
IFGT NO3
0012.00 C
EVAL RES=RES2
0013.00 C
ELSE
0014.00 C
EVAL RES=RES3
0015.00 C
ENDIF
0016.00 C
ENDIF
0016.02 C
RETURN
0018.00
****************** End of data *****************
RPG47

RPGLE

DATA AREA USING IMPLICIT PRINTER FILES

*************** Beginning of data *************************************


0001.00 FQSYSPRT O F 132
PRINTER
0002.00 C *DTAARA
DEFINE
DTA1
80

0003.00 C
IN
DTA1
0004.00 C
MOVE DTA1
SRI1
80
0004.01 C*
OUT
DTA1
0004.02 C
MOVE *DATE
sri2
8
0004.03 C
MOVE *DATE
DTA1
0005.00 C
EXCEPT LINE1
0005.01 c
EXCEPT LINE2
0006.00 C
EVAL *INLR=*ON
0006.01 C
SETON
LR
0007.00
0008.00 OQSYSPRT E
LINE1
0009.00 o
50 'SRINIVAS DATA AREA'
0010.00
0011.00 OQSYSPRT E
LINE2
0012.00 o
sri1
25
0013.00 o
sri2
50
0014.00 o
DTA1
10
****************** End of data ****************************************
RPG48

RPGLE

USING DATAAREA GENERATING NOS

*************** Beginning of data *************************************


0001.00
0002.00 C *DTAARA
DEFINE
DTA3
30
0003.00 C
IN
DTA3
0004.00 C
MOVE DTA3
NO
30
0004.01 C 'DTA3-NO' DSPLY
NO
0005.00 C NO
DO
100
0006.00 C 'NO'
DSPLY
NO
0009.00 C
ENDDO
0010.00 C
SETON
LR
****************** End of data ****************************************
RPG48.1

RPGLE

USING DATAAREA GENERATING NOS

*************** Beginning of data *************************************


0001.00
0002.00 C *DTAARA
DEFINE
DTA3
30
0003.00 C *lock
IN
DTA3
0004.00 C
MOVE DTA3
NO
30
0004.01 C 'DTA3-NO' DSPLY
NO
0005.00 C* NO
DO
100
0005.01 c no
dowle 120
0005.02 c
eval no=no+1
0006.00 C 'NO'
DSPLY
NO
0009.00 C
ENDDO

0009.01 c
move no
dta3
0009.02 c
out
dta3
0009.03 c 'dataara' dsply
dta3
0010.00 C
SETON
LR
****************** End of data ****************************************
RPG48.2

RPGLE

USING DATAAREA GENERATING NOS

*************** Beginning of data *************************************


0001.00 dno
s
3p 0
0002.00 C *DTAARA
DEFINE
dta3
30
0003.00 C*
IN
DTA3
0004.00 C
MOVE DTA3
NO
30
0004.01 C 'DTA3-NO' DSPLY
NO
0005.00 C* NO
DO
100
0005.01 c* no
dowle 100
0005.02 c*
eval no=no+1
0006.00 C* 'NO'
DSPLY
NO
0009.00 C*
ENDDO
0009.01 c*
move no
dta3
0009.02 c*
out
dta3
0009.03 c* 'dataara' dsply
dta3
0010.00 C
SETON
LR
****************** End of data ****************************************

RPG49

RPGLE

USING DATAAREA GENERATING VECHILE NOS

*************** Beginning of data *************************************


0000.01 D TOTAL
S
8A
0001.00 C *DTAARA
DEFINE
DTA5
8
0002.00 C
IN
DTA5
0003.00 C
MOVE DTA5
NUM
8
0004.00 C 'DTA4-NUM' DSPLY
NUM
0004.01 C
MOVEL NUM
RES1
5
0005.00 C
MOVE NUM
RES2
30
0005.01 C
MOVEL RES1
TOTAL
0005.02 C 'RES1'
DSPLY
RES1
0005.03 C 'RES2'
DSPLY
RES2
0006.00 C RES2
DO
110
RES2
0006.01 C
MOVE RES2
TOTAL
0006.02
0007.00 C 'TOTAL'
DSPLY
TOTAL
0008.00 C
ENDDO

0009.00 C
SETON
LR
****************** End of data ****************************************
RPG49.1

RPGLE

USING DATAAREA GENERATING VECHILE NOS

*************** Beginning of data *************************************


0000.01 D TOTAL
S
8A
0001.00 C *DTAARA
DEFINE
DTA5
8
0002.00 C *lock
IN
DTA5
0003.00 C
MOVE DTA5
NUM
8
0004.00 C 'DTA4-NUM' DSPLY
NUM
0004.01 C
MOVEL NUM
RES1
5
0005.00 C
MOVE NUM
RES2
30
0005.01 C
MOVEl RES1
TOTAL
0005.02 c 'total'
dsply
total
0005.03 C 'RES1'
DSPLY
RES1
0005.04 C 'RES2'
DSPLY
RES2
0006.00 C RES2
DOwle 120
0006.01 C
MOVE RES2
TOTAL
0006.02 c
eval res2=res2+1
0006.03 c
move total
dta5
0006.04 c
out
dta5
0006.05 C 'dtaar'
DSPLY
dta5
0006.06 c *lock
in
dta5
0007.01 c
dsply
res2
0008.00 C
ENDDO
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG50

DSGLE

changing dataarea value using dsply screen

*************** Beginning of data *************************************


0001.00 FDSP
CF E
WORKSTN
0001.01 DB
S
8
0001.02 C *DTAARA
DEFINE
DTA5
8
0001.03 C *LOCK
IN
DTA5
0001.04 C
MOVE DTA5
A
8
0002.00 C
EXFMT REGNO
0003.00 C
MOVE B
DTA5
0003.01 C
CLEAR
REGNO
0003.02 C
MOVE DTA5
A
0003.03 C
OUT
DTA5
0004.00 C
EXFMT REGNO
0005.00 C
SETON

****************** End of data ****************************************


RPG51

RPGLE

FILE INFORMATION DATA STRUCTURE FOR RPGPF4

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF E
DISK INFDS(DTA6) INFSR(SRI1SR)
0002.00 DDTA6
DS
0003.00 D A
*STATUS
0004.00 D B
*ROUTINE
0005.00 D C
*OPCODE
0006.00 D D
*FILE
0007.00 C
EXSR SRI2SR
0008.00 C
SETON
LR
0009.00 C
RETURN
0010.00 C SRI1SR
BEGSR
0011.00 C A
DSPLY
0012.00 C B
DSPLY
0013.00 C C
DSPLY
0014.00 C D
DSPLY
0015.00 C
ENDSR
0016.00 C SRI2SR
BEGSR
0017.00 C
READ RPGPF4
0018.00 C
CLOSE RPGPF4
0019.00 C
UPDATE EMPREC
0020.00 C
ENDSR
****************** End of data ***************************************
RPG52

RPGLE

FILE INFORMATION DATA STRUCTURE FOR RPGPF3

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF E
K DISK INFDS(SRIDS) INFSR(SRI1)
0002.00 DSRIDS
DS
0003.00 D A
*STATUS
0004.00 D B
*ROUTINE
0005.00 D C
*OPCODE
0006.00 D D
*FILE
0007.00
0008.00 C
EXSR UPDT
0009.00 C
SETON
LR
0010.00 C
RETURN
0011.00 C SRI1
BEGSR
0012.00 C 'STATUS-ERR' DSPLY
A
0013.00 C 'ROUTINE-ERR' DSPLY
B
0014.00 C 'OPCODE-ERR' DSPLY
C
0015.00 C 'FILE-ERR' DSPLY
D
0016.00 C
ENDSR

0017.00 C UPDT
BEGSR
0018.00 C
READ RPGPF3
0019.00 C
CLOSE RPGPF3
0020.00 C
UPDATE SREC
0021.00 C
ENDSR
****************** End of data *********************************
RPG53

RPGLE

PROGRAM STATUS DATA STRUCTURE

*************** Beginning of data *************************************


0001.00 DPRG53
SDS
0002.00 D A
*STATUS
0003.00 D B
*ROUTINE
0004.00
0004.01 DNO1
S
3P 0 INZ(0)
0005.00 DNO2
S
3P 0 INZ(100)
0006.00 DRES
S
4P 0
0007.00
0008.00 C
EVAL RES= NO2 / NO1
0009.00 C RES
DSPLY
0010.00 C
SETON
LR
0011.00 C *PSSR
BEGSR
0012.00 C 'STATUS' DSPLY
A
0013.00 C 'DIV-ERR' DSPLY
B
0014.00 C
ENDSR
****************** End of data ****************************************
RPG53.1

RPGLE

PROGRAM STATUS DATA STRUCTURE

*************** Beginning of data *************************************


0001.00 DPRG54
SDS
0002.00 D A
*STATUS
0003.00 D B
*ROUTINE
0004.00
0004.01 DNO1
S
3P 0 INZ(0)
0005.00 DNO2
S
3P 0 INZ(100)
0006.00 DRES
S
4P 0
0007.00
0008.00 C
EVAL RES= NO2 / NO1
0009.00 C RES
DSPLY
0010.00 C
SETON
LR
0011.00 C *PSSR
BEGSR
0011.01 c status
ifeq 102
0011.02 c
eval no1=no1+1
0011.03 c
eval res=no2/no1
0012.00 C* 'STATUS' DSPLY
A

0013.00 C* 'DIV-ERR' DSPLY


B
0014.00 C
ENDSR
****************** End of data ****************************************
RPG54

RPGLE

XFOOT OPERATION WITH(PER RECORD) OPERATOR

*************** Beginning of data *************************************


0001.00 D EXP
S
2P 0 DIM(5) CTDATA PERRCD(5)
0002.00 DI
S
4P 0 INZ(0)
0003.00 C
XFOOT EXP
I
0004.00 C I
DSPLY
0005.00 C
SETON
LR
0006.00 C
RETURN
0007.00
0008.00 DATA EXP
0009.00 30405
****************** End of data ****************************************

RPG55

RPGLE

XFOOT OPERATION WITHOUT (PER RECORD) OPERATOR

*************** Beginning of data *************************************


0001.00 D ARY1
S
2P 0 DIM(5) CTDATA
0002.00 D RES
S
3P 0
0004.00 C
XFOOT ARY1
RES
0004.01 C
Z-ADD 1
I
10
0004.02 C I
DOWLE 5
0004.03 C
DSPLY
ARY1(I)
0004.04 C
EVAL I=I+1
0004.05 C
ENDDO
0005.00 C 'RES'
DSPLY
RES
0006.00 C
SETON
0007.00 ** CTDATA ARY1
0008.00 05
0009.00 4
0010.00 1
0011.00 2
0012.00 03
****************** End of data ****************************************
RPG55.1 RPGLE
OPERATOR

XFOOT OPERATION WITHOUT (PER RECORD)

*************** Beginning of data *************************************


0001.00 D ARY1
S
2P 0 DIM(10) CTDATA perrcd(2)
0002.00 D RES
S
3P 0
0004.00 C
XFOOT ARY1
RES
0004.01 C
Z-ADD 1
I
20
0004.02 C I
DOWLE 11
0004.03 C
DSPLY
ARY1(I)
0004.04 C
EVAL I=I+1
0004.05 C
ENDDO
0005.00 C 'RES'
DSPLY
RES
0006.00 C
SETON
0007.00 ** CTDATA ARY1
0008.00 1525
0009.00 1424
0010.00 1121
0011.00 1221
0012.00 1321
****************** End of data ****************************************
RPG56

RPGLE

LOOKUP OPERATOR FOR EMPNO

*************** Beginning of data *************************************


0001.00 D EMPNO
S
3P 0 DIM(5) CTDATA
0002.00 D EMPNAME
S
10A DIM(5) CTDATA
0003.00 D RES
S
3P 0
0004.00 C 'ENTER RES ' DSPLY
RES
0005.00 C EMPNO(RES) LOOKUP EMPNO
0005.01 C RES
DOWLE 5
0006.00 C *IN20
IFEQ *ON
0007.00 C EMPNAME(RES) DSPLY
0007.01 C
EVAL RES=RES+1
0008.00 C
ENDIF
0008.01 C
ENDDO
0009.00 C
SETON
0010.00 C
RETURN
0011.00 ** CTDATA EMPNO
0012.00 001
0013.00 002
0014.00 003
0015.00 004
0016.00 005
0017.00 ** CTDATA EMPNAME
0018.00 SRINIVAS
0019.00 CHAKRI

0020.00 SRI
0021.00 NIVAS
0022.00 VASU
****************** End of data ****************************************
RPG57

RPGLE

LOOKUP FOR SNO

*************** Beginning of data ****************************


0001.00 DSNO
S
3 0 DIM(3) CTDATA
0002.00 DSNAME
S
10 DIM(3) CTDATA
0003.00 DRES
S
3 0
0004.00 C 'ENTER EMPNO' DSPLY
RES
0005.00 C SNO(RES) LOOKUP SNO
0006.00 C SNAME(RES) DSPLY
0007.00
0008.00 C
SETON
0009.00 C
RETURN
0010.00 ** CTDATA SNO
0011.00 001
0012.00 002
0013.00 003
0014.00 ** CTDATA SNAME
0015.00 SRI
0016.00 CHAKRI
0017.00 VASU
****************** End of data ***********************************
RPG58

RPGLE

MOVE ARRAY

*************** Beginning of data ************************************


0001.00 DARY1
S
2 0 DIM(5) CTDATA PERRCD(5)
0002.00 DARY2
S
2 0 DIM(5) CTDATA PERRCD(5)
0003.00 D I
S
10 0 INZ(1)
0004.00
0005.00 C
MOVEA ARY1(1)
ARY2(1)
0006.00 C I
DOWLE 5
0007.00 C ARY2(I)
DSPLY
0008.00 C
EVAL I=I+1
0009.00 C
ENDDO
0009.01 C
SETON
0010.00 ** CTDATA ARY1
0011.00 0120503066
****************** End of data ***************************************

RPG58.1

RPGLE

MOVE ARRAY

*************** Beginning of data *************************************


0001.00 DARY1
S
2 0 DIM(2) CTDATA PERRCD(2)
0002.00 DARY2
S
3 0 DIM(2) CTDATA PERRCD(2)
0003.00 D I
S
10 0 INZ(1)
0004.00
0005.00 C*
MOVEA ARY1(1)
ARY2(1)
0006.00 C I
DOWLE 2
0007.00 C ARY2(I)
DSPLY
0008.00 C
EVAL I=I+1
0009.00 C
ENDDO
0009.01 C
SETON
0010.00 ** CTDATA ARY1
0011.00 1234
0011.01 ** ctdata ary2
0012.00 567892
****************** End of data ****************************************
RPG59

RPGLE

SORT ARRAY

*************** Beginning of data *******************************


0001.00 D ARY1
S
2 DIM(5) CTDATA
0002.00 D I
S
4 0 INZ(1)
0006.00 C
SORTA ARY1
0006.02 C I
DOWLE 5
0006.03 C ARY1(I)
DSPLY
0006.04 C
EVAL I=I+1
0006.05 C
ENDDO
0007.00 C
SETON
0008.00 ** CTDATA ARY1
0009.00 50
0010.00 20
0011.00 60
0012.00 10
0013.00 30
****************** End of data **********************************

RPG60

RPGLE

MOVE ARRAY

*************** Beginning of data *************************************


0001.00 D ARY1
S
2 0 DIM(5) CTDATA
0001.01 D ARY2
S
2 0 DIM(5) CTDATA

0002.00 D I
S
4 0 INZ(1)
0006.00 C
MOVEA ARY1
ARY2
0006.02 C I
DOWLE 5
0006.03 C 'ARY2'
DSPLY
ARY2(I)
0006.04 C
EVAL I=I+1
0006.05 C
ENDDO
0007.00 C
SETON
0008.00 ** CTDATA ARY1
0009.00 50
0010.00 20
0011.00 60
0012.00 10
0013.00 30
****************** End of data ****************************************

RPG61

RPGLE

PRE RUNTIME ARRAY

*************** Beginning of data *************************************


0001.00 FRPGPF4 IT F 28
DISK
0002.00 DARY1
S
28 DIM(8) FROMFILE(RPGPF4)
0003.00 D I
S
2P 0 INZ(1)
0004.00 C
DOW
I<=8
0005.00 C ARY1(I)
DSPLY
0006.00 C
ADD
1
I
0007.00 C
ENDDO
0008.00 C
EVAL *INLR=*ON
0009.00 C
SETON
LR
****************** End of data ****************************************
RPG70

RPGLE

read using SUBFILES RPGPF4

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
DISK
0002.00 FRPGSF CF E
WORKSTN SFILE(FILE1:RRN)
0002.01
0002.02 C
WRITE ENDRECORD
0003.00 C *IN03
DOWEQ *OFF
0003.01 C
SETON
30
0004.00 C
EXFMT CRECORD
0005.00 C
ENDDO
0006.00 C
SETON
LR

0007.00 C
RETURN
0008.00
0009.00 C *INZSR
BEGSR
0010.00 C
Z-ADD 1
RRN
40
0011.00 C
READ RPGPF4
90
0012.00 C *IN90
DOWEQ *OFF
0013.00 C
WRITE FILE1
0014.00 C
READ RPGPF4
90
0015.00 C
ADD
1
RRN
0016.00 C
SETON
11
0017.00 C
ENDDO
0017.01
0018.00 C
ENDSR
****************** End of data ****************************************

RPG71

RPGLE

read using SUBFILES(STUDENTS)

*************** Beginning of data *************************************


0001.00 FRPGPF3 IF E
DISK
0002.00 FRPGSF1 CF E
WORKSTN SFILE(SUBFILE :RRN)
0002.01 C
WRITE SFFOOT
0003.00 C *IN03
DOWEQ *OFF
0003.01 C
SETON
30
0004.00 C
EXFMT SFCONTROL
0005.00 C
ENDDO
0006.00 C
SETON
LR
0007.00 C
RETURN
0008.00 C *INZSR
BEGSR
0009.00 C
Z-ADD 1
RRN
40
0010.00 C
READ RPGPF3
90
0011.00 C *IN90
DOWEQ *OFF
0012.00 C
WRITE SUBFILE
0013.00 C
READ RPGPF3
90
0014.00 C
ADD
1
RRN
0015.00 C
SETON
15
0016.00 C
ENDDO
0017.00 C
ENDSR

RPG72

RPGLE

READING RECORDS FROM RPGPF1

*************** Beginning of data *************************************


0001.00 FRPGPF1 IF E
DISK
0002.00 FRPGSF2 CF E
WORKSTN SFILE(SFR001:RRN)
0003.00 C
WRITE SFF003
0005.00 C *IN03
DOWEQ *OFF
0005.01 C
SETON
50
0006.00 C
EXFMT SFC002
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00 C
RETURN
0011.00 C *INZSR
BEGSR
0012.00 C
Z-ADD 1
RRN
40
0013.00 C
READ RPGPF1
90
0014.00 C *IN90
DOWEQ *OFF
0015.00 C
WRITE SFR001
0016.00 C
READ RPGPF1
90
0017.00 C
ADD
1
RRN
0018.00 C
SETON
25
0019.00 C
ENDDO
0020.00 C
ENDSR
****************** End of data ****************************************
RPG73

RPGLE

WRITING RECORDS INTO RPGPF1(RPGSF2)

*************** Beginning of data *************************************


0001.00 FRPGPF1 O E
DISK
0002.00 FRPGSF2 CF E
WORKSTN SFILE(SFR001:RRN)
0003.00
0003.01 C
SETON
25
0005.00 C *IN03
DOWEQ *OFF
0005.01 C
SETON
111250
0006.00 C
WRITE SFF003
0007.00 C
Z-ADD 1
RRN
40
0008.00 C
EXFMT SFC002
0009.00 C
EXSR READSR
0010.00 C
ENDDO
0011.00 C
seton
lr
0012.00 C readsr
BEGSR
0012.01 C
READC SFR001
90
0013.00 C *IN90
DOWEQ *OFF
0015.00 C
ADD
1
RRN
0016.00 C
WRITE REC1
0016.01 C
READC SFR001
90
0017.00 C
enddo
0018.00 C
endsr
****************** End of data ****************************************

RPG75

RPGLE

WRITING RECORDS INTO RPGPF4(RPGSF4)

*************** Beginning of data *************************************


0001.00 FRPGPF4 O E
K DISK
0002.00 FRPGSF4 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01 DR
S
1A
0002.02 DW
S
1A
0002.03
0010.03
0011.00 C
SETON
15
0011.01 C *IN03
DOWEQ *OFF
0011.03 C
SETON
253545
0011.04 C
WRITE FOOTER
0012.00 C
Z-ADD 1
RRN
40
0013.00 C
EXFMT CONTROL
0013.01 C
EXSR WRITESR
0014.00 C
ENDDO
0015.00 C
SETON
LR
0016.00
0027.00 C WRITESR
BEGSR
0028.00 C
READC SUBFILE
90
0029.00 C *IN90
DOWEQ *OFF
0030.00 C
ADD
1
RRN
0031.00 C
WRITE EMPREC
0032.00 C
READC SUBFILE
90
0033.00 C
ENDDO
0034.00 C
ENDSR
****************** End of data ****************************************
RPG76

RPGLE

READING PF RECORDS (RPGPF4) USING (RPGSF4)

*************** Beginning of data *************************************


0001.00 FRPGPF4 IF E
K DISK
0002.00 FRPGSF4 CF E
WORKSTN SFILE(SUBFILE:RRN)
0003.00
0004.00 C
WRITE FOOTER
0005.00 C *IN03
DOWEQ *OFF
0006.00 C*
SETON
45
0009.00 C
EXFMT CONTROL
0010.00 C
ENDDO
0011.00 C
SETON
LR
0011.01 C
RETURN
0012.00
0013.00 C *INZSR
BEGSR

0013.01 C
Z-ADD 1
RRN
40
0014.00 C
READ RPGPF4
90
0015.00 C *IN90
DOWEQ *OFF
0016.00 C
WRITE SUBFILE
0017.00 C
READ RPGPF4
90
0018.00 C
ADD
1
RRN
0018.01 C
SETON
15
0019.00 C
ENDDO
0020.00 C
ENDSR
****************** End of data ****************************************

RPG77

RPGLE

UPDATING PF RECORDS(RPGPF4) USING (RPGSF4)&TEMP

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF E
DISK
0002.00 FRPGSF4 CF E
WORKSTN SFILE(SUBFILE:RRN)
0003.00
0004.00 C
WRITE FOOTER
0005.00 C *IN03
DOWEQ *OFF
0006.00 C
EXFMT CONTROL
0007.00 C 05
EXSR UPDSR
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00
0011.00 C *INZSR
BEGSR
0012.00 C *LIKE
DEFINE EMPNO
TEMPNO
0012.01 C *LIKE
DEFINE EMPNAME
TEMPNAME
0012.02 C *LIKE
DEFINE ADDRESS
TADDRESS
0013.00 C
Z-ADD 1
RRN
40
0014.01 C
SETON
15
0018.00 C
EXSR LOAD
0019.00 C
ENDSR
0020.00
0021.00 C LOAD
BEGSR
0022.00 C
READ RPGPF4
90
0023.00 C *IN90
DOWEQ *OFF
0024.00 C
WRITE SUBFILE
0025.00 C
READ RPGPF4
90
0026.00 C
ADD
1
RRN
0027.00 C
ENDDO
0028.00 C
ENDSR
0028.01
0029.00 C UPDSR
BEGSR
0031.00 C
READC SUBFILE
60

0032.00 C *IN60
DOWEQ *OFF
0032.01 C
MOVE EMPNO
TEMPNO
0032.02 C
MOVE *BLANKS
TEMPNAME
0032.03 C
MOVEL EMPNAME
TEMPNAME
0032.04 C
MOVE ADDRESS
TADDRESS
0032.05 c rrn
setll rpgpf4
50
0032.06 c 50
read rpgpf4
0033.00 C rrn
CHAIN RPGPF4
0033.01 C
MOVE TEMPNO
EMPNO
0033.02 C
MOVEL *BLANKS
EMPNAME
0033.03 C
MOVE TEMPNAME EMPNAME
0033.04 C
MOVE TADDRESS ADDRESS
0035.00 C 50
UPDATE EMPREC
0036.00 C
READC SUBFILE
60
0037.00 C
ENDDO
0038.00 C
ENDSR
0039.00
****************** End of data ****************************************
RPG78

RPGLE

UPDATING PF RECORDS(RPGPF3) USING (RPGSF5)

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF E
DISK
0002.00 FRPGSF5 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01
0003.00 C
WRITE FOOTER
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
EXFMT CONTROL
0006.00 C 05
EXSR UPDATE
0007.00 C
ENDDO
0008.00 C
SETON
LR
0008.01
0009.00 C *INZSR
BEGSR
0010.00 C
Z-ADD 1
RRN
40
0011.00 C
SETON
15
0012.00 C
EXSR LOAD
0013.00 C
ENDSR
0014.00
0015.00 C LOAD
BEGSR
0016.00 C
READ RPGPF3
90
0017.00 C *IN90
DOWEQ *OFF
0018.00 C
WRITE SUBFILE
0019.00 C
READ RPGPF3
90
0019.01 C
ADD
1
RRN
0020.00 C
ENDDO

0021.00 C
ENDSR
0022.00
0023.00 C UPDATE
BEGSR
0024.00 C
READC SUBFILE
99
0025.00 C *IN99
DOWEQ *OFF
0026.00 C RRN
SETLL RPGPF3
50
0026.01 C 50
READ RPGPF3
0026.02 c RRN
CHAIN SUBFILE
0027.00 C
UPDATE SREC
0028.00 C
READC SUBFILE
99
0029.01 c
enddo
0030.00 C
ENDSR
****************** End of data ****************************************
RPG79

RPGLE

UPDATING PF RECORDS(RPGPF3) USING (RPGSF5)&TEMP

*************** Beginning of data *************************************


0001.00 FRPGPF3 UF E
DISK
0002.00 FRPGSF5 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01
0003.00 C
WRITE FOOTER
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
EXFMT CONTROL
0006.00 C 05
EXSR UPDATE
0007.00 C
ENDDO
0008.00 C
SETON
LR
0008.01
0009.00 C *INZSR
BEGSR
0009.01 C *LIKE
DEFINE SNO
TSNO
0009.02 C *LIKE
DEFINE SNAME
TSNAME
0009.03 C *LIKE
DEFINE CLASS
TCLASS
0009.04 C *LIKE
DEFINE ADDRESS
TADDRESS
0010.00 C
Z-ADD 1
RRN
40
0011.00 C
SETON
15
0012.00 C
EXSR LOAD
0013.00 C
ENDSR
0014.00
0015.00 C LOAD
BEGSR
0016.00 C
READ RPGPF3
90
0017.00 C *IN90
DOWEQ *OFF
0018.00 C
WRITE SUBFILE
0019.00 C
READ RPGPF3
90
0020.00 C
ENDDO
0021.00 C
ENDSR
0022.00

0023.00 C UPDATE
BEGSR
0024.00 C
READC SUBFILE
99
0025.00 C *IN99
DOWEQ *OFF
0025.02 C
MOVE SNO
TSNO
0025.03 C
MOVE *BLANKS
TSNAME
0025.04 C
MOVEL SNAME
TSNAME
0025.05 C
MOVE CLASS
TCLASS
0025.06 C
MOVE ADDRESS
TADDRESS
0025.07 C RRN
SETLL RPGPF3
50
0025.08 C 50
READ RPGPF3
0026.00 C RRN
CHAIN RPGPF3
0026.05 C
MOVE TSNO
SNO
0026.06 C
MOVE *BLANKS
SNAME
0026.07 C
MOVE TSNAME
SNAME
0026.08 C
MOVE TCLASS
CLASS
0026.09 C
MOVE TADDRESS ADDRESS
0027.00 C 50
UPDATE SREC
0028.00 C
READC SUBFILE
99
0029.01 c
enddo
0030.00 C
ENDSR
****************** End of data ****************************************
RPG80

RPGLE

UPDATING PF RECORDS(RPGPF4) USING (RPGSF4)

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF E
DISK
0002.00 FRPGSF4 CF E
WORKSTN SFILE(SUBFILE:RRN)
0003.00
0004.00 C
WRITE FOOTER
0005.00 C *IN03
DOWEQ *OFF
0006.00 C
EXFMT CONTROL
0007.00 C 05
EXSR UPDSR
0008.00 C
ENDDO
0009.00 C
SETON
LR
0010.00
0011.00 C *INZSR
BEGSR
0013.00 C
Z-ADD 1
RRN
40
0014.01 C
SETON
15
0018.00 C
EXSR LOAD
0019.00 C
ENDSR
0020.00
0021.00 C LOAD
BEGSR
0022.00 C
READ RPGPF4
90
0023.00 C *IN90
DOWEQ *OFF
0024.00 C
WRITE SUBFILE
0025.00 C
READ RPGPF4
90

0026.00 C
ADD
1
RRN
0027.00 C
ENDDO
0028.00 C
ENDSR
0028.01
0029.00 C UPDSR
BEGSR
0031.00 C
READC SUBFILE
60
0032.00 C *IN60
DOWEQ *OFF
0032.01 c rrn
setll rpgpf4
50
0032.02 c 50
read rpgpf4
0033.00 C rrn
CHAIN RPGPF4
0035.00 C 50
UPDATE EMPREC
0036.00 C
READC SUBFILE
60
0037.00 C
ENDDO
0038.00 C
ENDSR
0039.00
****************** End of data ****************************************
RPG81

RPGLE

UPDATING PF RECORDS(RPGPF4) USING (RPGSF6)

*************** Beginning of data *************************************


0001.00 FRPGPF4 UF E
DISK
0002.00 FRPGSF6 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01
0003.00 C
WRITE FOOTER
0004.00 C *IN03
DOWEQ *OFF
0005.00 C
EXFMT CONTROL
0006.00 C 04
EXSR delete
0007.00 C
ENDDO
0008.00 C
SETON
LR
0008.01
0009.00 C *INZSR
BEGSR
0010.00 C
Z-ADD 1
RRN
40
0011.00 C
SETON
12
0012.00 C
EXSR LOAD
0013.00 C
ENDSR
0014.00
0015.00 C LOAD
BEGSR
0016.00 C
READ RPGPF4
90
0017.00 C *IN90
DOWEQ *OFF
0018.00 C
WRITE SUBFILE
0019.00 C
READ RPGPF4
90
0019.01 C
ADD
1
RRN
0020.00 C
ENDDO
0021.00 C
ENDSR
0022.00
0023.00 C delete
BEGSR

0024.00 C
READC SUBFILE
99
0025.00 C *IN99
DOWEQ *OFF
0026.00 C RRN
SETLL RPGPF4
50
0026.01 C
READ RPGPF4
0026.02 c RRN
CHAIN SUBFILE
0026.03 C 'OPT'
DSPLY
OPT
0026.04 C 'RRN'
DSPLY
RRN
0026.05 C 'IN50'
DSPLY
*IN50
0027.01 c 50
if
opt = 4
0027.02 C
delete emprec
0027.03 c
endif
0028.00 C
READC SUBFILE
99
0029.01 c
enddo
0030.00 C
ENDSR
****************** End of data ****************************************
RPG82

RPGLE

READ AND WRITE (RPGPF4) IN RPGSF7

*************** Beginning of data *************************************


0001.00 fRPGPF4 IF A E
K DISK
0002.00 fRPGSF7 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01 DR
S
1A
0002.02 DW
S
1A
0003.00
0003.01 C
EXFMT MENU
0003.02 C
SETON
1115
0005.00 C *IN03
DOWEQ *OFF
0006.02 C
Z-ADD 1
RRN
30
0007.01 C
SELECT
0007.02 C R
WHENEQ 'R'
0007.03 C
EXSR READSR
0007.04 C W
WHENEQ 'W'
0007.05 C
EXSR WRITESR
0007.06 C
OTHER
0007.07 C
EXFMT MENU
0008.00 C
ENDSL
0008.01 C
EXFMT CONTROL
0008.02 C
ENDDO
0009.00 C
SETON
LR
0009.01 C
RETURN
0009.02
0010.00 C READSR
BEGSR
0010.02 C
WRITE FOOTER
0011.00 C
READ RPGPF4
90
0012.00 C *IN90
DOWEQ *OFF
0013.00 C
WRITE SUBFILE

0014.00 C
READ RPGPF4
90
0014.01 C
ADD
1
RRN
0016.00 C
ENDDO
0017.00 C
ENDSR
0018.00
0019.00 C WRITESR
BEGSR
0019.01 C
WRITE FOOTER
0019.02 C
SETON
1213
0019.03 C
EXFMT CONTROL
0020.00 C
READC SUBFILE
91
0021.00 C *IN91
DOWEQ *OFF
0021.01 C
ADD
1
RRN
0022.00 C
WRITE EMPREC
0024.00 C
READC SUBFILE
91
0025.00 C
ENDDO
0027.00 C
ENDSR
****************** End of data ****************************************
RPG83

RPGLE

READ AND WRITE (RPGPF4) IN RPGSF7

*************** Beginning of data *************************************


0001.00 fRPGPF4 UF A E
DISK
0002.00 fRPGSF8 CF E
WORKSTN SFILE(SUBFILE:RRN)
0002.01 DR
S
1A
0002.02 DW
S
1A
0002.03 DU
S
1A
0002.04 DD
S
1A
0002.05
0003.01 C
EXFMT MENU
0005.00 C *IN03
DOWEQ *OFF
0005.01 C
SETON
1115
0006.02 C
Z-ADD 1
RRN
30
0007.01 C
SELECT
0007.02 C R
WHENEQ 'R'
0007.03 C
EXSR READSR
0007.04 C W
WHENEQ 'W'
0007.05 C
EXSR WRITESR
0007.06 C U
WHENEQ 'U'
0007.07 C
EXSR UPDATESR
0007.08 C D
WHENEQ 'D'
0007.09 C
EXSR DELETESR
0007.10 C
OTHER
0007.11 C
EXFMT MENU
0008.00 C
ENDSL
0008.01 C
EXFMT CONTROL
0008.02 C
ENDDO

0009.00 C
SETON
0009.01 C
RETURN
0009.02
0010.00 C READSR
BEGSR
0010.02 C
WRITE FOOTER
0011.00 C
READ RPGPF4
0012.00 C *IN90
DOWEQ *OFF
0013.00 C
WRITE SUBFILE
0014.00 C
READ RPGPF4
0014.01 C
ADD
1
RRN
0016.00 C
ENDDO
0017.00 C
ENDSR
0018.00
0019.00 C WRITESR
BEGSR
0019.01 C
WRITE FOOTER
0019.02 C
SETON
0019.03 C
EXFMT CONTROL
0020.00 C
READC SUBFILE
0021.00 C *IN91
DOWEQ *OFF
0021.01 C
ADD
1
RRN
0022.00 C
WRITE EMPREC
0024.00 C
READC SUBFILE
0025.00 C
ENDDO
0027.00 C
ENDSR
0028.00
0029.00 C UPDATESR BEGSR
0031.00 C*
SETON
0032.00 C
READ RPGPF4
0033.00 C *IN89
DOWEQ *OFF
0034.00 C
WRITE SUBFILE
0035.00 C
READ RPGPF4
0036.00 C
ADD
1
RRN
0036.01 C
enddo
0036.03 C
WRITE FOOTER
0036.04 C *IN03
DOWEQ *OFF
0036.05 C
EXFMT CONTROL
0036.06 C 06
EXSR UPDFILE
0036.07 C
ENDDO
0036.08 c
endsr
0036.09
0036.10 C UPDFILE
BEGSR
0038.00 C
READC SUBFILE
0039.00 C *in80
doweq *off
0040.00 c RRN
setll rpgpf4
0041.00 c 50
read rpgpf4
0042.00 c rrn
chain subfile

LR

90
90

1213
91

91

1213
89
89

80
50

0043.00 c 50
update emprec
0044.00 c
readc subfile
80
0045.00 c
enddo
0046.00 c
endsr
0047.00
0048.00 C DELETESR BEGSR
0049.00 C 'DELETESR' DSPLY
0050.00 C
ENDSR
0051.00
****************** End of data ***************************************
RPG84

RPGLE

deleting a record using subfile & Pssr.

0001.00 FRPGPF4 UF A E
DISK
0002.00 FRPGSF9 CF E
WORKSTN SFILE(SUBFILE:RRN) INFSR(*PSSR)
0003.00
0003.03
0005.02 C *IN03
DOWEQ *OFF
0005.03 C
WRITE FOOTER
0006.00 C
SETON
1115
0008.00 C
EXSR READSR
0008.01 C
EXFMT CONTROL
0008.02 C 04
EXSR DELETESR
0008.03 C
ENDDO
0010.00 C
SETON
LR
0010.01
0010.02 C *PSSR
BEGSR
0010.03 C 'IN PSSR' DSPLY
0010.04 C
ENDSR
0010.05
0010.06 C READSR
BEGSR
0013.00 C
READ RPGPF4
90
0014.00 C *IN90
DOWEQ *OFF
0015.00 C
WRITE SUBFILE
0016.00 C
READ RPGPF4
90
0016.01 C
ADD
1
RRN
0016.02 C
ENDDO
0016.04 C
ENDSR
0016.05
0016.06 C DELETESR BEGSR
0016.09 C
READC SUBFILE
80
0016.10 C RRN
DSPLY
0016.11 C *IN80
DOWEQ *OFF
0017.00 C RRN
SETLL RPGPF4
0017.01 C
IF
%FOUND
0017.02 C
READ RPGPF4

0017.03 C RRN
DSPLY
0017.04 C RRN
CHAIN SUBFILE
0018.00 C
IF
OPT=4
0018.01 C RRN
DSPLY
0019.00 C
DELETE EMPREC
0020.00 C
ENDIF
0020.01 C
ENDIF
0020.02 C
READC SUBFILE
80
0021.00 C
ENDDO
0021.01
0021.02 C
SETON
13
0021.03 C
WRITE CONTROL
0021.04 C
SETOFF
13
0021.05 C
MOVE 0
RRN
0022.00 C
ENDSR
0023.00
0024.00
****************** End of data ****************************************
RPG85

RPGLE

load all

*************** Beginning of data *************************************


0001.00 frpgpf5 if e
disk
0002.00 frpgsf10 cf e
workstn sfile(subfile:rrn)
0003.00
0004.00 C
write footer
0005.00 C
exfmt control
0006.00 C
exsr abc
0007.00
0008.00 C abc
begsr
0009.00 C *in03
ifeq *on
0010.00 C
move *on
*inlr
0011.00 C
return
0012.00 C
endif
0013.00 C
endsr
0014.00
0014.01
0015.00 C *inzsr
begsr
0016.00 C
z-add 0
rrn
40
0017.00 C
exsr load
0018.00 C
endsr
0019.00
0019.01 c load
begsr
0020.00 C *in99
doweq *off
0021.00 C
read rpgpf5
99

0022.00 C *in99
ifeq *on
0023.00 C
leave
0024.00 C
endif
0025.00 C
add
1
rrn
0026.00 C
write subfile
0027.00 C rrn
ifeq 9999
0028.00 C
move *on
*inlr
0029.00 C
endif
0030.00 C
enddo
0031.00 C rrn
ifgt 0
0032.00 C
move *on
*in30
0033.00 C
endif
0034.00 C
endsr
****************** End of data ****************************************
RPG86

RPGLE

extended method

*************** Beginning of data *************************************


0001.00 frpgpf5 if e
disk
0002.00 frpgsf10 cf e
workstn sfile(subfile:rrn)
0003.00
0004.00 C
write footer
0005.00 C
exfmt control
0006.00 C
exsr abc
0006.01 C ABC
BEGSR
0007.00 C *in03
ifeq *on
0008.00 C
move *on
*inlr
0009.00 C
return
0010.00 C
endif
0011.00 C *in90
ifeq *on
0012.00 C
MOVE 1
*IN90
0013.00 C
EXSR LOAD
0014.00 C
ENDIF
0015.00 C
ENDSR
0016.00
0017.00 C *INZSR
BEGSR
0018.00 C
Z-ADD 0
RRN
40
0019.00 C
EXSR LOAD
0020.00 C
ENDSR
0021.00
0022.00 C LOAD
BEGSR
0023.00 C
DO
4
0024.00 C
READ RPGPF5
99
0025.00 C *IN99
IFEQ *ON
0026.00 C
LEAVE
0027.00 C
ENDIF

0028.00 C
ADD
1
RRN
0029.00 C
WRITE SUBFILE
0030.00 C RRN
IFEQ 9999
0031.00 C
LEAVE
0032.00 C
ENDIF
0033.00 C
ENDDO
0034.00 C RRN
IFGT 0
0035.00 C
MOVE *ON
*IN30
0036.00 C
ENDIF
0037.00 C
ENDSR
****************** End of data **********************************
RPG87

RPGLE

LOAD ALL METHOD(RPGPF5) WINDOW SUBFILE

*************** Beginning of data *************************************


0001.00 FRPGPF5 IF E
DISK
0002.00 FRPGSF10 CF E
WORKSTN SFILE(SUBFILE:RRN)
0003.00
0003.01 C
WRITE FOOTER
0003.02 C
EXFMT CONTROL
0003.03 C
EXSR ABC
0004.00 C *INZSR
BEGSR
0005.00 C
Z-ADD 0
RRN
40
0007.00 C
EXSR LOAD
0007.01 C
ENDSR
0007.02
0008.00 C LOAD
BEGSR
0009.00 C *IN99
DOWEQ *OFF
0010.00 C
READ RPGPF5
99
0011.00 C *IN99
IFEQ *ON
0012.00 C
LEAVE
0012.01 C
ENDIF
0013.00 C
ADD
1
RRN
0014.00 C
WRITE SUBFILE
0015.00 C RRN
IFEQ 9999
0016.00 C
MOVE *ON
*INLR
0017.00 C
ENDIF
0017.01 C
ENDDO
0017.03 C RRN
IFGT 0
0017.04 C
MOVE *ON
*IN30
0017.05 C
ENDIF
0017.06 C
ENDSR
0023.00
0026.01
0027.00 C ABC
BEGSR
0028.00 C *IN03
IFEQ *ON

0029.00 C
MOVE *ON
*INLR
0030.00 C
RETURN
0031.00 C
ENDIF
0032.00 C
ENDSR
0033.00
****************** End of data ****************************************
RPG88

RPGLE

0001.00 FRPGPF5 IF E
DISK
0002.00 FRPGSF10 CF E
WORKSTN SFILE(SUBFILE:RRN)
0003.00 C
WRITE FOOTER
0004.00 C
EXFMT CONTROL
0005.00 C
EXSR ABC
0006.00 C ABC
BEGSR
0006.01 C *in03
doweq *on
0007.00 C
move *on
*inlr
0008.00 C
return
0009.00 C
endif
0010.00 C *in90
ifeq *on
0011.00 C
move 1
*in90
0012.00 C
exsr load
0013.00 C
endif
0014.00 C
endsr
****************** End of data ***********************************
RUNTIME

RPGLE

RUNTIME ARRAY.

*************** Beginning of data *************************************


0001.00 DARY1
S
4P 0 DIM(10)
0002.00 DI
S
4P 0 INZ(1)
0003.00 C
DOW
I<=10
0004.00 C
DSPLY
ARY1(I)
0005.00 C
EVAL I=I+1
0006.00 C
ENDDO
0006.01 C
0007.00 C
Z-ADD 1
I
0007.01 C
0008.00 C
DOW
I<=10
0009.00 C 'ARY ELS' DSPLY
ARY1(I)
0010.00 C
EVAL I=I+1
0011.00 C
ENDDO
0012.00 C
SETON
LR
****************** End of data ****************************************

TEST1

RPGLE

reading and writing into dataarea

*************** Beginning of data *************************************


0000.01 db
s
20a
0001.00 c *dtaara
define dtaara100 b
0001.01 c
move dtaara100 b
0001.02 c
in
b
0002.00 c
dsply
b
0002.01 c
out
b
0003.00 c
seton
lr
****************** End of data
****************************************