Sie sind auf Seite 1von 23

DISPLAY FILES

Simple display file for Arithmetic operations :


*************** Beginning of data
*************************************************
0001.00 A
CF03(03)
0002.00 A
R DSP2FMT
0003.00 A
4 28'ARTHEMATIC OPERTIONS'
0004.00 A
6 20'1. ADDITION'
0005.00 A
8 20'2.SUBSTRACTION'
0006.00 A
10 20'3.MULTIPLICATION'
0007.00 A
12 20'4.DIVISION'
0008.00 A
15 18'ENTER VALUE FOR A:'
0009.00 A
17 18'ENTER VALUE FOR B:'
0010.00 A
19 20'ENTER U R OPTION:'
0011.00 A
21 20'RESULT IS:'
0012.00 A
23 22'F3=EXIT'
0013.00 A
FLD1
4S 0I 15 40
0014.00 A
FLD2
4S 0I 17 40
0015.00 A
OPT
4S 0I 19 40
0016.00 A
RES
9S 0O 21 35
****************** End of data
****************************************************
RPG PROGRAME FOR ABOVE DISPLAY FILE:
*************** Beginning of data *****************************************
0001.00 Fdsp2
cf e
workstn
0002.00 C
dow
*in03=*off
0003.00 C
clear
dsp2fmt
0004.00 C
exfmt
dsp2fmt
0005.00 C
select
0006.00 C
when
opt=1
0007.00 C
eval
res=fld1+fld2
0008.00 C
exfmt
dsp2fmt
0009.00 C
clear
dsp2fmt
0010.00 C
when
opt=2
0011.00 C
eval
res=fld1-fld2
0012.00 C
exfmt
dsp2fmt
0013.00 C
clear
dsp2fmt
0014.00 C
when
opt=3
0015.00 C
eval
res=fld1*fld2
0016.00 C
exfmt
dsp2fmt
0017.00 C
clear
dsp2fmt
0018.00 C
when
opt=4

0019.00 C
eval
res=fld1/fld2
0020.00 C
exfmt
dsp2fmt
0021.00 C
clear
dsp2fmt
0022.00 C
other
0023.00 C
'invalid opt' dsply
0024.00 C
exfmt
dsp2fmt
0025.00 C
endsl
0026.00 C
enddo
0027.00 C
return
****************** End of data ***************************************
OUTPUT SCREENS WILL BE AS FOLLOWS:

READ FILES FROM PHYSICAL FILE AND DISPLAY ON SCREEN:


PF USING IN DSPLY FILE
*************** Beginning of data *****************
0001.00
A
R RECFMT
0002.00
A
ENO
4S 0
0003.00
A
ENAME
5A
0004.00
A
ESAL
4S 0
0005.00
A
K ENO
****************** End of data ********************
OUTPUT:
ENO ENAME ESAL
000001 102 LUCKY 2,000
000002 103 aaa 3,000
000003 104 ddd
555
000004 105 ggg
142
000005 107 DDD 6,542
000006 1,234 SURI 1,234
****** ******** End of report ********
DISPLAY FILE USING DDS:
Create a display file with name dsp1 in DDS. Following is source..
*************** Beginning of data ************************************
0001.00
A
REF(SURIPAD1/PF1)
0002.00
A
CF03(03)
0021.00
A
R DSPFMT
0022.00
A
4 30'EMPLOYEE DETAILS'
0023.00
A
6 25'EMPLOYEENUMBER:'
0024.00
A
8 25'EMPLOYEENAME:'
0025.00
A
10 25'EMPLOYEESALARY'
0026.00
A
15 25'F3=EXIT'
0027.00
A
ENO
R
B 6 45
0028.00
A
ENAME
R
B 8 40
0029.00
A
ESAL
R
B 10 45
****************** End of data *************************************
RPG PROGRAME FOR DSPLY FILE
*************** Beginning of data
*********************************************
0001.00 Fpf1
if e
disk
0002.00 Fdsp1
cf e
workstn
0003.00 C
read
recfmt
0004.00 C
dow
*in40=*off
0005.00 c
exfmt
dspfmt
0006.00 C
read
recfmt

40
40

0007.00 c
if
*in03=*on
0008.00 C
leave
0009.00 C
endif
0010.00 C
enddo
0011.00 C
eval
*inlr=*on
****************** End of data *************************
OUTPUT SCREENS:

