Вы находитесь на странице: 1из 12

Printer File Through O-Spec

Day 14
Printer File Through O-Spec:
Overview:
This module enables the student to understand the concept of Printer File through O-Spec.
Outline:
Topics covered
!P" #ogic $ycle
Output-speci%cation
Printer %le through O-spec
#evel &rea'
Objective:
&y the end of this module the student should be able to(
)PO
!P" logic $ycle
#evel &rea' in printer %les.
* Du'eStar Technologies Pvt. #td. 1+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
RPG Logic Cycle:
RPG/4 logic cycle i! "l!o #nown "! progr"$ cycle% i! " !e&uence o'
!tep! th"t your progr"$ per'or$! 'or e"ch recor( re"()

Follo-ing are the points to be remembered -hen using a logic cycle.
*+ Files are opened automatically.
,+ Files are closed automatically
-+ There is a %rst cycle for the very %rst time and after-ards subse.uent cycles.
4+ The )P indicator is active only for the %rst cycle. )t is o/ after performing step 1 of
logic cycle.
.+ There are 4 types of outputs.
0i1 /e"(er 0 2eader type output contains constant headings such as titles column
heading page number and dates.
0ii1 1et"il ti$e output:- 3t detail time the program calculates and -rites data for
one or more records. 4.g. if a salesman brings four orders and -e print a record
for each order -e are printing four detail records.
0iii1 23ception ti$e output 045ception records are -ritten during calculation time
using 46$PT operation code.
0iv1 Tot"l ti$e output-3t total time the program calculates and -rites data for a
group of related records e.g. if a salesman brings four orders and -e print only
one record that sho-s the total of four order -e are printing one total record.
4+ During the %rst cycle total time calculations and output are not performed.
5+ Those calculations that have a control level indictor 0#1-#71 in position 8 and 9 of
calculation speci%cation are 'no-n as total time calculation and those calculations
-ithout control level indictor in position 8 and 9 of calculation Speci%cations are
'no-n as (et"il ti$e c"lcul"tion)
)n output speci%cation -e are using D in position 1: to denote detail time output
and T in position 17 to denote total time output.
6ote: -
7 progr"$ i! proce!!e( by logic cycle only when it cont"in! " pri$"ry 8le
"n( option"lly one or $ore !econ("ry 8le!) 9' no pri$"ry 8le i! (e8ne(
"n( one or $ore !econ("ry 8le! "re (e8ne( in!i(e the RPG/4 progr"$%
then the 8r!t !econ("ry 8le will wor# "! pri$"ry 8le)
* Du'eStar Technologies Pvt. #td. ,+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
RPG/4 PROGR7: LOG9C C;CL2:

* Du'eStar Technologies Pvt. #td. ;+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
ST3!T
Perform 2eading
3nd
Detail #ine
"et )nput
!ecord
Perform Total
$alculation
Perform
Total Output
#!
O<
4<D OF
P!O"!3=
=O>4 F)4#DS
Perform Detail
$alculation
?4S
<O
1
,
;
4
:
@
8
Printer File Through O-Spec
Day 14
*) 3ll heading and detail lines 02 or D in position 1: of the output speci%cations1
3re processed.
,. The ne5t input record is read and the record identifying and control level indicators
3re set on.
-) Total calculations are processed. They are conditioned by an #1 through #7
Or #! indicator or an #A entry.
4) 3ll total output lines are processed. 0)denti%ed by a T in position 1: of the
Output speci%cations1.
.) )t is determined if the #! indicator is on. )f it is on the program is ended.
4) The %elds of the selected input records are moved from the record to a processing
3rea. Field indicators are set on.
5) 3ll detail calculations are processed 0those not conditioned by control level
)ndicators in positions 8 and 9 of the calculation speci%cations1 on the data
From the record read at the beginning of the cycle.
Fir!t we will !tu(y (i<erent type o' pro$pt u!e( in the Printer File!:
*+ 9P9=
,+ 9P>=
-+ 9PO
4+ 9PP
9P9=:
)6 Speci%cation line is bro'en into follo-ing parts
Positions <ame 4ntry
1-, Page Page number
;-: #ine #ine number
@ Form type )
8-14 !ecord name !ecord format name
1:-19 &lan'
17-,A !ecord )dentifying indicators &lan'
A1-77
#1-#7#!
21-27
B1-B9
!T
,1-84 &lan'
8:-9A $omments Optional
Recor( n"$e: Type the e5ternal name of the record format.
Recor( 9(enti'ying in(ic"tor!: Type a value from A1 to 77 to represent a general
indicator.
* Du'eStar Technologies Pvt. #td. 4+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
9P>=:
C6 Speci%cation line is bro'en into follo-ing parts
Positions <ame 4ntry
8-,A &lan'
,1-;A 45ternal %eld name Field name
;1-:, &lan'
:;-:9 !P" %eld name Field name
:7-@A $ontrol level &lan'
#1-#7
@1-@, =atch %elds &lan'
=1-=7
@;-@4 &lan'
@:-8A Field indictors &lan'
A1-77
21-27
B1-B9
!T
81-84 &lan'
8:-9A $omments Optional
RPG Fiel( 6"$e: Type the name of the %eld as de%ned in the e5ternal record
description 0if si5 characters or fe-er1 or the name that replaces the e5ternal %eld name
de%ned in positions ,1 through ;A.
Control level: Type a value from #1 to #7 if this %eld is a control %eld.
9PO:
O Speci%cation line is bro'en into follo-ing parts
Positions <ame 4ntry
1-, Page Page number
;-: #ine #ine number
@ Form type O
8-14 File name >alid %le name
14-1@ 3<D+O! 3<D or O!
1: Type 2 or D
T
4
1@-19 3DD+D4# 3DD
D4#
1@ Fetch overDo-
!elease
&lan'
F
!
18 Space before A or blan'
1
,
;
19 Space after A or blan'
1
,
;
17-,A S'ip before 1-77
3A-37
&A-&,
,1-,, S'ip after 1-77
* Du'eStar Technologies Pvt. #td. :+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
3A-37
&A-&,
,;-;1 Output indicators &lan'
1-77
E3-E<EP-E?
#1-#7
21-27
B1-B9
O3-O"O>
=!
#!
!T
1P
;,-;8 46$PT name !ecord group name
;9-84 &lan'
8:-9A Optional
Filen"$e: Type the name of the output %le.
Type: $hoose from the follo-ing

*+ / or 1
o Type 2 if you -ant header records or D if you -ant detail records)
,+ T
o Type T if you -ant total records.
-+ 2
o Type 4 if you -ant e5ception records)
Sp"ce/ ?e'ore: Type A or leave the %eld blan' if you -ant no spaces before the
line is printed. Type the number 01,;1 here as much as space you -ant to print
before the line is printed.
Sp"ce/7'ter: Type A or leave the %eld blan' if you -ant no spaces after the line
is printed. Type the number 01,;1 here as much as space you -ant to print
after the line is printed.

S#ip /?e'ore: $hoose from the follo-ing

*) *-@@
o Type a value from 1 to 77 if you -ant to s'ip to a speci%ed line number
before printing a line.
,) 7-7@
o Type a value from 3A to 37 if you -ant to s'ip to a speci%ed line number
bet-een 1AA and 1A7 before printing a line.
-) ?-?,
o Type a value from &A to &, if you -ant to s'ip to a speci%ed line number
bet-een 11A and11, before printing a line.

S#ip /7'ter: $hoose from the follo-ing

*) *-@@
* Du'eStar Technologies Pvt. #td. @+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
o Type a value from 1 to 77 if you -ant to s'ip to a speci%ed line number
after printing a line.
,) 7-7@
o Type a value from 3A to 37 if you -ant to s'ip to a speci%ed line number
bet-een 1AA and 1A7 after printing a line.
-) ?-?,
o Type a value from &A to &, if you -ant to s'ip to a speci%ed line number
bet-een 11A and 11, after printing a line.

6*6,6-: The output record is -ritten if the indicator speci%ed in this %eld is
satis%ed.
2=CPT 6"$e: Type a record group name to specify e5ception records to be
-ritten.
9PP:
P Speci%cation line is bro'en into follo-ing parts
Positions <ame 4ntry
8-,, &lan'
,;-;1 Field output indicators See output indicators
;,-;8 Field name >alid %eld name
F3##
;9 &lan'
;7 &lan' after &lan'
&
4A-84 &lan'
8:-9A Optional
Fiel( 6"$e: Type a valid %eld name chosen from any %eld name previously de%ned in
the program. 3 named constant is also valid here.
2(it Co(e: $hoose from the follo-ing
*) ?l"n#
o #eave the %eld blan' if no edit code is used.
,) *-@% 7-1% >-A% =% ;% B
o Type a value from the above if you -ant numeric %elds Gero-suppressed and
punctuated according to a prede%ned pattern -ithout the use of edit -ords.
2n( Po!ition: $hoose from the follo-ing
*) ?l"n#!% Cnnn% nnnn
o Type one of the above values to de%ne the end position of a %eld or constant
in the output record.
,. D*-DE
o Type a value from E1 to E9 to indicate the length of the format name for a
HO!EST< %le.
* Du'eStar Technologies Pvt. #td. 8+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
Con!t"nt / 2(it For(:
Type a constant a named constant or an edit -ord.
9n(ic"tor! G!e( 9n Printer File!:
Fir!t P"ge 9n(ic"tor H*P+ or intern"l in(ic"tor
This indicator is used for(
Doing %rst page output for printer %le
OverIow 9n(ic"tor HO7-OG% OJ+
These indicators are used for
Doing $onditional calculation on page brea'
Doing $onditional output on page bra'e
Control Level 9n(ic"tor HL*-L@+
7 These )ndicators are used for(
De%ning various $ontrol &rea's
Doing $onditional $alculations
Doing $onditional Output

Printer File Through RPG Logic Cycle:
11S For The 1"t" ?"!e FileHS7L2+:
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> SALE
FMT A .....A. 1 ...!... " ...!... # ...!... $ ...!... % ...!... & ...!... 7
B'(innin( o) d*t*
0000.01
0000.0" SALES MASTE+
0000.0#
000".00 A + SALE+
000#.00 A C,- 10 C,L.D/01C,U-T+Y -AME12
000$.00 A STA 10 C,L.D/01STATE -AME12
000%.00 A CTY 10 C,L.D/01C3TY -AME12
000&.00 A 4TY 10 C,L.D/01T,ATAL 4TY S,LD12
0007.00 A 5 C,-
0006.00 A 5 STA
0007.00 A 5 CTY
End o) d*t*





F#=E8it F$=P9om:t F%=+')9's; F7=+'t9i'<' F10=Cu9so9 F11=To((l'
F1&=+':'*t )ind F17=+':'*t =;*n(' F"$=Mo9' >'?s

* Du'eStar Technologies Pvt. #td. 9+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
Cre"te " Printer File ?y G!ing the Co$$"n( Cre"te Printer File
HCRTPRTF+
CRTPRTF F9L2HP?*G*/PR96T*+ P7G2S9B2H44 E+ OJRFLFH4+
C9'*t' P9int'9 Fil' 0C+TP+TF2

T?:' =;oi='s@ :9'ss Ent'9.

Fil' . . . . . . . . . . . . . . > P+3-T1 -*m'
LiA9*9? . . . . . . . . . . . > PB01U01, -*m'@ CU+L3B
Sou9=' )il' . . . . . . . . . . -,-E -*m'@ -,-E
LiA9*9? . . . . . . . . . . . -*m'@ L3BL@ CU+L3B
Sou9=' m'mA'9 . . . . . . . . . F3LE -*m'@ F3LE
/'n'9*tion s'<'9it? l'<'l . . . "0 0B#0
Fl*((in( s'<'9it? l'<'l . . . . 0 0B#0
D'<i=':
P9int'9 . . . . . . . . . . . C,B -*m'@ C,B@ SYSDAL
P9int'9 d'<i=' t?:' . . . . . . SCS SCS@ 3PDS@ L3-E...
T'8t 1d's=9i:tion1 . . . . . . . S+CMB+TET





Mo9'...
F#=E8it F$=P9om:t F%=+')9's; F10=Addition*l :*9*m't'9s F1"=C*n='l
F1#=.oF to us' t;is dis:l*? F"$=Mo9' >'?s

Pre!! P"ge 1own
C9'*t' P9int'9 Fil' 0C+TP+TF2

T?:' =;oi='s@ :9'ss Ent'9.


Addition*l P*9*m't'9s

P*(' siG':
L'n(t;BBlin's :'9 :*(' . . . . > && .001B"%%.000
Hidt;BB:ositions :'9 lin' . . > 60 .001B#76.000
M'*su9'm'nt m't;od . . . . . . +,HC,L +,HC,L@ U,M
,<'9)loF lin' numA'9 . . . . . . > &0 1B"%%








Bottom
F#=E8it F$=P9om:t F%=+')9's; F10=Addition*l :*9*m't'9s F1"=C*n='l
F1#=.oF to us' t;is dis:l*? F"$=Mo9' >'?s

* Du'eStar Technologies Pvt. #td. 7+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
RPG Progr"$ For Printer File in O-SpecHProgr"$ Cycle+:
Columns . . . : 1 71 Edit PB01U01S/MY+P/
SEU==> L,/CLE
FMT FE .....FFil'n*m'3PEAF........L..3........D'<i='!......5E8it!!Ent9?!A....U
B'(innin( o) d*t*
0001.00 FSALE 3P E 5 D3S5
000".00 FP+3-T1 , F 60 ,A P+3-TE+
000".01 3P3E P+,MPT
000".0" 01 3S T.E +EC,+D 3DE-T3FY3-/ 3-D3CAT,+ DEF3-ED F,+ +EC,+D
000".0# F,+MAT 1SALE+1 ,F P.YS3CAL F3LE SALE
000".0$ H.E- EDE+ T.E +EC,+D 3S +EAD F+,M P.YS3CAL F3LE 3T SETS
000".0% ,- AUT,MAT3CALLY
000#.00 3SALE+ 01
000#.01 3P, P+,MPT
000#.0" T, P+3-T T.E .EADE+ ,F T.E +EP,+T
000#.0#
000$.00 ,P+3-T1 . 11 1P
000%.00 , ,+ ,A
000&.00 , %0 1SALES +EP,+T1
0007.00 , &% 1PA/E:1
0006.00 , PA/E &7
0007.00 ,P+3-T1 . 11 1P
0010.00 , ,+ ,A
0011.00 , %0 1============1
001".00 ,P+3-T1 . 11 1P
001#.00 , ,+ ,A
001$.00 , 10 1C,U-T+Y1
001%.00 , #0 1STATE1
001&.00 , %0 1C3TY1
001&.01 , 70 1SALES1
001&.0" DETA3L T3ME ,UTPUT
0017.00 ,P+3-T1 D 11 01
0017.01 3PP
0017.0" , C,- 1%
0016.00 , STA #%
0017.00 , CTY %%
00"0.00 , 4TY 7%
End o) d*t*


F#=E8it F$=P9om:t F%=+')9's; F7=+'t9i'<' F10=Cu9so9 F11=To((l'
F1&=+':'*t )ind F17=+':'*t =;*n(' F"$=Mo9' >'?s

* Du'eStar Technologies Pvt. #td.
1A+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
RPG Progr"$ For Printer File in O-SpecHG!er controlle( Logic
Cycle+:
Columns . . . : 1 71 Edit PB01U01S/MY+P/
SEU==> USE+CYC
FMT FE .....FFil'n*m'3PEAF........L..3........D'<i='!......5E8it!!Ent9?!A....U
B'(innin( o) d*t*
0001.00 FSALE 3F E 5 D3S5
000".00 FP+3-T1 , F 60 ,A P+3-TE+
000".01 C EECPT.ED1
000".0" C EECPT.ED"
000".0# C EECPT.ED#
000".0$ C +EAD SALE 70
000".0% C 3-70 D,HE4,FF
000".0& C EECPTDETA3L
000".07 C +EAD SALE 70
000".06 C E-DD,
000".07 C SET,- L+
000".10 3P, P+,MPT
000$.00 ,P+3-T1 E 11 .ED1
000&.00 , %0 1SALES +EP,+T1
0007.00 , &% 1PA/E:1
0006.00 , PA/E &7
0007.00 ,P+3-T1 E 11 .ED"
0011.00 , %0 1============1
001".00 ,P+3-T1 E 11 .ED#
001$.00 , 10 1C,U-T+Y1
001%.00 , #0 1STATE1
001&.00 , %0 1C3TY1
001&.01 , 70 1SALES1
001&.0" DETA3L T3ME ,UTPUT
0017.00 ,P+3-T1 E 11 DETA3L
0017.01 3PP
0017.0" , C,- 1%
0016.00 , STA #%
0017.00 , CTY %%
00"0.00 , 4TY 7%
End o) d*t*




F#=E8it F$=P9om:t F%=+')9's; F7=+'t9i'<' F10=Cu9so9 F11=To((l'
F1&=+':'*t )ind F17=+':'*t =;*n(' F"$=Mo9' >'?s

2=CPT: 46$PT opcode -rites record during calculation time and it also facilitates
a variable number of records to be -ritten in one program cycle at either detail
calculation or total calculation time. 3n 4 in position 1: of output spec identi%es
e5ception records.
* Du'eStar Technologies Pvt. #td.
11+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Printer File Through O-Spec
Day 14
Level ?re"# 9n Printer File:
Columns . . . : 1 71 Edit PB01U01S/MY+P/
SEU==> B+EA5
FMT FE .....FFil'n*m'3PEAF........L..3........D'<i='!......5E8it!!Ent9?!A....U
B'(innin( o) d*t*
0001.00 FSALE 3P E 5 D3S5
000".00 FP+3-T1 , F 60 ,A P+3-TE+
000".01 3P3E P+,MPT
000".0" 3SALE+ 01
000".0# 3 C,- L#
000".0$ 3 STA L"
000".0% 3 CTY L1
000".0& F,+ EDE+Y +EC,+D +EAD ADD 4UA-T3TY T, C3TY 4UA-T3TY
000".07 C ADD 4TY C4TY 70
000".06 H.E- C3TY C.A-/ES ADD C3TY 4UA-T3TY T, STATE 4UA-T3TY
000".07 CL1 ADD C4TY S4TY 70
000".11 H.E- STATE C.A-/ES ADD STATE 4UA-T3TY T, C,U-T+Y 4UA-T3TY
000".1" CL" ADD S4TY CU4TY 70
000".1# H.E- C,U-T+Y C.A-/ES ADD C,U-T+Y 4UA-T3TY T, -ET 4UA-T3TY
000".1$ CL# ADD CU4TY T4TY 70
000#.01 3P, P+,MPT
000#.0" T, P+3-T T.E .EADE+ ,F T.E +EP,+T
000#.0#
000$.00 ,P+3-T1 . 11 1P
000%.00 , ,+ ,A
000&.00 , %0 1SALES +EP,+T1
0007.00 , &% 1PA/E:1
0006.00 , PA/E &7
0007.00 ,P+3-T1 . 11 1P
0010.00 , ,+ ,A
0011.00 , %0 1============1
001".00 ,P+3-T1 . 11 1P
001#.00 , ,+ ,A
001$.00 , 10 1C,U-T+Y1
001%.00 , #0 1STATE1
001&.00 , %0 1C3TY1
001&.01 , 70 1SALES1
001&.0" DETA3L T3ME ,UTPUT
0017.00 ,P+3-T1 D 11 01
0017.01 3PP
0017.0" , C,- 1%
0016.00 , STA #%
0017.00 , CTY %%
00"0.00 , 4TY $ 7%
00"1.00 H.E- C3TY C.A-/ES P+3-T C3TY T,TAL
00"".00 ,P+3-T1 T 11 L1
00"#.00 , $0 1C3TY T,TAL1
00"#.01 , C4TY $B &0
00"$.00 H.E- STATE C.A-/ES P+3-T STATE T,TAL
00"%.00 ,P+3-T1 T 11 L"
00"&.00 , $0 1STATE T,TAL1
00"&.01 , S4TY $B &0
00"7.00 H.E- C,U-T+Y CA-/ES P+3-T C,U-T+Y T,TAL
00"6.00 ,P+3-T1 T 11 L#
00"7.00 , $0 1C,U-T+Y T,TAL1
00"7.01 , CU4TY $B &0
00#0.00 AFTE+ ALL +EC,+DS P+,CESSED@P+3-T T.E -ET T,TAL
00#1.00 ,P+3-T1 T 11 L+
00#".00 , $0 1-ET T,TAL1
00##.00 , T4TY $ &0
End o) d*t*

F#=E8it F$=P9om:t F%=+')9's; F7=+'t9i'<' F10=Cu9so9 F11=To((l'
F1&=+':'*t )ind F17=+':'*t =;*n(' F"$=Mo9' >'?s

* Du'eStar Technologies Pvt. #td.
1,+1,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.

Вам также может понравиться