Like above screens all the records in pf will be displays in display screens

WRITING FILES INTO PHYSICAL FILE THROUGH DISPLAY SCREEN:


Create a display file with name dsp1 in DDS. Following is source..
*************** Beginning of
0001.00
A
0002.00
A
0021.00
A
R DSPFMT
0022.00
A
0023.00
A
0024.00
A
0025.00
A
0026.00
A
0027.00
A
ENO
R
0028.00
A
ENAME
R

data ************************************
REF(SURIPAD1/PF1)
CF03(03)
4 30'EMPLOYEE DETAILS'
6 25'EMPLOYEENUMBER:'
8 25'EMPLOYEENAME:'
10 25'EMPLOYEESALARY'
15 25'F3=EXIT'
B 6 45
B 8 40

0029.00
A
ESAL
R
B 10 45
****************** End of data *************************************
Rpg Program For Writing Files Through Display File
*************** Beginning of data **************************************
0001.00 Fpf1
uf a e
disk
0002.00 Fdsp1
cf e
workstn
0003.00 C
exfmt
dspfmt
0004.00 C
dow
*in03=*off
0005.00 C
write
recfmt
0006.00 c
clear
dspfmt
0007.00 c
exfmt
dspfmt
0008.00 C
if
*in03=*on
0009.00 C
leave
0010.00 C
endif
0011.00 C
enddo
0012.00 C
return
****************** End of data *****************************************
By ABOVE code some records are to be inserted in to physical files.

OUTPUT SCREEN:

UPDATING FILES INTO PHYSICAL FILE THROUGH DISPLAY SCREEN


Create a display file with name dsp1 in DDS. Following is source..
*************** Beginning of data ************************************
0001.00
A
REF(SURIPAD1/PF1)
0002.00
A
CF03(03)
0004.00
A
R DSPFMT1
0005.00
A
4 30'EMPLOYEE DETAILS'
0006.00
A
6 25'EMPLOYEE NUMBER:'
0007.00
A
15 25'F3=EXIT'
0008.00
A
ENO
R
B 6 45
0021.00
A
R DSPFMT
0022.00
A
4 30'EMPLOYEE DETAILS'
0023.00
A
6 25'EMPLOYEENUMBER:'
0024.00
A
8 25'EMPLOYEENAME:'
0025.00
A
10 25'EMPLOYEESALARY'
0026.00
A
15 25'F3=EXIT'
0027.00
A
ENO
R
B 6 45
0028.00
A
ENAME
R
B 8 40
0029.00
A
ESAL
R
B 10 45
****************** End of data *************************************
Rpg Program For Updating Files Through Display File

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


********************************************
0001.00 fpf1
uf a e
k disk
0002.00 Fdsp1
cf e
workstn
0003.00 C
dow
*in03=*off
0004.00 C
exfmt
dspfmt1
0005.00 c
eno
setll
recfmt
0006.00 c
if
*in30=*on
0007.00 C
read
recfmt
0008.00 c
exfmt
dspfmt
0009.00 c
update recfmt
0010.00 c
clear
dspfmt
0011.00 C
eval
*in30=*off
0012.00 C
endif
0013.00 C
enddo
0014.00 C
eval
*inlr=*on
****************** End of data
***********************************************

30

OUTSCREENS:

Enter the employee number, which you want to update the details, after
entering the number the following screen will be displayed,

The shown details can be modifying in the above screen, the modified details
are to be stored in the actual physical file.
DELETING FILES IN PHYSICAL FILE THROUGH DISPLAY SCREEN
Create a display file with name dsp1 in DDS. Following is source.
*************** Beginning of data **********************************
0001.00
A
REF(SURIPAD1/PF1)
0002.00
A
CF03(03)
0004.00
A
R DSPFMT1
0005.00
A
4 30'EMPLOYEE DETAILS'
0006.00
A
6 25'EMPLOYEE NUMBER:'
0007.00
A
15 25'F3=EXIT'
0008.00
A
ENO
R
B 6 45
0009.00
A
R DSPFMT2
0010.00
A
4 30'EMPLOYEE DETAILS'
0011.00
A
6 25'EMPLOYEENUMBER:'
0012.00
A
8 25'EMPLOYEENAME:'
0013.00
A
10 25'EMPLOYEESALARY'
0014.00
A
15 25'DELETE:'
0015.00
A
20 25'F3=EXIT'
0017.00
A
ENO
R
B 6 45
0018.00
A
ENAME
R
B 8 40
0019.00
A
ESAL
R
B 10 45
0020.00
A
DFLD
4A B 15 40
****************** End of data ****************************************

Rpg Program For DELETING Files Through Display File


*************** Beginning of data **********************************
0001.00 Fpf1
uf a e
k disk
0002.00 Fdsp1
cf e
workstn
0003.00 C
dow
*in03=*off
0004.00 C
exfmt
dspfmt1
0005.00 C
eno
chain
recfmt
40
0006.00 C
if
*in40=*on
0007.00 C
'recnot found'dsply
0008.00 c
else
0009.00 C
exfmt
dspfmt2
0010.00 C
if
dfld='Y'
0011.00 C
delete recfmt
0012.00 C
clear
dspfmt2
0013.00 C
endif
0014.00 C
endif
0015.00 C
enddo
0016.00 C
eval
*inlr=*on
****************** End of data
**********************************************
OUT PUT SCREENS: Enter the Employee Number which is to delete

After giving delete field as Y the record will be deleted.

SUBFILES:
1. LOAD ALL SUBFILE:
STEP 1:
Physical File (Exmds) Which Is Using In Subfile
*************** Beginning of data ********************
001.00
A
R RECFMT
002.00
A
ENO
5S 0
003.00
A
ENAME
20A
004.00
A
EDEPT
15A
005.00
A
K ENO
****************** End of data **********************
Output for above file is:
ENO
000001
000002
000003

ENAME
EDEPT
1 PADALASURYANARAYANA SSQUAREEE
2 SUNILKUMARDANDE
SSQUARE
3 ARJUNYADAVB
SSQUAREE

000004
4 VEERA PRATAP
000005
5 SAI
000006
6 GOPI
000007
7 LUCKY
****** ******** End of report

REDDY SSQUARE
SSQUARE
SSQUARE
SSQUARE
********

STEP2:
Create a display file for Subfile(sfl):
0003.00
A
DSPSIZ(24 80 *DS3)
0004.00
A
R SFLFMT
SFL
0006.00
A
ENO
R
B 5 7REFFLD(RECFMT/ENO
SURIPAD1/EXMDS)
0007.00
A
ENAME
R
B 5 20REFFLD(RECFMT/ENAME
SURIPAD1/EXMDS)
0008.00
A
EDEPT
R
B 5 46REFFLD(RECFMT/EDEPT
SURIPAD1/EXMDS)
0009.00
A
R CTLFMT
SFLCTL(SFLFMT)
0011.00
A
CF03(03 'exit')
0012.00
A
CF05(05 'refresh')
0013.00
A 20
SFLDSP
0014.00
A 21
SFLDSPCTL
0015.00
A 22
SFLCLR
0016.00
A
SFLSIZ(0050)
0017.00
A
SFLPAG(0010)
0018.00
A
4 8'ENO'
0019.00
A
4 23'ENAME'
0020.00
A
4 51'EDEPT'
****************** End of data
**************************************************
Step 3:
Create RPG program for Load all subfile:
*************** Beginning of data
******************************************
0001.00 FEXMDS
IF E
DISK
0002.00 FSFL
CF e
workstn SFILE(SFLFMT:RRN)
0003.00 DRRN
S
3S 0 INZ(0)
0004.00 C
EXSR
CLRSR
0005.00 C
EXSR
LOADSR
0006.00 C
DOW
*IN03=*OFF
0007.00 C
EXSR
DSPSR
0008.00 C
ENDDO
0009.00 C
EVAL
*INLR=*ON
0010.00 C
CLRSR
BEGSR
0011.00 C
EVAL
*IN22=*ON

0012.00 C
WRITE
CTLFMT
0013.00 C
EVAL
*IN22=*OFF
0014.00 C
ENDSR
0015.00 C
LOADSR
BEGSR
0016.00 C
READ
RECFMT
0017.00 C
DOW
*IN40=*OFF
0018.00 C
EVAL
RRN=RRN+1
0019.00 C
WRITE
SFLFMT
0020.00 C
READ
RECFMT
0021.00 C
ENDDO
0022.00 C
ENDSR
0023.00 C
DSPSR
BEGSR
0024.00 C
EVAL
*IN20=*ON
0025.00 C
EVAL
*IN21=*ON
0026.00 C
EXFMT
CTLFMT
0027.00 C
EVAL
*IN20=*OFF
0028.00 C
EVAL
*IN21=*OFF
0029.00 C
ENDSR
****************** End of data
**********************************************
Output screen for load all subfile:

2. Load Expandable Subfile:


STEP 1:

40

40

Physical File (Pf1a) Which Is Using In Subfile


*************** Beginning of data **************************************
0001.00
A
R REFMT
0002.00
A
ITMID
5S 0
0003.00
A
ITMTYP
5A
0004.00
A
ITMQNT
5S 0
0005.00
A
K ITMID
****************** End of data *****************************************
Output for above file is:
ITMID ITMTYP ITMQNT
000001 101 aaa
1
000002 102 bbb
2
000003 103 ccc
5
000004 106 ddd
5
000005 105 eee
23
000006 107 fff
107
000007 108 ggg
523
000008 109 hhh
109
000009 110 kkk
110
000010 111 iii
111
****** ******** End of report ********
STEP2:
Create a display file for Subfile(SFL1):
*************** Beginning of data
******************************************
0000.01
A
REF(PF1A/SURIPAD1)
0001.00
A
R SFLFMT
SFL
0002.00
A
ITMID
R
B 6 10
0003.00
A
ITMTYP R
B 6 20
0004.00
A
ITMQNT R
B 6 35
0005.00
A
R CTLFMT
SFLCTL(SFLFMT)
0006.00
A 20
SFLCLR
0007.00
A 21
SFLDSP
0008.00
A 22
SFLDSPCTL
0009.00
A
SFLSIZ(100)
0010.00
A
SFLPAG(5)
0011.00
A
2 15'STOCK DETAILS'
0012.00
A
4 10'ITEM ID'
0013.00
A
4 20'ITEM TYPE'
0014.00
A
4 35'ITEM QUANTITY'
0015.00
A
CF03(03)
0016.00
A
CF05(05)
0016.01
A 23
PAGEUP
0016.02
A 24
PAGEDOWN
0016.02
A 24
PAGEDOWN

0017.00
A
OVERLAY
0018.00
A
R FOOTER
0019.00
A
23 15'F3=EXIT'
0020.00
A
23 25'F5=REFRESH'
****************** End of data ************************************
Step 3:
Create RPG program for Load Expandable subfile:
*************** Beginning of data
********************************************
0001.00 FPF1A
IF E
DISK
0002.00 FSFL1sda CF e
workstn SFILE(SFtrec:RRN)
0003.00 DRRN
S
3S 0 INZ(0)
0004.00 C
EXSR
CLRSR
0005.00 C
EXSR
LOADSR
0005.01 C
EXSR
DSPSR
0006.00 C
DOW
*IN03=*OFF
0007.00 C
EXSR
usrSR
0008.00 C
ENDDO
0009.00 C
EVAL
*INLR=*ON
0010.00 C
CLRSR
BEGSR
0011.00 C
EVAL
*IN12=*ON
0012.00 C
WRITE
CTLrec
0013.00 C
EVAL
*IN12=*OFF
0014.00 C
ENDSR
0015.00 C
LOADSR
BEGSR
0016.00 C
READ
REFMT
40
0017.00 C
DOW
*IN40=*OFF
0018.00 C
EVAL
RRN=RRN+1
0019.00 C
WRITE
SFtrec
0020.00 C
READ
REFMT
40
0021.00 C
ENDDO
0022.00 C
ENDSR
0023.00 C
DSPSR
BEGSR
0024.00 C
EVAL
*IN10=*ON
0025.00 C
EVAL
*IN11=*ON
0026.00 C
EXFMT
CTLrec
0027.00 C
EVAL
*IN10=*OFF
0028.00 C
EVAL
*IN11=*OFF
0029.00 C
ENDSR
0030.00 C
USRSR
BEGSR
0031.00 C
DOW
*IN13=*ON
0032.00 C
EVAL
RRN=RRN+1
0033.00 C
EXSR
LOADSR
0034.00 C
EXSR
DSPSR
0035.00 C
EVAL
*IN13=*OFF
0036.00 C
ENDDO
0037.00 C
ENDSR

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


***********************************************
Output screen for load Expandable subfile:

After above screen press PAGEDOWN following screen will appears:

3. Single Page subfile:


STEP1:
Create data Base..
*************** Beginning of data ************************************
0001.00
A
R FORMATE
PFILE(PF112)
0002.00
A
EMPNO
0003.00
A
EMPNAME
0004.00
A
EMPSAL
0005.00
A
K EMPNO
****************** End of data ***************************************
Output:
EMPNO EMPNAME EMPSAL
000001 102 ARJUN
444
000002 135 DSGHJ
222
000003 453 DAGDG
633
000004 245 WQERR
666
000005 5,888 TRUFH
568
000006 56,786 GFTHJ
566
000007 54,546 TDUTF
346
000008 4,578 TEUFU
442
000009 4,832 EYTE
361
000010 54,365 JSYIU
435
000011 47,367 DUTFI
436
000012 796 FDUFH
436
000013 5,578 FDCG
0
000014 46,536 DTFH
246
000015 76,679 RDHGJ
457
000016 367 ETYFI
432
000017 65,178 RTDYG
45
000018 7,556 DFHYK
354
000019 6,468 ETYUH
457
000020 658 YEWUF
896
****** ******** End of report *******

STEP2:
Create a display file for Subfile(SFL1):

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


************************************************
0001.00
A*%%TS SD 20110919 081512 LAKUMA
REL-V5R3M0
5722-WDS
0002.00
A*%%EC
0003.00
A
DSPSIZ(24 80 *DS3)
0004.00
A
R SFLREC
SFL
0005.00
A*%%TS SD 20110906 135250 LAKUMA
REL-V5R3M0
5722-WDS
0006.00
A
EMPNO
R
B 5 13REFFLD(FORMATE/EMPNO
LAKUMA1/LF)
0007.00
A
EMPNAME R
B 5
29REFFLD(FORMATE/EMPNAME LAKUMA1/LF)
0008.00
A
EMPSAL R
B 5 47REFFLD(FORMATE/EMPSAL
LAKUMA1/LF)
0009.00
A
R CTLREC
SFLCTL(SFLREC)
0010.00
A*%%TS SD 20110919 081512 LAKUMA
REL-V5R3M0
5722-WDS
0011.00
A
TEXT('y')
0012.00
A
CF03(03 'exit')
0013.00
A
PAGEUP(06 'pageup')
0014.00
A
PAGEDOWN(07 'page down')
0015.00
A
OVERLAY
0016.00
A 20
SFLDSP
0017.00
A 21
SFLDSPCTL
0018.00
A 22
SFLCLR
0019.00
A
SFLSIZ(0005)
0020.00
A
SFLPAG(0005)
0021.00
A
4 13'empno'
0022.00
A
4 29'empname'
0023.00
A
4 47'empsal'
****************** End of data ***************************************
Step 3:
Create RPG program for Load Expandable subfile:
*************** Beginning of data
****************************************
0001.00 Flf
if e
k disk
0002.00 Fsubfile3 cf e
workstn sfile(sflrec:rrn)
0003.00 Drrn
s
3s 0 inz(1)
0004.00 DPTR
S
5S 0 INZ(1)
0005.00 C
exsr
clrsr
0006.00 C
exsr
loadsr
0007.00 C
exsr
dspsr
0008.00 C
dow
*in03=*off
0009.00 C
exsr
usrsr
0010.00 C
enddo
0011.00 C
eval
*inlr=*on

0012.00
0013.00
0014.00
0015.00
0016.00
0017.00
0018.00
0019.00
0020.00
0021.00
0022.00
0023.00
0024.00
0025.00
0026.00
0027.00
0028.00
0029.00
0030.00
0031.00
0032.00
0033.00
0034.00
0035.00
0036.00
0037.00
0038.00
0039.00
0040.00
0041.00
0042.00
0043.00
0044.00
0045.00
0046.00
0047.00
0048.00
0049.00
0050.00
0051.00
0052.00
0053.00
0054.00
0055.00
0056.00
0057.00
0058.00
0059.00
0060.00
0061.00

C
return
c**********************************************************
C
clrsr
begsr
C
eval
*in22=*on
C
write
ctlrec
C
eval
*in22=*off
C
endsr
c***********************************************************
C
loadsr
begsr
C
EVAL
rrn=1
c
do
5
C
read
formate
C
if
not %eof(lf)
C
write
sflrec
C
eval
rrn=rrn+1
c
endif
c
enddo
C
endsr
c***********************************************************
C
dspsr
begsr
C
eval
*in20=*on
C
eval
*in21=*on
C
exfmt
ctlrec
C
eval
*in20=*off
C
eval
*in21=*off
C
endsr
c***********************************************************
C
usrsr
begsr
* if pressed pageup
C
If
*in06=*on
c
do
10
c
readp
lf
c
if
%eof(lf)
c
leave
c
endif
c
enddo
c
empno
setll
formate
C
exsr
clrsr
c
exsr
loadsr
c
exsr
dspsr
c
endif
* if pressed pagedowm
C
If
*in07=*on
c
empno
setll
formate
C
exsr
clrsr
c
exsr
loadsr
c
exsr
dspsr
c
eval
*in07=*off
c
endif
c
endsr

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


OUTPUT for single page subfile:

After the screen appears.. give PAGEDOWN following screen will appears

After the screen appears.. give PAGEUP following screen will appears

PRINTER FILES:
Printer file using RLU:
-------------------------------------------------- Start of Page 001 -------------------FLD1
<..........>
RCD001
'EMPDETAILS'
FLD1
<...>
<.....>
<...>
RCD003
STUID
STUNAME
STUNO
FLD1
<..>
<...>
<.>
RCD002
9999
XXXXX
999
00004 S
9999
XXXXX
999
00005 S
9999
XXXXX
999
00006 S
9999
XXXXX
999
00007 S
9999
XXXXX
999
00008 S
9999
XXXXX
999
FLD1
<......>
RCD004
'FOOTER'
---------------------------------------------------- End of Report ---------------------RPG Program for above Printer file:

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


********************************************
0001.00 Fpf13
if e
disk
0002.00 Fprint2 o e
printer
0003.00 C
write
RCD001
0004.00 C
write
RCD003
0005.00 C
read
formate
0006.00 C
dow
*in20=*off
0007.00 c
write
RCD002
0008.00 C
read
formate
0009.00 C* STUID
DSPLY
0010.00 C* STUNAME
DSPLY
0011.00 C* STUNO
DSPLY
0012.00 C
enddo
0013.00 C
write
rcd004
0014.00 C
eval
*inlr=*on
****************** End of data
***********************************************

20
20

OUTPUT:
For output compile the rpg program with 14 and call it, then check spooled
files, run the spooled file with option 5, then the following screen will
appears

Printer file using DDS:

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


*************************************************
0001.00
A
REF(PF12)
0002.00
A
R HEADER
0003.00
A
SPACEA(3)
0004.00
A
30'STUDENT DETAILS'
0005.00
A
R SUBHEADER
0006.00
A
SPACEA(2)
0007.00
A
25'STUNO'
0008.00
A
45'STUNAME'
0009.00
A
55'STUM'
0010.00
A
R DATA
0011.00
A
SPACEA(2)
0012.00
A
STUNO
R
25
0013.00
A
STUNAME R
45
0014.00
A
STUM
R
55
0015.00
A
R FOOTER
****************** End of data
****************************************************
RPG Program for above Printer file:
*************** Beginning of data
*******************************************
0001.00 Fpf12
if e
disk
0002.00 Fprint3 o e
printer
0003.00 C
write
HEADER
0004.00 C
write
SUBHEADER
0005.00 C
read
formate
0006.00 C
dow
*in20=*off
0007.00 c
write
DATA
0008.00 C
read
formate
0009.00 C* STUNO
DSPLY
0010.00 C
enddo
0011.00 C
write
FOOTER
0012.00 C
eval
*inlr=*on
0013.00 C
RETURN
****************** End of data
**********************************************

20
20

OUTPUT:
For output compile the rpg program with 14 and call it, then check spooled
files, run the spooled file with option 5, then the following screen will
appears

Das könnte Ihnen auch gefallen