Professional Documents
Culture Documents
Sub)ile /ey0ords
The follo;ing =ey;ords are defined in the su)file control record format and are attri)uted to all
the record for the su)file.
%(" %ubfile 0ecor& (ormat
Identifies the named record format as a su)file record format
%"(C"0 %ubfile clear
6sed to indicate that ;hen the associated indicator is set on the ne<t output operation to the
su)file record format to clear all the record of the su)file.
%("C," %ubfile control recor& format
Identifies the named record format as the su)file control record format
%("'", 'elete subfile
6sed to indicate that ;hen the associated indicator is set on the ne<t output operation to the
su)file record format is to delete the su)file. The su)file ;ould therefore )e inacti"e.
%("'0O %ubfile &rop
6sed to indicate that ;hen the associated command =ey is pressed> the secondary line$s' of a
multiple line of su)file record are to )e displayed. 6pon the first output operation of the su)file>
only the first line of each su)file record ;ould )e displayed.
%("'% 'ispla! subfile
6sed to indicate that ;hen the associated indicator is set on> the su)file is to )e displayed upon
the ne<t output operation.
%("'%C," 'ispla! subfile control
6sed to indicate that the associated indicator is set on> the su)file record format is to )e
displayed upon the ne<t output operation.
%("EN' %ubfile en&
6sed to indicate that ;hen the associated indicator is sent on> the constant MMore]N normally
displayed at the )ottom of the e"ery multi-page su)file is suppressed. This condition is e<ercised
;hen there are no more su)file records to )e displayed.
%("INE InitialiLe subfile
6sed to indicate that ;hen the associated indicator is set on> the ne<t output operation to the
su)file is to initialise all the alphanumeric "aria)le in the su)file record to )lan=s and all the
numeric "aria)le to Feros in e"ery record for the su)file.
%(""IN %ubfile line
6sed to specify the num)er of su)file records that should )e displayed in the line of display
%(")%@ %ubfile messa$e
6sed to associate an error message ;ith an error condition at the su)file control record le"el
%("A@ %ubfile pa$e
6sed to specify the num)er of su)file records to )e displayed in one page of display
%("0C'NB0 %ubfile recor& number
02 of %4&
6sed to associate a "aria)le name ;hich ;ould contain the "alue of a "alid su)file relati"e
record num)er. The page of the su)file containing the record ;hose relati"e record num)er is
present in this "aria)le ;ould )e displayed upon the ne<t output operation to the su)file.
%("0NA %ubfile not active
6sed to specify that the named su)file record format is to )e made inacti"e. .hen used in
association ;ith the initialise su)file $S!3I9B' =ey;ord> this has the effect of deleting the
su)file.
%("0O"FA" %ubfile roll value
6sed to specify the num)er of records that are to )e paged up/do;n ;hen the &oll 6p/&oll
1o;n =eys are used
%("%IE %ubfile siLe
6sed to specify the ma<imum num)er of records that are to displayed in a su)file at a time. The
follo;ing =ey;ord is the only =ey;ord that is applica)le at the su)file record. Thus this
=ey;ord> may )e applica)le or not to indi"idual records in the su)file.
%(" %ubfile recor& format
Identifies the named record format as a su)file record format
%("NI,CC@ %ubfile next chan$e& recor&
%ssociate an indicator ;ith this =ey;ord. This indicator may )e set on/off indi"idually for each
record in the su)file. If this indicator set on> then the modified data tag for the associated su)file
record is set on. In this case> the su)file record can )e pic=ed )y a &+%17 operation ;ithin the
program.
Sub)ile !ata !escription Speci)ication :
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! (isplay ,ile for LO(-LL-S.0,IL-S !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
" #$%$I&'2( )* !#$+,
" -"*+'*+ .E/IT.,
" 0 $FL0E- $FL
" -1$"# 0 2 ) 310EFFL#'0-1$T4-1$"# 526FLI734-1$T,
" -1$89 0 2 ) 1:0EFFL#'0-1$T4-1$89 526FLI734-1$T,
" -1$82 0 2 ) +0EFFL#'0-1$T4-1$82 526FLI734-1$T,
" 0 $FL-TL $FL-TL'$FL0E-,
" 2;E0L"<
" $FL#$%
" $FL#$%-TL
" 1* $FL-L0
" 2* $FLE8#'!920E,
" $FL$I&'**13,
" $FL%"5'**1(,
" 1 2*. =206 $-0EE8 F20 -1$T29E0 E8>1I0<.
" 1 +1$E0
" 1 ??#"TE
" E#T-#E'<,
" 3 (.-1$T 8197E0.
" 3 1@.-1$T29E0 8"9E .
" 3 3(.-1$T29E0 "##0E$$.
" 0 F22TE0
" 2;E0L"<
" 2( +.F+ A E/IT.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -nd of data !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!
0$ of %4&
Handling Sub)iles in -P6 Programs
'ile !eclarations
The 1isplay file is declared as file in the file specification. 1etails that are
included are
9ame of the display file
Type ;hich is M7N and 1esignation M3N to indicate com)ined 3ully procedural
file
1e"ice definition ;hich is M.O&:ST9N to indicate a display file
In the 7ontinuation specification of the file specification> a "aria)le name is
identified as the su)file relati"e record num)er ;ith the follo;ing &#? reser"ed ;ord
&&9C& :S3I!+ S6C3I!
In the a)o"e e<ample> a su)file record format S6C3I! ;ith a relati"e record num)er
&&9C& is declared.
+<ample:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0eginning of data !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! -1ample for ,ile specification !
! %hsical File - -1$T !
! #ispla File - $FL-1$ !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
F-1$T IF E 6 #I$6
F$FL-1$ -F E =206$T8
F -218T 6$FILE $FL0E-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -nd of data !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Calculation Speci)ication
.ithin the M7N specification itself> there ;ould not )e any reference in the display
file name.
%ll references ;ould )e to particular record formats only.
Indi"idual record formats may )e returned or read from the screen
If an output operation is done> $that is .&IT+ or related operation' the display is
sent to the screen.
If an input operation is done> $that is> &+%1 or related operation' the display is
read from the screen and the displayed data is made a"aila)le to the program. %t
this point the control passes to the program.
Steps Involved In Sub)ile Programming :
I9ITI%!IB+ - InitialiFe the &&9 to Bero.
7!+%& - Set On the S3! clear indicator> clear S3!7T!> ;rite the
S3!7T! V setoff the Indicator
C6I!1 - !oad the su)file )y reading the #3 V ;riting the Su)file
record
3ormat.
1IS#!%G - Set on the S3!1S#7T! indicator V +A3MT the S3!7T!
#&O7+SS - #rocess 7hanged &ecords 6sing &+%17 or 7@%I9
opcodes
04 of %4&
3ulti page sub)iles:
There are three options for managing a multipage su)file:
,. !oad all Su)file
-. +<panding Su)file $%dding a page at a time.
8. Single page Su)file
Sub)ile &oad (ptions, Pros and Cons4
Subfile Load
Option
Code Issues User Issues
,. !oad all su)file
Simplest code
!imit of ((((
records
6ser has to ;ait until entire file is
loaded.
1ata is only updated ;hen a user ma=es
a change that reEuires reloading the
su)file
7hanges made to the data )y other users
or other programs after the su)file is
loaded ;ill not )e apparent.
-.+<panding su)file
7ode is more
comple<.
!imit of ((((
records.
Crief delay ;hene"er a page is loaded.
#ages added ;hen the #age 1o;n =ey is
pressed are updated at the time they are
added to the su)file. @o;e"er >
su)seEuent changes to the data made )y
other users or #rograms are not
displayed until a user ma=es a change
that reEuires reloading the su)file.
8. Single #age Su)file
Most complicated
7ode .
6se least
memory.
9o SiFe limit.
Crief delay ;hene"er the page up =ey
or #age do;n =ey is pressed.
1ata is al;ays updated at the time of
processing a page up/#age do;n
reEuest.
&oad all Sub)ile:
The first method of loading a su)file is to load all of the records that you ;ant to display into
the su)file at one time. %fter this load is complete you can display the su)file> ;hich gi"es the
users access to all of the su)file records )y allo;ing them to roll )ac=;ards and for;ards. +"ery
record that you ;ant to display must )e loaded into the su)file )efore displaying the su)file.
Sometimes you may only load a fe; records into the su)file> other times you might load
hundreds. Cut for the load-all su)file method> you simply load e"ery record in )efore you display
the su)file.
!oading the su)file is accomplished )y ;riting the su)file records to the su)file format. Once
e"ery record has )een loaded> you can display the su)file )y ;riting the su)file control format.
0. of %4&
The su)file itself handles the roll =eys> and you donNt e"en ha"e to ma=e reference of them in
either the &#? program or the 11S specifications for the display file.
%UB(I"E A@E = %UB(I"E %IEE
O0
%UB(I"E %IEE 6 %UB(I"E A@E M -+
Ph2"ical file 9e"t:
A =F6A=.
A 0 9S90.1
A 14D. %
A FAM. #0
A A7. #P 0
A P84F. 10P 0
A I 14D.
A>>>>>>>>>>>>>>>
A S'!file for <oa) All:
A>>>>>>>>>>>>>>>
A 0 DS-01D S-<
A>RR9S SD #0040#0% 0%1411 09AM6< 0.<(K?01M0 ?@##(WDS
A 14D. 0 4 ? 40.--<D(9S90.1/14D. 09AM6</9.S9)
A FAM. 0 4 ? 1#0.--<D(9S90.1/FAM. 09AM6</9.S9)
A A7. 0 4 ? %%0.--<D(9S90.1/A7. 09AM6</9.S9)
A P84F. 0 4 ? 430.--<D(9S90.1/P84F. 09AM6</9.S9)
A 0 DS-19< S-<19<(DS-01D)
A>RR9S SD #0040#0% 0%4?04 09AM6< 0.<(K?01M0 ?@##(WDS
A S-<S6G(001?)
A S-<PA7(0014)
A 1-0%(0%)
A 1-0?(0?)
A 4K.0<A5
A &0 S-<DSP
A &1 S-<DSP19<
A &% S-<1<0
A &4 S-<.FD(>M40.)
A 1 #&B<oa) All S'!file ./ampleB
A DSPA90(=<)
A # %0B-or Demo P'rpo"e 4nl2B
A DSPA90(:<)
A DSPA90(=<)
A 4 4B1o)eB
A DSPA90(=<)
A 4 1#BFameB
A DSPA90(=<)
A 4 %%BAgeB
A DSPA90(=<)
A 4 43BPhoneB
A DSPA90(=<)
9he following i" the )i"pla2 file for loa) all "'!file".
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> B246;;6;4 <3 1.A. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> ./ample for .CPAFD6F7 S=:-6<. >
> Ph2"ical -ile ( 9.S9 >
> Di"pla2 -ile ( 9.S9DSP
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>
RP" =?<4?.: 3<? 9<.1 .99 @B/3692@
-9.S9 6- . I D6SI
-9.S9DSP 1- . W40IS9F
0* of %4&
- S-<00FIS-6<. DS-01D
1>
1 .CS0 6FGS0
1 .CS0 :<DS0
1 .CS0 DSPS0
1 S.94F <0
1>
1 6FGS0 :.7S0 //1lear "'!file
1 G(ADD>G.04S S-<00F 40
1 S.94F &% 1<0S-<
1 W069.DS-19<
1 S.94- &%
1 .FDS0
1>
1 DSPS0 :.7S0
1 S.94F &0&1 //Di"pla2 "'!file
1 >6F0% D4=.AB1B
1 W069.S-<-90
1 .C-M9DS-19<
1 >6F0% 6-.A B0B
1 >6F0? 6-.A B1B
1 .CS0 :<DS0
1 .FD6-
1 .FD6-
1>
1 .FDD4
1 .FDS0
1>
1 :<DS0 :.7S0 //:'il) S'!file
1 ><4KA< S.9<<9S90.1
1 0.AD 9S90.1 &4
1 >6F&4 D4W.AB0B
1 ADD 1 S-<00F
1 W069.DS-01D
1 0.AD 9S90.1 &4
1 .FDD4
1 .FDS0
>>>>>>>>>>>>>>>>>>>>>>>>>>> E;1 >>>>>>>>>>>>>>>>>>>
07 of %4&
E1panding Sub)ile:
The second method of loading a su)file is to start )y loading a specific num)er of records
into the su)file. Gou can then display the su)file to the user. If the information the user needs is
not currently loaded into the su)file> your program can load more su)file records )ehind those
already loaded. This techniEue is =no;n as an e<panding su)file.
If the user rolls for;ard $&O!! 6#'> then the su)file automatically s;itches the display to
su)file page t;o for you. @ere you ha"e to set the indicator for &O!! 6# =ey;ord in 11S and
handle it in the &#? program. &O!! 1O.9$#age 6p' is automatically ta=en care )y the
system.
One ad"antage of e<panding su)file o"er a load-all-su)file is that the su)file is displayed to the
user in a "ery sta)le amount of time> depending on ho; many records the program loads. .ith
the e<panding su)file> you can di"ide the load process into a fi<ed num)er of records. 3or
instance> suppose you load si< records at a time in an e<panding su)file> It ;ould not matter if
there ;ere a possi)ility of loading 4>000 records into the su)file> your program ;ould only load
si< records )efore it displays the su)file to the user. This method displays the screen to the user
"ery Euic=ly.
%UB(I"E A@E == %UB(I"E %IEE+
The follo;ing is the 11S code for display file $+<panding Su)file'
A> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A> > E*PANDIN" SUBFILES DA9. ( 1%/0?/1&&&. >
A> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A S'!file for ./pan)ing S'!file:
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A 0 DS-01D1 S-<
A 14D. 0 4 ? 40.--<D(9S90.1/14D. 09AM6</9.S9)
A FAM. 0 4 ? 1#0.--<D(9S90.1/FAM. 09AM6</9.S9)
A A7. 0 4 ? %%0.--<D(9S90.1/A7. 09AM6</9.S9)
A P84F. 0 4 ? 430.--<D(9S90.1/P84F. 09AM6</9.S9)
A 0 DS-19<1 S-<19<(DS-01D1)
A>RR9S SD #0040#0% 0%4344 09AM6< 0.<(K?01M0 ?@##(WDS
A SFLSIZ(##15)
A SFLPA"(###')
A 1-0%(0%)
A 1-0?(0?)
A 04<<=P(03)
A 4K.0<A5
A &0 S-<DSP
A &1 S-<DSP19<
A &% S-<1<0
A &4 S-<.FD(>M40.)
A 1 #&B./pan)ing S'!file ./ampleB
A DSPA90(=<)
A # %0B-or Demo P'rpo"e 4nl2B
A DSPA90(:<)
A DSPA90(=<)
A 4 4B1o)eB
A DSPA90(=<)
A 4 1#BFameB
A DSPA90(=<)
A 4 %%BAgeB
0& of %4&
A DSPA90(=<)
A 4 43BPhoneB
A DSPA90(=<)
A>>>>>>>>>>>
A S-<01DF:0
A>>>>>>>>>>>
A 01DF:0 4S 08 S-<01DF:0
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
9he following i" the 0P7 program for ./pan)ing "'!file
>>>>>>>>>>>>>>>> B246;;6;4 <3 1.A.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> ./ample for PA7.(:5(PA7. :=6<D S=:-6<.
> Ph2"ical -ile ( 9.S9
> Di"pla2 -ile ( 9.S9DSP
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> B246;;6;4 <3 1.A. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
-9.S9 6- . I D6SI
-9.S9DSP 1- . W40IS9F
- S-<00FIS-6<. DS-01D1
1>
1 .CS0 6FGS0
1 .CS0 :<DS0
1 .CS0 DSPS0
1 S.94F <0
1>
1 >6FGS0 :.7S0
1>
1 G(ADD>G.04S S-<00F 40
1 ><4KA< S.9<<9S90.1
1 .FDS0
1>
1 6FGS0 :.7S0
1 S.94F &% 1<0S-<
1 W069.DS-19<1
1 S.94- &%
1 .FDS0
1>
1 DSPS0 :.7S0
1 S.94F &0&1
1 >6F0% D4=.AB1B
1 W069.S-<-90
1 .C-M9DS-19<1
1 >6F0% 6-.A B0B
1 >6F0? 6-.A B1B
1 ><4KA< S.9<<9S90.1
1 .CS0 :<DS0
1 .FD6-
1 >6F03 6-.A B1B //Page Down or 0oll'p
1 .CS0 :<DS0
1 .FD6-
1 .FD6-
1>
1 .FDD4
1 .FDS0
1>
1 :<DS0 :.7S0
1 G(ADD>G.04S 14=F9 40
1 0.AD 9S90.1 &4
1 >6F&4 D4W.AB0B
1> 14=F9 AFD<9D //S-<PA7 * %
1 ADD 1 S-<00F
1 ADD 1 14=F9
1 W069.DS-01D1
1 14=F9 6-.A 1
1 G(ADDS-<00F 01DF:0 // Move 00F to S-<01DF:0
1 .FD6-
1 14=F9 6-.A D
1 <.AK.
1 .FD6-
00 of %4&
1 0.AD 9S90.1 &4
1 .FDD4
1 .FDS0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>E;1 <3 1.A. >>>>>>>>>>>>>>>>>>>>>>
Single Page Sub)ile:
The third method of loading is =no;n as a single-page load. In this process you only load the
num)er of su)file records that can )e displayed on the screen at one time. If the information the
user needs is not in the su)file> then the e<isting su)file records are discarded> and another page
;orth of su)file records is loaded.If the information the user ;ants to see is not on this page of
su)file records> then you canNt *ust add more records to the su)file li=e you do in an e<panding
su)file method. Gou must first clear the e<isting records out of the su)file. Gou clear a su)file )y
setting on an indicator located in the su)file control format that controls the clear operation. Then
you ;rite the su)file control format> ;hich remo"es all data from the su)file.
This type of su)file is used ;hen there are more than (((( records in a data)ase.
%UB(I"E A@E 6 %UB(I"E %IEE
The follo;ing is the 11S for #age-Cy-#age Cuild su)file
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
A& D6@=9.E F692 3<? LOAD-ALL-SUBFILES
>
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A S'!file Single Page S'!file:
A>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A 0 DS-01D# S-<
A 14D. 0 4 ? 40.--<D(9S90.1/14D. 09AM6</9.S9)
A FAM. 0 4 ? 1#0.--<D(9S90.1/FAM. 09AM6</9.S9)
A A7. 0 4 ? %%0.--<D(9S90.1/A7. 09AM6</9.S9)
A P84F. 0 4 ? 430.--<D(9S90.1/P84F. 09AM6</9.S9)
A 0 DS-19<# S-<19<(DS-01D#)
A S-<S6G(000D)
A S-<PA7(000D)
A 1-0%(0%)
A 1-0?(0?)
A F&4 04<<=P(03)
A 04<<D4WF(0@)
A 4K.0<A5
A &0 S-<DSP
A &1 S-<DSP19<
A &% S-<1<0
A &4 S-<.FD(>M40.)
A 1 #&B./pan)ing S'!file ./ampleB
A DSPA90(=<)
A # %0B-or Demo P'rpo"e 4nl2B
A DSPA90(:<)
A DSPA90(=<)
A 4 4B1o)eB
A DSPA90(=<)
A 4 1#BFameB
A DSPA90(=<)
A 4 %%BAgeB
A DSPA90(=<)
A 4 43BPhoneB
%00 of %4&
A DSPA90(=<)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> E;1 <3 1.A.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
RP" =?<4?.: 3<? P.42-BE-P.42 BB691 SB/3692
>>>>>>>>>>>>>>>> B246;;6;4 <3 1.A.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> ./ample for PA7.(:5(PA7. :=6<D S=:-6<.
> Ph2"ical -ile ( 9.S9
> Di"pla2 -ile ( 9.S9DSP
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-9.S9 6- . I D6SI
-9.S9DSP 1- . W40IS9F
- S-<00FIS-6<. DS-01D#
1>
1> .CS0 6FGS0
1 .CS0 :<DS0
1 .CS0 DSPS0
1 S.94F <0
1>
1 >6FGS0 :.7S0
1>
1 G(ADD>G.04S S-<00F 40
1 ><4KA< S.9<<9S90.1
1 .FDS0
1>
1 6FGS0 :.7S0
1 G(ADD>G.04S S-<00F 40
1 S.94F &% 1<0S-<
1 W069.DS-19<#
1 S.94- &%
1 .FDS0
1>
1 DSPS0 :.7S0
1 S.94F &0&1
1 >6F0% D4=.AB1B
1 W069.S-<-90
1 .C-M9DS-19<#
1>
1 >6F0% 6-.A B0B
1 >6F0? 6-.A B1B
1 ><4KA< S.9<<9S90.1
1 .CS0 :<DS0
1 .FD6-
1>
1 >6F03 6-.A B1B
1 .CS0 :<DS0
1 .FD6-
1>
1 >6F0@ 6-.A B1B
1 .CS0 :<D:S0
1 .FD6-
1 .FD6-
1>
1 .FDD4
- E8#$0
-!
- 7L#$0 7E5$0
- &-"##!&E02$ -218T (*
- E/$0 I8&$0
- 0E"# T$T0E- @(
- !I8@( #2=E>.*.
- -218T "8#LT?
- "## 1 $FL008
- "## 1 -218T
- -218T IFE> 1
- 92;E -2#E F-2#E +
- E8#IF
- =0ITE#$F0-#2
%0% of %4&
- -218T IFE> ?
- LE";E
- E8#IF
- 0E"# T$T0E- @(
- E8##2
- E8#$0
-!!!reposition
- 7L#7$0 7E5$0
- !I8@( IFE> .1.
- !BI;"L $ET5TT$T0E-
- EL$E
- F-2#E $ETLLT$T0E-
- E8#IF
-!!!
- #2 :
- 0E"#%T$T0E- @3
- !I8@3 IFE> .1.
- !L2;"L $ETLLT$T0E-
- LE";E
- E8#IF
- E8##2
-!!!
- &-"##!&E02$ -218T (*
- E/$0 7L#$0
- E8#$0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -nd of data !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'old and !rop capabilities :
The data to )e displayed on a screen freEuently e<ceeds the space a"aila)le to display it. This
is especially true ;hen you design displays ;ith su)files that are usually limited to a single ro;
of 0 characters.
The su)file =ey;ord that initially displays only the first line of the su)file records and reacts
to a function =ey )y s;itching into a multi line format is %("'0O .7on"ersely > The
=ey;ord %("(O"' initially displays the su)file in a multi line format and reacts to a
function =ey )y s;itching to a single line format .
+< :
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! -1ample for ,old and !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
" #$%$I&'2( )* !#$+,
" -"*+'*+ .E/IT.,
" 0 $FL0E- $FL
" -1$"# 0 2 ) 310EFFL#'0-1$T4-1$"# 526FLI734-1$T,
" -1$89 0 2 ) 1:0EFFL#'0-1$T4-1$89 526FLI734-1$T,
" -1$82 0 2 ) +0EFFL#'0-1$T4-1$82 526FLI734-1$T,
" 0 $FL-TL $FL-TL'$FL0E-,
" 2;E0L"<
" $FL#$%
" $FL#$%-TL
" 1* $FL-L0
" 2* $FLE8#'!920E,
S,L(!OP(/,02"
S,LSI3(0004"
S,LP5(0004"
]]..
]]
O 7305 is the function =ey that causes the display file to s;itch from the drop$single line format
' to the fold$multiline format'
%02 of %4&
O Su)file page siFe$ S3!#%?' has )een changed to the num)er of folded records that can )e
displayed.
(ther interesting Sub)ile /ey0ords:
S3!&719C& > S3!MO1+> S3!7S&&&9> S3!&O!D%!
dditional !ecommended !eading Material
,. S7-,-(54-- 1ata Management ?uide
%0$ of %4&
Chapter .III: Arrays5 "ables and !ata structures
Arrays:
%n array may )e defined as an arrangement of computer memory positions in one $or multiple'
dimension ;ith each position ha"ing the same attri)utes.
&#? only supports one dimensional arrays and does not directly support multi dimensional
arrays. @o; e"er they may )e simulated )y defining one or more Multiple Occurrence 1ata
structure
Array !escription :
The 9um)er of elements> siFe of the elements >type and seEuence are specified in the e<tension
specifications:
%ll +<tension Specification instructions must include an E in the column n 5 and immediately
follo; the last 3ile 1escription statement.
,. 7olumns 7-,0 not used.
-. (rom (ilename $columns ,,-,'.&eEuired for #rerun Time arrays. 3ile name> specified
in a 3ile 1escription statement $T in columns ,5' as program-defined $3 in column ,('
must )e entered left-*ustified in this field.
8. ,o (ilename $columns ,(--5'.Optional for #rerun Time arrays. If the array data is to the
end of the program> the name of the output file must )e entered left-*ustified in this field.
4. Arra! Name$columns -7-8-'.#rogrammer Hsupplied array name must )e entered in this
field .If the array is to )e inde<ed > the reEuired comma and inde< name or literal must )e
considered in the array specified in the program.
4. Number of Entries er recor& $columns 88-84'.Specifies ho; many indi"idual array
elements are stored on a record .+ntry is only for 7ompile and #rerun Time arrays.
5. Number of Entries er Arra! $columns 85-8(' specifies ho; many array elements are
stored in the array. &eEuired for all array types.
7. "en$th of Entr! $columns 40-4-'.Specifies the siFe of the array elements. %ll elements
of an array must )e the same siFe. +lements in character arrays may )e defined from , to
-45 )ytes. 9umeric array elements may )e defined from , to 80 )ytes
. BBB"B0$column 48'If the numeric data in a #rerun or &un Time array is stored in
pac=ed decimal format > the letter # must )e specified in this field. If the data is stored in
)inary format> a C must )e specified .If no entry is specified> the numeric array data is
stored as Foned decimal .7ompile Time array data is entered in a Foned decimal
format .%n ! entered in this field indicates that a separate sign stored to the left of the
"alue and an & to the right.
%04 of %4&
(. 'ecimal ositions $column 44' % )lan= in this field indicates that the array is
character .% num)er from 0 to ( defines the array elements as numeric ;ith the indicated
implied decimal positions. The entry cannot )e larger than the !ength of +ntry siFe.
,0. %eGuence $%/1' $column 44' If the array is not in a sorted order> this filed must )e
)lan= .If the data is in an ascending order> an % may )e entered .On the other hand> if the
array data is in a descending order> a 1 may )e specified .If seEuence is specified> an
^early e<itP is pro"ided for an unsuccessful eEual loo=up condition> reducing run times.
,,. Arra! Name$%lternating 3ormat'$columns 45-4,'.%n array name entered in this filed
indicates that t;o or more entries from t;o related array are stored in each stored in each
record> for e<ample >data for an SS9O element follo;ed )y data for a 9%M+ element.
9um)er of entries #er &ecord specifies ho; manyP pairsP are included on a record. Only
"alid for 7ompile and #rerun Time arrays.
,-. 7olumns 4--47.These four fields relate to the attri)ute of the alternating array. &efer to
items 7> > ( and ,0 for an e<planation of these fields.
&oading o) an array:
%rrays can )e classified into three types )y the nature of loading.
,' 7ompile Time array
-' #rerun time array
8' &un time array
Compile time array:
7ompile time arrays data is an integral ^@ard coded ^ part of an &#? #rogram. It must
)e included after a OO control statement entered in column , and - and follo; the last $O'
output statement in the program.
Salient features:
%rray 1ata is permanent.
%rray data is separated from the last output statement in the program )y OO in columns
, and -.
1ata is loaded ;hen the program is created.
+<ample:
%0. of %4&
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
. M98 D 1# &
. DA5S 1# 1# # 0
$other &#? program statements '
0W----------------------------$last output specification statement'
OO---------------------------------$delimits compile time array from program'
0%96%&G 3+C&6%&G M%&7@ %#&I! M%G 069+ 1ata "alues for an array must
06!G %6?6ST S+#T+MC+& O7TOC+& 9OD+9C+& 1+7+MC+& )e the seme siFe .7ompile time
OO W--------------------------------------------------------------------------------------------------------- %rrays are separated )y O O
8,-8,808,808,8,808,808,
&elated array data must )e entered in the order the arrays are specified in the +<tension form.
9ote: %rray data items must )e siFe of the elements defined in the +<tension form. Smaller numeric data is padded ;ith high-order
Feros and alphanumeric data is padded ;ith lo;-order )lan=s.
+<tension Specification synta< and related data for t;o 7ompile Time arrays.
Prerun time Array:
1ata for #rerun Time arrays is stored e<ternally from the program in a physical file.
.hen processed > the array is created and loaded ;ith the data from the physical file )efore any
other files are processed.
Salient features:
%rray 1ata is stored in physical file
3ile that stores the array data is program defined in the file description space> as input
;ith a T in column ,5 and an + in column 8(.
%rray defined in the +<tension specifications.
MTN 3ile is read )efore any input > calculations or Output is e<ecuted.
+<ample:
3 Specification :
O M'"t !e )efine) a" an inp't ta!le file
> M'"t !e program()efine) .6n)icate" arra2 attri!'te" are )efine) in the ./ten"ion Specification
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
FA05-6<. 69 - 11 .D6SI
+ Specification :
O -ile name )efine) in the -ile De"cription Specification" with a 9 in the col'mn 1D m'"t !e
entere) here
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
. A05-6<. M98 1 1# & DA5S # 0
%0* of %4&
-un time array:
1ata for run time array may )e stored in an e<ternally defined physical file> the data may )e
loaded in the input specifications or loaded )y one or more calculation statements for the arrays
that are defined in the Extension specifications ;ithout a Number of Entries Per Record 3ield
entry.
Salient 3eatures:
1ata !oaded "ia Input specifications:
% physical file e<ternally or program defined stores the array data.
%rray defined in the +<tension Specifications and elements are referenced
in the input specifications.
#rogram is e<ecuted and physical data is read. %s a record is read > the
array is loaded ;ith data . This procedure is follo;ed for each record in
the file.
1ata loaded Dia calculation Specification:
%rray is defined in the +<tension Specifications.
#rogram is e<ecuted and the array is loaded )y instructions in calculation
specifications.
%07 of %4&
Example:
1ata !oaded "ia Input specifications:
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
- ,DA9A-<. 6P . D6SI
#hysical 3ile is e<ternally defined
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
01 . A05 4 3
9um)er of +ntries per record field
is not used for +/n Ti9e
arrays$loaded in nput or !alculation "pecifications'
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
0, ,1%T%3!+&
0- , 3!1, %&G>,
08 , 3!1- %&G>-
04 , 3!18 %&G>8
04 , 3!14 %&G>4
3ield names in the physical file %rray name> comma and element
record format that store the data num)er are entered in the field name
for the Run #ime array are entered columns.
)eginning in column -,.
9ote: The fields in the physical fileNs record do not ha"e to )e contiguous and may )e scattered ;ithin the record
format.
1ata loaded Dia calculation Specification:
%0& of %4&
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
. SA<. ? @ # <oa)e) 4n 6np't
. 949< ? 3 # <oa)e) 4n 1alc
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
1 ADD SA<. 949<
Searching Arrays
The LOU# operation can )e used to search arrays.
Searching an Array 0ithout an Inde1
.hen searching an array ;ithout an inde<> use the status $on or off' of the resulting indicators to
determine ;hether a particular element is present in the array. Searching an array ;ithout an
inde< can )e used for "alidity chec=ing of input data to determine if a field is in a list of array
elements. ?enerally> an eEual LOU# is reEuested.
In factor , in the calculation specifications> specify the search argument $data for
;hich you ;ant to find a match in the array named'. 3actor ,> the search argument>
can )e:
% character or numeric literal
% field name
% data structure name
%n array element
% ta)le name.
The result field cannot )e used.
The search starts at the )eginning of the array and ends at the end of the array or ;hen the
conditions of the loo=up are satisfied. .hene"er an array element is found that satisfies the type
of search )eing made $eEual> high> lo;'> the resulting indicator is set on.
+<ample:
N...1....H....#....H....%....H....4....H....?....H....D....H....@...
--ilename6P.A-....0len<I1A64vIloc.DeviceH......I./itHH.ntr2HA....=1.
FARRFILE IT F 5 EDISK
-N
.....-romfile9ofileHHFameHHF/rF/t!<enPDSArrnam<enPDS1omment"
E ARRFILE DPTNOS 1 5# 5 # DEPT NUMBERS
.N
1<OFO1FO#FO%-actor1HHH4pc)e-actor#HHH0e"'lt<enD88i<o.M1omment"HHHHHHH
1N 9he <4I=P operation i" proce""e) an); if an element of DP9F4S eM'al
1N to the "earch arg'ment (DP9F=M) i" fo'n); in)icator #O i" "et on.
C DPTNUM LOKUPDPTNOS 2K
1N
1N 4therwi"e; in)icator #O i" not "et on an) the 7494 "tatement
1N con)itione) !2 F#O ca'"e" a !ranch to the :ADF=M 9A7.
%00 of %4&
C N2# "OTO BADNUM
C -
C - C.90B9.A6<;@
C -
C BADNUM TA"
A00-6<.; which contain" )epartment n'm!er"; i" )efine) in the file )e"cription "pec(ification"
a" an inp't file (6 in po"ition 1?) with an arra2 file )e"ignation (9 in po"i(tion
1D). 9he file i" program )e"cri!e) (- in po"ition 1&); an) each recor) i" ?
po"ition" in length (? in po"ition #@). 9he . in po"ition %& in)icate" that the file i"
f'rther )e"cri!e) in the e/ten"ion "pecification".
6n the e/ten"ion "pecification"; A00-6<. i" )efine) a" containing the arra2 DP9F4S.
9he arra2 contain" ?0 entrie" (po"ition" %3 an) %&). .ach entr2 i" ? po"ition" in
length (po"ition 4#) with Lero )ecimal po"ition" (po"ition 44). 4ne )epartment
n'm!er can !e containe) in each recor) (1 in po"ition %?). 8owever; each recor)
)oe" not have to contain an entr2. An2 recor) that )oe" not contain an entr2 i"
fille) with Lero".
Searching an Array 0ith an Inde1
To find out ;hich element satisfies a LOU# search> start the search at a particular element in
the array. To do this type of search> ma=e the entries in the calculation specifications as you
;ould for an array ;ithout an inde<. @o;e"er> in positions 88 through 4-> enter the name of the
array to )e searched> follo;ed )y a comma and a numeric constant or the name of a numeric
field $;ith Fero decimal positions' containing the num)er of the element to )e used. The numeric
constant or numeric field pro"ides the num)er of the element at ;hich the search is to start. This
numeric constant or field is called the inde< )ecause it points to a certain element in the array.
%ll other rules that apply to an array ;ithout an inde< apply to an array ;ith an inde<.
+<ample:
N...1....H....#....H....%....H....4....H....?....H....D....H....@...
--ilename6P.A-....0len<I1A64vIloc.DeviceH......I./itHH.ntr2HA....=1.
FARRFILE IT F 5 EDISK
-N
.....-romfile9ofileHHFameHHF/rF/t!<enPDSArrnam<enPDS1omment"HHHHHHHHH
. A00-6<. DP9F4S 1 ?O ? O DP9DS1 #O D.P9 F4/D.S10P9F
.N
1<OFO1FO#FO%-actor1HHH4pc)e-actor#HHH0e"'lt<enD88i<o.M1omment"HHHHHHH
1N 9he G(ADD operation !egin" the <4I=P at the fir"t element in DP9F4S.
C Z-ADD1 * 3K SET * FOR LOKUP
1N At the en) of a "'cce""f'l <4I=P; when an element ha" !een fo'n)
1N that contain" an entr2 eM'al to the "earch arg'ment DP9F=M;
1N in)icator #O i" "et on an) the M4K. operation place" the )epartment
1N )e"cription; corre"pon)ing to the )epartment n'm!er; into DP9FAM.
C DPTNUM LOKUPDPTNOSL* 2K
1N 6f an element i" not fo'n) that i" eM'al to the "earch arg'ment;
1N the 7494 operation con)itione) !2 F#O ca'"e" a !ranch to :ADF=M.
C N2# "OTO BADNUM
C MOVE DPTDSCL* DPTNAM 2K
C BADNUM TA"
This e<ample sho;s the same array of department num)ers> !"#$OS> as3igure ,0( on page
8(5. @o;e"er> an alternating array of department descriptions> !"#!S7> is also defined in
positions 45 through 4, of the e<tension specifications. +ach element in !"#!S7 is -0
positions in length $positions 48 and44'. %ny record in !"#$OS that does not contain an entry
is filled ;ith Feros. %ny record in !"#!S7 that does not contain an entry is filled ;ith )lan=s.
%%0 of %4&
Speci)ying an Array in Calculations
%n entire array or indi"idual elements in an array can )e specified in calculation
specifications. Gou can process indi"idual elements li=e fields. &emem)er> if an
array element is to )e used as a result field> the array name ;ith the comma and
inde< cannot e<ceed 5 characters.
To specify an entire array> use only the array name> ;hich can )e used as factor ,>
factor -> or the result field. The follo;ing operations can )e used ;ith an array
name%
A!!
&'A!!
SUB
&'SUB
(UL#
!)*
S+,#
(O*-
(O*-L
(O*-A
(LL&O
(L.&O
(.L&O
(..&O
!-BU/
XFOOT
LOKUP
SORTA
"A,(
!-0$
CL-A,
,-S-#
C.-C
C.-,
SCA9.
Se"eral other operations can )e used ;ith an array element only )ut not ;ith the
array name alone. These operations include )ut are not limited to:
B)#O$
B)#O0
CO("
CAB11
#-S#&
%%% of %4&
#-S#$
#-S#B
(*,
!OU11
!O211
)011
SUBS#
CAT.
.hen specified ;ith an array name ;ithout an inde<> certain operations are repeated for each
element in the array. These are
A!!
&'A!!
SUB
&'SUB
(UL#
!)*
S+,#
(O*-
(O*-L
(LL&O
(L.&O
(.L&O
(..&O
The follo;ing rules apply to these operations ;hen an array name ;ithout an inde< is specified:
.hen factors , and - and the result field are arrays ;ith the same num)er of elements>
the operation uses the first element from e"ery array> then the second element from e"ery
array until all elements in the arrays are processed. If the arrays do not ha"e the same
num)er of entries> the operation ends ;hen the last element of the array ;ith the fe;est
elements has )een processed. .hen factor , is not specified for the A!!3 SUB3 (UL#>
and !)D operations> factor , is assumed to )e the same as the result field.
.hen one of the factors is a field> a literal> or a figurati"e constant and the other factor
and the result field are arrays> the operation is done once for e"ery element in the shorter
array. The same field> literal> or figurati"e constant is used in all of the operations.
The result field must al;ays )e an array.
If an operation code uses factor - only $for e<ample> &'A!!3 &'SUB3 S+,#3 A!!3
SUB3 (UL#> or !)D do not ha"e factor , specified' and the result field is an array> the
operation is done once for e"ery element in the array. The same field or constant is used
in all of the operations.
&esulting indicators $positions 44 through 4(' cannot )e used )ecause of the num)er of
operations )eing processed.
%%2 of %4&
"ables :
There is no physical difference )et;een a ta)le and array. Cut functionally> an array can )e
addressed element )y element ;hile a ta)le can only )e addressed ;holly. %lso one element in a
Ta)le can )e accessed at a time unli=e an array.
!ata Structures:
The &#?/400 program allo;s you to define an area in storage and the layout of the fields> called
su)fields> ;ithin the area. This area in storage is called a data structure. Gou can use a data
structure to:
1i"ide a field into su)fields
7hange the format of a field
?roup noncontiguous data in a contiguous format
1efine an area of storage in more than one format.
1efine multiple occurrences of a set of data
In addition> there are three special data structures> each ;ith a specific purpose:
% data area data structure $identified )y a = in position , of the data structure statement'
% file information data structure $referred to )y the =ey;ord I931S on a file
description specifications continuation line'
% program-status data structure $identified )y an S in position , of the data structure
statement'.
1ata structures can )e program-descri)ed or e<ternally descri)ed.
% program-descri)ed data structure is identified )y a )lan= in position ,7 of the data structure
statement. The su)field specifications for a program-descri)ed data structure must immediately
follo; the data structure statement.
%n e<ternally descri)ed data structure> identified )y an . in position ,7 of the data structure
statement> has su)field descriptions contained in an e<ternally descri)ed file ;ith one record
format. %t compile time> the &#?/400 program uses the e<ternal name to locate and e<tract the
e<ternal description of the data structure su)fields. %n e<ternal su)field name can )e renamed
in the program> and additional su)fields can )e added to an e<ternally descri)ed data structure in
the program.
'ormat o) !ata Structure Sub)ields in Storage:
Su)fields in a data structure are stored in the format specified in position 48 of the data structure
su)field specifications. The possi)le entries for a program-descri)ed data structure are:
Entr! Explanation
Clan= Su)field is in Foned-decimal format or is character data>depending on the entry in position 4-
of the su)field specifications.
%%$ of %4&
# Su)field is in pac=ed-decimal format.
C Su)field is in )inary format.
,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Cecause the su)fields of a data structure are maintained in the format specified> The compiler
generates the necessary con"ersions to process the reEuired function. These con"ersions can
occur at the follo;ing times:
.hen a record is )eing read
%t detail or total calculation time
%t detail or total output time.
!ata Structure Statement Speci)ications:
1ata structure statements are defined on the input specifications and must
follo; all input specifications for records.
The specifications for data structure statements are:
Position -ntry
2 I
6-78 9ame of the data str*ct*re #eing defined: This entry is optional for a
program-descri#ed data str*ct*re; and is re<*ired for an e1ternally
descri#ed data str*ct*re; a file information data str*ct*re (I9,(S"; and a
data area data str*ct*re:
7=-72 0lan>
76
0lan>) Program-descri#ed data str*ct*re:
-) -1ternally descri#ed data str*ct*re: The data str*ct*re s*#field
definitions are retrieved from an e1ternally descri#ed record format:
7?
0lan>) Other than a program stat*s; data area or initiali@ed data
str*ct*re:
I) 5lo#ally initiali@ed data str*ct*re:
S) Program-stat*s data str*ct*re:
.) (ata area data str*ct*re:
74-80 (S
87-=0
0lan>) The data str*ct*re is program descri#ed:
-ntry) This is the name of the file Ahose first record format contains
the field descriptions *sed as the s*#field descriptions for this data
str*ct*re:
=7-4= 0lan>
44-46
0lan>) single occ*rrence data str*ct*re:
nnnn) n*m#er (right-ad$*sted" indicating the n*m#er of occ*rrences
of the data str*ct*re:
9ote) This entry m*st #e #lan> for a data area data str*ct*re; a file
information data str*ct*re; and a program-stat*s data str*ct*re:
%%4 of %4&
4?-B7
Length of data str*ct*re (optional": This entry m*st #eright-ad$*sted:
B8-64 0lan>
E1amples:
D6C612 . 36291 6;A< @B/36291@-
6D"name....F4D"./t(fileHH.............4ccr<enH......................>
6PA09F4 DS
6.............../t(fiel)H............P-rom9oHHD-iel)H...............>
6 1 4 M-7
6 ? 10 D0=7
6 11 1% S90F98
6 14 1D014=F9
6>
Usin$ 'ata %tructure to @roup fiel&s :
>.. 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
6-ilenameSMF40iPo"1F11Po"#F11Po"%F11................................>
690AFSA19FS 01 1 11 # 1#
6....................................P-rom9oHHD-iel)H<1M1-rPlMnGr...>
6 % 10 PA09F4
6 11 1D0A95
6 1@ #0 95P.
6 #1 #1 14D.
6 ## #? <41A9F
6D"name....F4D"./t(fileHH.............4ccr<enH......................>
6P09I.5 DS
6.............../t(fiel)H............P-rom9oHHD-iel)H...............>
6 1 4 <41A9F
6 ? 1# PA09F4
6 1% 1D 95P.
.hen you use a data structure to group fields> fields from non-ad*acent locations on the input
record can )e made to occupy ad*acent internal locations. The area can then )e referred to )y
the data structure name or indi"idual su)field name.
Chan$e the format of the (iel&:
>.. 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
6-ilenameSMF40iPo"1F11Po"#F11Po"%F11................................>
66FP=9 SM 01
6....................................P-rom9oHHD-iel)H<1M1-rPlMnGr...>
6 1 D0DA9.
6 1 # MM
6 % 4 DD
6 ? D 55
6D"name....F4D"./t(fileHH.............4ccr<enH......................>
6 DS
6.............../t(fiel)H............P-rom9oHHD-iel)H...............>
6 1 D 55MMDD
6 1 # 55
6 % 4 MM
6 ? D DD
%%. of %4&
M*ltiple Occ*rrence (ata Str*ct*re)
% multiple-occurrence data structure is a data structure ;hose definition is repeated in a
program to form a series of data structures ;ith identical formats. Gou specify the num)er of
occurrences of a data structure in positions 44 through 47 of the data structure statement.
.hen positions 44 through 47 do not contain an entry> the data structure is not a multiple-
occurrence data structure. %ll occurrences of a data structure ha"e the same attri)utes and can
)e referred to indi"idually. The 41=0 operation code> ;hich can only )e used ;ith a multiple-
occurrence data structure> allo;s you to specify ;hich occurrence of a data structure is used
for su)seEuent operations ;ithin the program.
Note: Multiple occurrences are not allo;ed for a data area> file information> or program-
status data structure.
>.. 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
6>
6> A m'ltiple(occ'rrence )ata "tr'ct're i" '"e) to acc'm'late a
6> "erie" of total" for "pecific co)e"; an) the total" of each of
6> the occ'rrence" of the )ata "tr'ct're are written.
6> 9he program()e"cri!e) )ata "tr'ct're; 949DS; ha" && occ'rrence"
6> (po"ition" 4D an) 4@). 9he length of the )ata "tr'ct're can !e
6> "pecifie) in po"ition" 43 thro'gh ?1.
6>
6D"name....F4D"./t(fileHH.............4ccr<enH......................>
ITOTDS DS ))
6.............../t(fiel)H............P-rom9oHHD-iel)H...............>
6 1 ?09491F9
6 D 1#09491
6 1% #0#949#
6>
>.. 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
1>
1> A n'meric co)e fiel); 14D.; contain" a val'e of 01 tho'gh &&.
1> 9hi" val'e i" )ifferent each time the 41=0 operation i" proce""e).
1> When the 41=0 operation i" proce""e); the 14D. fiel) i" '"e) to
1> "et the c'rrent occ'rrence of 949DS. 6f the 41=0 operation i"
1> "'cce""f'l; the program !ranche" to the ADD09F "'!ro'tine where
1> a recor) co'nt i" ma)e an) inp't val'e" are a))e) to the )ata
1> "tr'ct're "'!fiel)". 6f the 14D. fiel) contain" a val'e other
1> than 01 thro'gh &&; in)icator #? i" "et on an) the program
1> !ranche" to :AD14D.
1>
1<0F01F0#F0%-actor1HHH4pc)e-actor#HHH0e"'lt<enD88i<o.M1omment"HHHHHH>
1 CODE OCUR TOTDS 25
1 #? 7494 :AD14D
1 .CS0 ADD09F ,,,,,,,,,,,,,,,,
1 S T 1alc'lation" T
1 S T,,,,,,,,,,,,,,,,T
1 :AD14D 9A7
1 S ,,,,,,,,,,,,,,,,
1 S T 1alc'lation" T
1 T,,,,,,,,,,,,,,,,T
%%* of %4&
!ata Areas :
1ata areas are o)*ects used to transfer data to one or more programs ;ithin a *o) or )et;een
*o)s. % 1ata area may )e considered as a one-record Storage area .
% 1ata area can )e of ma<imum -4 digits ;ith ma<imum ( decimal positions for O1+7
type and for O7@%& type the ma<imum length is -000 characters.
7reated )y 7&T1T%%&%> Modified )y 7@?1T%%&% and 1isplayed )y
1S#1T%%&%.
1ata areas can )e e<plicitly or implicitly retrie"ed and ;ritten.
Implicitly retrieved and 0ritten:
.hen the data area is defined in an &#?/400 program as a data area data structure> Its
data is implicitly retrie"ed for processing and ;ritten )ac= at the end the of the program.
6>
6D"name....F4D"./t(fileHH.............4ccr<enH......................>
6PA09F4 UDS
6.............../t(fiel)H............P-rom9oHHD-iel)H...............>
6 1 D PA09F:0
6>
E1plicitly retrieved and 0ritten:
The Opcodes and reser"ed ;ords related to the e<plicit processing of data are summariFed as
follo;s :
OpCo&es (unction
I9 +<plicitly retrie"es a data area and optionally allo;s the programmer to
^loc=P it so that it cannot )e updated )y another pgm during the
e<ecution of the controlling program.
O6T +<plicitly updates the data area and unloc=s it
1+39 .hen used ;ith O9%MD%& reser"ed ;ord> It specifies that the 3actor -
entry is a data area.
69!7: &eleases one or all the data areas loc=ed )y the controlling program
0eserve& Hor&s (unction
O!O7: 6sed in 3actor , ;ith opcode I9 to loc= a data area
O9%MD%& 6sed in 3actor , in opcode 1+39 to define a data area
6sed in 3actor - in Opcode I9 to access all data areas specified in the
program
C& D.A. .?2. .@@64;21 A< . F6291-
1<0F01F0#F0%-actor1HHH4pc)e-actor#HHH0e"'lt<enD88i<o.M1omment"HHHHHH>
1 >FAMKA0 DEFN CKINFO CHECKS 1##
1 6F 18.1IS
1>./ample 66
C& RP"J4## C<;A?<9 A< C5.;42 A52 C.9B2 6; D.A. .?2. -
1<0F01F0#F0%-actor1HHH4pc)e-actor#HHH0e"'lt<enD88i<o.M1omment"HHHHHH>
%%7 of %4&
1 >FAMKA0 DEFN CKINFO 1#
1 ><41I 6F 1I6F-4
1 M4K.<1I6F-4 18.1IU 40
1 M4K. 1I6F-4 1IDA9. D0
1 M4K.<18.1IU 1I6F-4
1 M4K. =DA9. 1I6F-4
1 4=9 1I6F-4
1 =F<1I1I6F-4
1>Data area previo'"l2 loce) !2 an 6F i" a'tomaticall2 relea"e) from the loce)
1> "tate after the 4=9 "tatement i" e/ec'te). 6f More than one )ata area i"
1> "'pporte) !2 the program; "pecif2ing =F<1I "tatement with >FAMKA0 in factor #
1> will 'nloc all of them at one time. 4n the other han) ; if onl2 a "elect )ata
1> area i" to !e 'nloce) ;the )ata area name m'"t !e entere) in -actor #.
1>
1 >FAMKA0 =F<1I
%%& of %4&
!ata Structures 'or E1ception/Error Control
Exception errors that cause program e<ecution to cancel are not uncommon in the programming
en"ironment..&outines may )e included in an &#?/400 program to identify and control
e<ception/errors and pre"ent program e<ecution ^%)ortsP.3ile Information 1ata structures and
#rogram Status 1ata Structures are t;o &#?/400 run-time methods to control e<ception/error
processing.
'ile In)ormation !ata Structures #I+'!S$:
% file information 1ata Structure pro"ides e<ception/error information that may ha"e occurred
;hen processing a file during program e<ecution.This type of data structure contains predefined
su)fields that identify:
The name of the file for ;hich the error occurred.
The record processed ;hen the error occurred.
The operation )eing processed ;hen the error occurred.
The status code num)er.
The &#?/400 routine in ;hich the error occurred.
Specifically> =ey;ords including N(I"E< NIN< N)O'E< NOU,< NOCO'E< N%IEE<
N%,A,U%< N0ECO0'> and N0OU,INE pro"ide the pre"iously named information for any file
processed )y the program.
The &#?/400 3ile 1escription and Input Specifications coding to support a 3ile Information
1ata Structure$I931S' is detailed in the )elo; 3igure. 9ote that a 3ile +<ception/+rror
Su)routine $I93S&' is specified on a second continuation statement ;hich accesses the &#?/400
supplied N%%0 routine. .hen an error is detected>control ;ill pass to this su)routine
automatically.
Cased on the error type> programmer supplied statements in the O#SS& routine ;ill determine
the action to )e ta=en $ie end the *o) or ignore error and continue ;ith processing'.
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
FINVPF IP E K DISK KINFDS INFDS1
( KINFSR &PSSR
.
.
.
66F-DS1 DS
6 >-6<. -6<.
6 >4P14D. 14D.
6 >S9A9=S S9A9=S
6 >0.140D 0.140D
6 >04=96F. 04=96F
.
.
%%0 of %4&
.
1 >PSS0 :.7S0
1 S9A9=S 6-.A 01011
1 M4K.<V>7.96FW 0.ADA7 D
1 .C1P9 .004=9
1 .FD6-
1 ENDSRREADA"
The output generated in the O#SS& routine may )e directed to any output de"ice and include
I931S =ey;ord "alues and/or programmer Hsupplied code.Some errors may reEuire that
e<ecution of the program )e cancelled.
6nder those circumstances O7%97! ;ould )e mo"ed to &+%1%? field and the program
;ould end. In any case>I931S e<ception/error control pre"ents the display of system supplied
errors ;hich ;ould utiliFe system resources if a user response ;as not timely.
9ote that the e<ception/error information for the =ey;ords is only generated if the
OST%T6S =ey;ord "alue is greater than 000((.
Program Status !ata Structure:
#rogram Status 1ata Structures > ho;e"er identify e<ceptions/errors that are generated in the
program )y &#?/400 operations and not )y a file.
9ote that any code greater than 000(( is flagged as an e<ception/error.
3our =ey ;ords OST%T6S> O&O6TI9+> O#%&MS> %91 O#&O?&%M are supported )y a
#rogram Status 1ata Structure.
The eight character 0OU,INE #e! wor& contains the name of the 0@B499 routine 1e$:
INI,<N@E,IN<N1+T!> O'E,C< N,O,C< N,O," < NO("< N,E0) < %0 name< p$m name2
in ;hich the e<ception/error occurred. O#%&MS is a three digit numeric =ey;ord that stores the
num)er of parameters passed to the program from a calling program. O#&O?&%M is a ,0-
position character field that stores the name of the program in ;hich the #rogram Status 1ata
Structure is specified.
The )elo; figure details the 3ile 1escription and Input Specification synta< for a #rogram Status
1ata Structure.Instead of the &#?/400 O#SS& routine > a programmer named routine may )e
specified.
>...H... 1 ...H... # ...H... % ...H... 4 ...H... ? ...H... D ...H... @ ..>
-6FKP- 6P . I D6SI I6F-S0 >PSS0
.
.
.
I SDS
6 >-6<. -6<.
6 >4P14D. 14D.
6 >S9A9=S S9A9=S
6 >0.140D 0.140D
%20 of %4&
6 >04=96F. 04=96F
.
.
.
1 >PSS0 :.7S0
1 S9A9=S 6-.A 01011
1 M4K.<V>7.96FW 0.ADA7 D
1 .C1P9 .004=9
1 .FD6-
1 ENDSRREADA"
%2% of %4&
Chapter I7: -&8 and Printer 'iles
-eport &ayout 8tility #-&8$
&!6 is one of the application de"elopment tools used to create and change report prototypes .
&!6 can )e in"o=ed either from the %S/400 command line through typing the command
ST&&!6 or )y selecting option M,(N from the .&:MCM.
-eport &ine
% record that is part of the report prototype for ;hich the user creates data descriptions
specifications.
-eport Prototype
% representation of the image of the report that a user )uilds on a display and the printed report
image> )oth of ;hich loo= li=e the actual listening created )y the application program. The report
prototype> ;hen sa"ed as a 11S source mem)er> can )e used to create a printer file> ;hich in
turn> can )e used )y an application program to create the report.
Printer 'ile /ey0ords
There are in all o"er 44 =ey;ords associated ;ith printer files. These =ey;ords are used to
pro"ide additional Eualification to the printer file at "arious le"els. #rinter file =ey;ords may )e
di"ided into the follo;ing groups:
(ile level =ey;ords that are used at the file le"el and that ;ould )e common to all the
record formats in the file.
0ecor& level =ey;ords that are used at a particular record file le"el and that ;ould )e
apply to all the constants and fields in the gi"en record formats.
(iel& "evel =ey;ords apply to particular field in a record format.
%22 of %4&
Some of the commonly used =ey;ords are detailed )elo;.
(ile "evel /e!wor&s
&+3 &eferenced 3ile
6sed to specify a file that is to )e referenced for all the su)seEuent referenced field
definitions.
S:I#% S=ip %fter
6sed to specify at the file le"el to indicate that ;hene"er a ;rite operation is issued to a
printer file> the printer is to s=ip to a specified line )efore printing the named record format.
S:I#C S=ip Cefore
6sed to specify at the file le"el to indicate that ;hene"er a ;rite operation is issued to a
printer file> the printer is to s=ip to a specified line )efore printing the named record format.
7@&SIB 7haracter SiFe
6sed to specify a character siFe to all "aria)les and constants in the named record format.
7#I 7haracters per Inch
6sed to specify the num)er of characters that are to )e printed in a inch. The "alues specified
must )e "alid for the printer used.
1&%.+& #rinter 1ra;er
6sed to specify the dra;er num)er from ;hich stationery has to )e selected for the printing
of the named record format. This is used in situation ;here mail is printed ;ith company
letter heads> continuation sheets and en"elopes )eing stac=ed in different stac=s of a multi-
dra;er printer.
@I?@!I?@T @ighlight
6sed to specify that all "aria)les and constants of the named record format are to )e
highlighted ;hile )eing printed.
!#I !ine per Inch
6sed to specify the num)er of lines allo;a)le per inch of stationery ;hile printing the named
record format.
0ecor& "evel /e!wor&s
#&T.!TG #rint 2uality
6sed to specify the print Euality to )e used ;hile printing the named record format.
S:I#% S=ip %fter
%2$ of %4&
6sed to specify at the record format le"el to indicate that ;hate"er a ;rite operation is issued
to a record format> the printer is to s=ip to a specified line after printing the named record
format.
S:I#C S=ip Cefore
6sed to specify at the record format le"el to indicate that ;hate"er a ;rite operation is issued
to a record format> the printer is to s=ip to a specified line )efore printing the named record
format.
S#%7+% Space %fter
6sed to specify at the record le"el to indicate that ;hene"er a ;rite operation is issued to a
record format> the printer is to s=ip to a specified num)er of lines after printing the named
record format.
S#%7+C Space Cefore
6sed to specify at the record le"el to indicate that ;hene"er a ;rite operation is issued to a
record format> the printer is to s=ip to a specified num)er of lines )efore printing the named
record format.
T+AT Te<t
6sed to assign descripti"e te<t to )e associated ;ith record format.
(iel& "evel /e!wor&s
&+33!1 &eferenced 3ield 9ame
6sed to specify the name of pre"iously defined field from the file indicator as the referenced
file at the file le"el.
S:I#% S=ip %fter
6sed to specify at the field le"el to indicate that ;hene"er a ;rite operation is issued to a
record format containing the field> the printer is to s=ip to a specified line after printing the
named record format.
S:I#C S=ip Cefore
6sed to specify at the field le"el to indicate that ;hene"er a ;rite operation is issued to a
record format containing the field> the printer is to s=ip to a specified line )efore printing the
named record format.
$NO,E: The use of )oth S:I# =ey;ords is not "alid ;hen specifying line num)ers.'
%24 of %4&
S#%7+% Space %fter
6sed to specify at the record le"el to indicate that ;hene"er a ;rite operation is issued to a
record format> the printer is to s=ip to a specified num)er of line after printing the named
record format.
S#%7+C Space Cefore
6sed to specify at the record le"el to indicate that ;hene"er a ;rite operation is issued to a
record format> the printer is to s=ip to a specified num)er of lines )efore printing the named
record format.
T+AT Te<t
6sed to assign descripti"e te<t to )e associated ;ith record format.
TIM+ Time
6sed to specify that the system time is to )e retrie"ed and printed in the specified position.
Processing Printer 'iles in -P6 Programs:
(ile %pecifications:
In the &#? program the printer file is declared in the (ile specifications ;ith the follo;ing
definitions.
Type of the file is MON for Output.
1e"ice is M#&I9T+&N
In the 0@ calculation specification.
.ithin the calculation specification there ;ould )e no reference to the printer file name. all
references ;ould )e to the record formats defined in the printer file.
To ;rite a particular record format> use one of the follo;ing opcodes.
.&IT+ H for program-descri)ed printer files.
.hen ;riting printer file record formats al;ays ensure that the current print line is less than
the o"erflo; line. %lso ensure )efore ;riting a record format> that the enough num)er of
lines a"aila)le to )e printed in a page.
%dditional &ecommended &eading Material
,. S70(-,4,5-0- &!6 6sers ?uide and &eference.
%2. of %4&
Chapter 7: Introduction "o Control &anguage
7ontrol language is used to string a group of system commands together to perform "ariety of
system functions. Cy stringing together these commands ;e can e<ecute these operations )y
merely in"o=ing a program rather than e<ecute a group of commands indi"idually.
Command Structure
% system command consists of three )asic parts namely> the command name> parameter name
and a parameter "alue. 3or e<ample> in the follo;ing command>
7&T1T%%&% 1T%%&%$!IC%/%&%0,' !+9$,00' TG#+$O7@%&'
The command> 7&T1T%%&% $7reate 1ata %rea' and the parameters ;ith the corresponding
"alues are
1T%%&% !IC%/%&%0,
!+9 ,00
TG#+ O7@%&
.hen this command is e<ecuted> the parameters may )e entered in any one of the follo;ing
forms. #ositional form> only the parameter "alues are entered or =ey;ord form> )oth the
parameter name and the corresponding parameter "alue are entered or )oth #ositional and
=ey;ord form commands are entered.
Positional 'orm
.hen entering commands using only #ositional entries> all the parameters used must )e entered
seEuentially. 3or e<ample> consider the follo;ing command.
%11%0+ %dd autostart *o) entry.
This command uses the three parameters ;hich are
SCS1 Su)system name
0OC 0o) name
0OC1 0o) 1escription name
These three parameters ha"e )een listed here in the seEuence in ;hich the command e<pects
them. Therefore> using the #ositional entry method of entering a command> ;e may e<ecute the
command as follo;s.
%11%0+ %C7 1+3 AGB
;here>
%C7 is ta=en )y the system as )eing the su)system name
1+3 as )eing the *o) name> and
%2* of %4&
AGB as )eing the *o) description name.
Therefore> ;hen using the positional entry method of entering a command> ;e must )e "ery
careful that the seEuence in ;hich ;e enter the parameter "alues is e<actly the same seEuence in
;hich the system e<pects the "alues.
/ey0ord )orm
.hen entering commands using =ey;ord entries> e"ery parameter must )e entered ;ith the
parameter name. 3or e<ample> the add autostart *o) entry command $%11%0+' may )e entered
as >
%11%0+ SCS1$%C7' 0OC$1+3' 0OC1$AGB'
Since the parameters are )eing entered ;ith the parameter name and the parameter "alue> the
seEuence of the parameters may )e changed. The same command ;ould e<ecute *ust the same
e"en if it is entered as
%11%0+ 0OC$1+3' 0OC$AGB' SCS7$%C7'
:oth positional and /ey0ord )orm
7ommands may )e entered using a com)ination of )oth the #ositional form and the =ey;ord
form. 3or e<ample> consider the follo;ing command.
%117M9+ %dd communications entry
This command uses e"en se"en parameters ;hich are>
SCS1 Su)system description
1+D 1e"ice name
&MT!O79%M+ &emote location name
0OC1 0o) description
13T6S& 1efault user
MO1+ Mode
M%A%7T Ma<imum num)er of acti"e *o)s allo;ed
This command may )e entered in the )oth form as follo;s.
%117M9+ %C7 1+3 AGB M%A%7T$-' 13T6S&$2#?M&'
;here>
%C7 is ta=en )y the system as )eing the su)system name
1+3 is )eing the de"ice name
'elimiters
1elimiters are special characters used to separate the "arious components of a 7! statement. The
follo;ing are "alid 7! delimiters.
%27 of %4&
M:N Separates a command la)el from the command name li=e
!%C+!:7&T#3 3I!+$!IC%/3I!+%' &71!+9$4']
MN Separates a command name from the command parameter and also separates the "arious
parameters of a command.
$' %re used to enclose parameter "alues
M/N Separates the parts of a Eualified name li=e !IC%/3I!+% or &+73MT,/3!100,
M.N or M>N 6sed to indicate decimal point.
M N 6sed to enclose string e<pressions> li=e T+AT$M7ustomer Master 3ileN'
/O O/ 6sed to enclose comments in a 7! program li=e /O This is a test li)raryO/
Command Continuation
7ommands may )e continued o"er one line ;ith the use of a M-Mor MUN sign. .hen used> either of
these t;o characters are the last characters in the statement. The follo;ing e<amples illustrate
the use of these characters as ;ell as highlight the difference )et;een these t;o characters.
7&T!IC !IC $T+ST!IC' T+AT$MThis is a test-
li)raryN'
7&T!IC !IC $T+ST!IC' T+AT$MThis is s test U
li)raryN'
.ariable naming synta1
%ll "aria)le ;ithin 7! programs may )e a ma<imum of ,0 characters. Daria)le names may not
include em)edded )lan=s and must al;ays )egin ;ith MVN.The second character must al;ays )e
an alpha)etic character. Dalid e<amples of 7! "aria)le names are:
V3!1%
V3!100,
V%,
Concatenation
Daria)les and constants may )e concatenated or stringed together for "arious reasons using any
of the follo;ing synta<. The "arious methods of concatenation are:
,. O7%T represents as __
O7%T or __ concatenates t;o "aria)les or constants as they are.
-. OC7%T represented as _T
OC7%T or _T ;ould strip out the trailing )lan=s of first string and insert one )lan= space.
)et;een the t;o components )eing concatenated.
8. OT7%T represented as _W
%2& of %4&
OT7%T or _W ;ould strip out the trailing )lan=s of first string> then *oin that ;ith the second
string.
The follo;ing are the e<amples of the "arious types of concatenation discussed a)o"e.
V3!1% is defined as 4% and contains "alue M%C71+N
V3!1C is defined as % and contains "alue M,-84 M
V3!1% O7%T MT+ST0,N M%C71T+ST0, M
V3!1% OC7%T V3!1C M%C71+ ,-84 M
V3!1C OT7%T MT+ST0,N M,-84T+ST0,N
-elational E1pressions
The follo;ing are "alid relational e<pressions allo;ed for use in 7! programs.
,. S O+2 +Eual to
-. T O?T ?reater than
8. W O!T !ess than
4. TS O?+ ?reater than or eEual to
4. WS O!+ !ess than or eEual to
5. -_ O9+ 9ot eEual to
7. -_T O9? 9ot greater than
. -_W O9! 9ot less than
&ogical E1pressions
The follo;ing are "alid logical e<pressions allo;ed for use in 7! programs.
,. V O%91 %nd
-. _ OO& Or
8. -_ O9OT 9ot
Substring e1pressions
#arts of alphanumeric "aria)les may )e e<tracted using the su)string function. % su)string
function may )e used either as XS6CST&I9? or XSST. The su)string specifies the "aria)le
name> the starting position and the num)er of characters to )e e<tracted. 7onsider the follo;ing
%20 of %4&
e<ample ;here V3!1% is defined as % and contains "alue M%C71,-844N.The su)string
e<pression
XS6CST&I9? $V3!1% 4 8'
;ould e<tract 8 characters of the "alue of the "aria)le V3!1% starting from position
4.Therefore> the result of this su)string operation ;ould )e M1,-N.
8sing variable in a C& program
%ll "aria)le in a 7! program must )e declared in the program using the 17! statement. The
format of a 17! statement is as follo;s.
17! D%&$V3!1%' !+9$,0' TG#+$O7@%&'
17! D%&$V3!1C' !+9$5' TG#+$O1+7'
17! D%&$V3!17' !+9$( -' TG#+$O1+7'
% 7! program may not address or use any "aria)le that is not declared in the program.
.hen used> 17! statements must immediately follo; the #?M statement.
8sing )iles in C& program
% 7! program may use a ma<imum of one file of any type. This file is declared to the 7!
program using the 17!3 file. The format of a 17!3 statement is as follo;s:
17!3 3I!+$3I!+%'
The record format parameter &713MT of the declare file command may optionally )e used to
restrict the access of the program to only the named record format$s'.If not mentioned> the
program is allo;ed access to all the record formats in the file.
% 17!3 statement must immediately follo; the 17! statement $if a 17! statement is used' or
the #?M statement and must al;ays precede all other statements ;ithin the 7! program.
%ny "aria)le defined in a file declared in a 7! program need not )e declared ;ithin the 7!
program using 17! statement. These "aria)les can )e addressed ;ithin the 7! program using
the MVN naming con"ention for 7! program "aria)les.
'ile (perations
The follo;ing are the only "alid operations that can )e performed on files in a 7! program.
&7D3 3I!+$3I!+%' &eads a record from the named file
%$0 of %4&
S913 3I!+$3I!+C' .rites a record from the named file
S91&7D3 1+D$O3I!+' &+73MT$O3I!+' 1isplays a record format from the display
file for user input.$This operation is the eEui"alent of an +A3MT operation in a 7! program'
Error Handling
%ll system errors encountered during the e<ecution of a 7! program can )e trapped ;ithin a 7!
program ;ith the use of a MO9MS? statement. The MO9MS? command can )e e<ecuted at
the program le"el or the command le"el. The placement of the MO9MS? command
determines ;hether it is a program le"el or command le"el MO9MS?.
To implement the MO9MS? command at the program le"el > ;e can code the MO9MS?
command immediately after the last 17! Statement or ;hen there are no 17! statements>
Immediately after the #?M statement.
To implement the MO9MS? at the command le"el > ;e can code the MO9MS? immediately
after the command that ;e ;ant to monitor.
.e can monitor messages either specifically or generically.
Assigning .alues
Daria)les can )e assigned "alues H constants> "aria)les or computed H using the change "aria)le
command 7@?D%&. Some e<amples of 7@?D%& command usage are
7@?D%& D%&$V3!1%' D%!6+$M%C71+N'
7@?D%& D%&$V3!1C' D%!6+$MV3!1C U ,'
7@?D%& D%&$OI9:-4 ' D%!6+$M,N'
7@?D%& D%&$V3!17' D%!6+$$V3!1A U V3!1G' O V3!1-'
&ogical (perations
The I3 command can )e used to perform logical operations.
I3 7O91$V3!1% O+2 M%CN' T@+9$?OTO 7M1!C!$O#+9''
+!S+ +A+7$7&T#? 3I!+$!IC%/3I!+%' S&73I!+$!IC%/S&73I!+%'
%n +!S+ statement may optionally )e used ;ith an I3 statement
%dditional &ecommended &eading Material
%$% of %4&
,. S7-,-077-- 7ontrol !anguage: #rogrammerNs ?uide-Dol I and II
-. S74,-00800-0- 7ontrol !anguage: &eference H 8 Dolumes
%$2 of %4&
Chapter 7I: (pen =uery 'ile :asics
O#92&G3 is the "ery po;erful command that allo;s the programmer to select record
dynamically )ased on "ariety of selection criteria $Including field mapping> groupings and the
results of mathematical calculations'.1epending on the selection criteria specified >the
O#92&G3 command may ma=e use of e<isting file access paths to e<tract the desired data> or it
may construct an access path of its o;n.
One crucial point to remem)er ;hen using O#92&G3 is that you must use the S@%&+$OG+S'
file attri)ute for each file opened )y the O#92&G3 command. .hen you specify
S@%&+$OG+S'> su)seEuent opens of the same file ;ill share the original open data path and thus
see the file as presented )y the O#92&G3 process. If O#92&G3 opens a file using the
S@%&+$O9O' attri)ute> the ne<t open of the file ;ill not use the open data path created )y the
O#92&G3 command> )ut instead ;ill perform another full open of the file.
The follo;ing is a list of the ma*or functions supplied )y O#92&G3.
1ynamic record selection
1ynamic =eyed seEuence access path
1ynamic =eyed seEuence access path o"er a *oin
1ynamic *oin
@andling missing records in secondary *oin files
6niEue-=ey processing
Mapped field definitions
?roup processing
3inal total-only processing
Impro"ing performance
Sort seEuence processing
(pen data Path#(!P$ :
Gou ;rite an &#? program to read it in the order in ;hich the records ;ere ;ritten to the file.
This is called arri"al seEuence.
.hen you start the program> the system opens the file and ma=es it a"aila)le to the
#rogram through an open data path. The open data path is> in this case> one that loo=s at the file
in relati"e record num)er $&&9' seEuence.
%$$ of %4&
%n open data path> therefore> is the channel through ;hich an application can access the records
in a file. The same file could )e used )y another &#? program ;hich is coded to read the file
randomly )y =ey. Since the =ey is used> the open data path uses the record =eys - not the &&9Ls.
In this case> therefore> ;e use a =eyed seEuence. 6nder most circumstances> the O1# can )e
thought of as the file itself> although in reality they are t;o entirely different concepts.
!etLs use an e<ample. Suppose a file consists of se"eral records ;ith a field called State7ode. If
someone as=ed you to sort the file so you could sho; only records from 7alifornia and ordered
)y 9ame> you could do this "ery easily in O#92&G3. The O1# ;ould point to only those
records ;hose 7ode S J7%J and order them )y a =ey called 9ame. .e did not ha"e to create a
ne; file ;ith records> simply use the O1# from the physical file and access the records thru 7!.
The O1# contains only pointers to the actual records in the physical file> indicating ;hich
records to retrie"e and in ;hat order. Gou can say that O#92&G3 creates a logical "ie; o"er
the physical file.
=->SE&EC"
2&GS!T is the parameter that determines ;hich records to include in the open data path created
)y O#92&G3. It entails a series of comparisons *oined ;ith %91Ls and O&Ls - the =ind of
comparisons that reads Jthe amount due $contained in %MT16+' is greater than `4000 and the
last payment $!ST#MT' ;as at least ,-0 days old.J 2&GS!T> therefore sounds li=e it should
recei"e a logical e<pression "ery much li=e the I3 commandLs 7O91 parameter:
I3 7O91$V%MT16+ O?T 4000 O%91 V!ST#MT O?+ ,-0'
Gou could try entering something li=e that in O#92&G3Ls 2&GS!T #arameter> remo"ing the
ampersands $V'> )ut it ;onLt ;or=:
O#92&G3 2&GS!T$%MT16+ O?T 4000 O%91 !ST#MT O?+ ,-0'
The reason it doesnLt ;or= is )ecause the 2&GS!T parameter ;onLt accept a logical "alueI it
e<pects a character string. The correct ;ay to code 2&GS!T> therefore is:
O#92&G3 2&GS!T$L%MT16+ O?T 4000 O%91 !ST#MT O?+ ,-0L'
%s you can see> the entire contents of 2&GS!T must )e enclosed in single Euotes )ecause
2&GS!T reEuires a character "alue> and character "alues ;ith em)edded )lan=s must )e
enclosed in single Euotes.
9otice that numeric constants are not enclosed )y t;o apostrophes $Euotation mar=s'.
.hen comparing a field "alue to a 7! "aria)le> use apostrophes as follo;s $only character 7!
"aria)les can )e used':
If doing selection against a character> date> time> or timestamp field> specify:
O#92&G3 3I!+$3I!+%' 2&GS!T$LJL O7%T V7@%& O7%T LJ O+2 3I+!1%L'
%$4 of %4&
or> in re"erse order:
O#92&G3 3I!+$3I!+%' 2&GS!T$L3I+!1% O+2 JL O7%T V7@%& O7%T LJL'
9otice that apostrophes and Euotation mar=s enclose the 7! "aria)les and O7%T operators.
If doing selection against a numeric field> specify:
O#92&G3 3I!+$3I!+%' 2&GS!T$V7@%&96M O7%T L O+2 96ML'
or> in re"erse order:
O#92&G3 3I!+$3I!+%' 2&GS!T$L96M O+2 L O7%T V7@%&96M'I
9otice that apostrophes enclose the field and operator only.
Steps involved in a typical (P+=->' program:
,. Cegin ;ith an O"erride 1ata)ase 3ile $OD&1C3' command> specifying S@%&+$OG+S'. If
necessary> add other o"errides as your application reEuires> such as> o"erriding to a mem)er
other than O3I&ST.
-. Specify the O#92&G3 command ;ith the parameters
8. 7all your &#? program/any @!! #rogram that processes the file. The @!! program should
)e coded as if it ;ere going to process the entire file> ;ithout any pro"isions for record selection
or ordering> since O#92&G3 has already done this *o).
4. 7all the 7lose 3ile $7!O3' command.
4. 7all the 1elete O"erride $1!TOD&' command to remo"e the o"errides created )y step R,.
E1ample:
P7M
D1< KA0(X5.A0) 95P.(>18A0) <.F(#)
09KS5SKA< S5SKA<(A5.A0) 09FKA0(X5.A0)
4K0D:- -6<.(40DMS9) 94-6<.(JAF.<6:/40DMS9) S8A0.(>5.S)
4PFA05- -6<. ((40DMAS9)) A05S<9(V(414D. >F. YDZ) >AFD H
(YW >1A9 X5.A0 >1A9 VZ >.A RSS9(DA9. ? #))W) H
I.5-<D((4K.FD0) (46FAM.)) H
MAP-<D((DA9. VRD6769S(4DA9.)W))
1A<< P7M(40D0P9#) //Proce""ing Program
1<4- 4PF6D(40DMS9)
D<94K0 -6<.(40DMS9)
.FDP7M
%dditional &ecommended &eading Material
,. 1C- 61C for %S/400 1ata)ase #rogramming
%$. of %4&
Chapter 7II: 3essage Sub)iles in -P6
3essage Sub)iles
Message subfiles are special subfiles designed to hold messages. Message
subfiles have some unique properties that make them very useful. They load
themselves automatically from messages on a given program message
queue. Message subfiles also allow users to view the second-level help text
associated with a message, without any additional programming effort.
Message subfiles make it possible to setup a consistent set of information,
warning, or error messages in a message file for a given program or
application, and to display those messages to the user with the greatest of
ease. With ust a little direction from your !"# and $$%, message subfiles
pretty much take care of themselves.
Steps Involved :
Set up a message file $OMS?3' containing the messages you ;ant to use in your
application. Gou can use an e<isting message file or create your o;n. Gou should not
usually modify system-supplied message files> such as 27#3MS?. Message files are
created ;ith the 7&TMS?3 command. 9e; messages can )e added "ia the %11MS?1
command or the .&:MS?3 command.
1efine a message su)file in your display file.
7ode your application program to send program messages to the program message Eueue.
The )est ;ay to accomplish this in &#? is to use the 2M@S91#M $Send #rogram
Message' %#I. Gou can also use the S91#?MMS? command> )ut the )est place to use
that command is in a 7! program.
%fter displaying the message su)file> clear the messages from the program message
Eueue using the 2M@&MD#M $&emo"e #rogram Message' %#I.
&or every call stack entry, which can be an '"M program or an ()*
procedure, there exists a corresponding program message queue with the
same name. ( created my own message file, but you can certainly use the
system-supplied messages and plug in your own text. &or instance, if users
are accustomed to seeing message ($ +"&,-,- from the system-supplied
message file, .+"&M%#, as being something serious, you could still use
that message ($ and substitute your own message. This doesn/t mean you
change the +"&,-,- message in the actual message file. 0ou simply
%$* of %4&
override the message text in your program. (f there are substitution
parameters associated with a specific message, you can also fill in those
parameters using the program message 1"(s. (f message files aren/t your
bag, you can also send text messages to the program message queue and
use no message file at all. )et/s look at some code.
E1ample :
The $$% example, consists of three record formats2 %+!**34, M%#%&),
and M%#+T). &MT4 is the primary screen, and it allows the user to enter
data. 1s you will see in the !"#, this data isn/t going anywhere5 its purpose
is purely to demonstrate how to use a message subfile. M%#%&) is the
message subfile record format, and M%#+T) is the control format for
M%#%&). These formats work much the same way as regular subfile control
and record formats. There are, however, some differences between regular
subfiles and message subfiles.
With regular subfiles, you have to handle the loading and clearing in your
program. Typically, in your !"# program, you will set on the indicator used
to condition the %&)+)! keyword in your $$%, write to the subfile control
format, and set off the indicator to get ready to load and display. With
message subfiles, you don/t explicitly clear the subfile in your program5
rather, you link the subfile to a program message queue and remove
messages from that message queue. This, in essence, clears the subfile.
This same theory holds true for loading the subfile. When displaying subfile
records in a regular subfile, you must first execute some sort of load
routine. This routine usually consists of a $' loop that reads records from a
database file and writes them to the subfile record format. Message subfiles
will have none of that. 6y linking the message subfile to a specific program
message queue and sending messages to that queue, the message subfile
will automatically load itself with records from the program message queue.
Message subfiles require the use of several special $$% keywords, listed
below.
(n the message subfile record format, the following keywords are required2
%(")%@0C' is used to set the starting line on the display for the
message subfile. (n most cases it is set to 78 9the bottom line of the
display:, but you could display more than one message at a time, in
which case you would set this parameter accordingly.
%(")%@/EO controls the message =ey of the first message that is to )e displayed in
the message su)file. +"ery message on a message Eueue has a uniEue message =ey that is
assigned as the message arri"es on the message Eueue. In certain cases> you may ;ish to
maintain old messages on the Eueue and only display messages from a certain point
%$7 of %4&
for;ard in the message su)file. Setting the message =ey allo;s you to control ;hich
messages are displayed.
%("@)D controls ;hich program message Eueue the messages are pulled from. In my
e<ample> it is )eing populated ;ith the name of the program from the program status data
structure in the &#? program or .e can e<plicitly pass the #rogram name. This
techniEue allo;s you to easily copy the message su)file record formats into a ne;
display file> ;ith no changes reEuired to the display file. Of course> the "#M. field
must )e declared .
When in a message subfile, %&)+T), %&)%(;, %&)"1#, %&)$%", %&)*3$,
and %&)$%"+T) behave normally, except that %&)$%" and %&)$%"+T)
must be used without conditioning indicators. 1lso, %&)"1# must be at
least one less than %&)%(; in a message subfile5 they cannot be equal.
Message subfiles are considered load-all subfiles. 3otice also that ( don/t
use the <M'!* parameter on my message subfile. The reason is, using the
<M'!* parameter causes =More...= and =6ottom= to display one line under
the last line on the display. %ince ( am using line 78, which is the last
possible line on the display, ( would get an error if ( tried to use the <M'!*
parameter. The plus sign 9>: works for me, but if you/re dying to use
<M'!* with your message subfiles, try starting on line 7?--
%&)M%#!+$97?:--and keeping %&)"1# as 4. Then you won/t get an error.
)et/s look at the differences in the way %&)(3; keyword behave when it is
in a message subfile.
%&)(3;, in the case of a message subfile, causes the system to
automatically load the subfile with messages from the message queue
specified. This is different from its use with regular subfiles. (n
regular subfiles, %&)(3; loads the subfile with the number of records
indicated by %&)%(; and sets the fields to their default values.
DDS S<B?02-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
A 1-0%(0%)
A 8.<P
A 0 -M91
A 4K.0<A5
A # %B-=<< S10..FB
A -<D1 10 : % %
>
A 0 MS7S-< S-<
> Me""age "'!file recor)
> S-<MS701D control" which line the me""age "'!file "tart" on.
> S-<MS7I.5 control" the me""age e2 of the me""age that i" to
> !e the fir"t one )i"pla2e).
> S-<P7MA control" which program me""age M'e'e me""age" are p'lle) from.
>
A S-<MS701D(#4)
A MS7I.5 S-<MS7I.5
A P7MA S-<P7MA
%$& of %4&
> Me""age "'!file control recor)
> S-<PA7 + S-<S6G to allow the "2"tem to control page 'p an) )own
> in the "'!file. 9he "'!file will !e a'tomaticall2 e/ten)e)
> !a"e) on the n'm!er of entrie" in the program me""age M'e'e.
> S-<DSP an) S-<DSP19< ca'"e the "'!file an) control recor) to !e
> )i"pla2e) when the control format i" thrown
> S-<6FG; in thi" ca"e; ca'"e" the "2"tem to a'tomaticall2 loa)
> the "'!file with me""age" from the me""age M'e'e "pecifie)
> S-<P7MA control" which program me""age M'e'e me""age" are p'lle) from
> S-<.FD with in)icator" that alwa2" eval'ate to 90=.; allow" the
> "2"tem to a'tomaticall2 toggle the SHS "ign that in)icate" if
> there are more recor)" to )i"pla2 in the "'!file.
A 0 MS7S-<1 S-<19<(MS7S-<)
A S-<S6G(000#)
A S-<PA7(0001)
A 4K.0<A5
A S-<DSP
A S-<DSP19<
A S-<6FG
A &3 S-<.FD
A P7MA S-<P7MA
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.n) of Data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
RP" S<B?02-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--S# 1- . W40IS9F
>con"tant for the me""age
6 B-6<. <6:0A05 B1 MS71FS
>
> S.FD MS7000% -04M M.SSA7. -6<. CG51%%@ 94 P0470AM M.SSA7. A=.=.
1 M4K.< BMS7000%B MS76D
1 M4K.< BCG51%%@B MS7-
1 M4K. MS71FS MS7D9A D#
1 M4K. B6B MS74P9
1 .CS0 S.FD
>
> S.FD MS70001 -04M M.SSA7. -6<. CG51%%@ 94 P0470AM M.SSA7. A=.=.
1 M4K.< BMS70001B MS76D
1 M4K.< BCG51%%@B MS7-
1 M4K. B6B MS74P9
1 .CS0 S.FD
>
> S.94F S-<.FD 6FD61A940 -40 M.SSA7. S=:-6<.
1 S.94F &3
> W069. M.SSA7. S=:-6<.
1 W069. MS7S-<1
> W069./0.AD 0.7=<A0 S10..F -40MA9
1 .C-M9 -M91
> 1<.A0 98. P0470AM M.SSA7. A=.=.
1 M4K. B1B MS74P9
1 .CS0 S.FD
>
%$0 of %4&
> W069. M.SSA7. S=:-6<.
1 W069. MS7S-<1
> W069./0.AD 0.7=<A0 S10..F -40MA9
1 .C-M9 -M91
1 M4K. B1B >6F<0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1 >6FGS0 :.7S0
> M4K. 98. P0470AM FAM. 94 98. P0470AM M.SSA7. A=.=. -6.<D
1 M4K.< BMS7S-<P7B P7MA
1 M4K. BM B P7MA
1 .FDS0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 986S S=:04=96F. 1A<<S A 1< P0470AM 98A9 S.FDS 98. M.SSA7.
> 94 98. P0470AM M.SSA7. A=.=..
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1 S.FD :.7S0
1 1A<< BS.FDP7MB
1 PA0M MS76D @
1 PA0M MS7- 10
1 PA0M MS7D9A D#
1 PA0M MS74P9 1
1 .FDS0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.n) of Data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CL P?<4?.: A< S2;1 M2@@.42@-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
P7M PA0M(XMS76D XMS7- XMS7D9A XMS74P9)
D1< KA0(XMS76D) 95P.(>18A0) <.F(@)
D1< KA0(XMS7-) 95P.(>18A0) <.F(10)
D1< KA0(XMS74P9) 95P.(>18A0) <.F(1)
D1< KA0(XMS7D9A) 95P.(>18A0) <.F(D#)
6- 14FD(XMS74P9 >.A B6B) 98.F(SFDP7MMS7 H
MS76D(XMS76D) MS7-(XMS7-) MS7D9A(XMS7D9A))
6- 14FD(XMS74P9 >.A B1B) 98.F(0MKMS7 P7MA(>P0K H
(>)) 1<.A0(>A<<))
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.n) of Data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
USIN" API@ 6;@A2.1 <3 . CL-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> Sen) me""age "'!ro'tine
>
c "n)m"g !eg"r
c call BAM8SFDPMB
c parm m"g6)
%40 of %4&
c parm m"g<oc
c parm m"g0plDta
c parm m"g0plDta<en
c parm m"g92pe
c parm m"gA'e'e
c parm m"g1allStac
c parm m"gIe2
c parm m"g.rr
c en)"r
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 0emove me""age "'!ro'tine
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
c rmvm"g !eg"r
>
c call BAM80MKPMB
c parm m"gA'e'e
c parm m"g1allStac
c parm m"gIe2
c parm m"g0mv
c parm m"g.rr
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%4% of %4&
Appendi1 A : -P6 (pcodes
4peration !o'es in +,-/400
Co&es (actor - (actor . 0esult (iel& 0esultin$ In&+
%72 2&?&7O#
#
.O&:ST9
file
- +& -
%11$,/-' %ddend %ddend Sum U - B
%91<< 7omparand 7omparand
C+?S& Su)routine
name
CITO3 Cit num)ers 7haracter field
CITO9 Cit num)ers 7haracter field
7%C<< 7omparand 7omparand !a)el @I !O +2
7%!! #rogram
9ame
#!IST name -- +& !&
7%S<< 7omparand 7omparand Su)routine
9ame
@I !O +2
7%T $p' Source
String ,
Source String
-:9um)er of
Clan=s
Target String
7@%I9$n' Search
argument
3ile name 1ata Structure 9& +& --
7@+7: 7omparator
String
Case String :
start
!eft most
#osition
-- +& 31
7@+7:&$-' 7omparator
String
Case String :
start
&ight most
#osition
-- +& 31
7!+%& O9O:+G Structure or
Daria)le
7!OS+ 3ile 9ame -- +& --
7OMIT Coundary -- +& --
7OM#$,' 7omparand 7omparand @I !O +2
1+C6? Identifier Output file 1e)ug
Information
1+39 O!I:+ &eferenced
field
1efined field
1+39 O9%MD%
&
Internal
program area
+<ternal data
area
1+!+T Search
%rgument
3ile name 9& +& --
1ID $,/-' 1i"idend 1i"isor 2uotient U - B
%42 of %4&
1O Starting
Dalue
!imit Dalue Inde< Dalue
1O6<< 7omparand 7omparand
1O.<< 7omparand 7omparand
1S#!G Message
identifier
Output Eueue &esponse -- +& --
16M# Identifier
+!S+
+91 Increment
Dalue
+917S
+911O Increment
Dalue
+91I3
+91S!
+91S& !a)el &eturn point
+A7#T +A7#T 9ame
Co&es (actor - (actor . 0esult (iel& 0esultin$ In&+
+A3MT &ecord format
name
-- +& --
+AS& Su)routine
name
3+O1 3ile name -- +& --
3O&7+ 3ile name
3&++ #rogram
name
-- +& --
?OTO !a)el
If<< 7omparand 7omparand
I9 O!O7: 1ata area
name
-- +& --
IT+&
:3!1 :ey 3ield
:!IST :!IST name
!+%D+
!O:6# $,'
$%rray'
Search
argument
%rray name @I !O +2
!O:6# $,'
$Ta)le'
Search
argument
Ta)le name Ta)le name @I !O +2
M@@BO Source field Target field
M@!BO Source field Target field
M!@BO Source field Target field
M!!BO Source field Target field
%4$ of %4&
MOD+ $p' Source field Target field U - BC
MOD+% $#' Source Target U - BC
MOD+! Source field Target field U - BC
M6!T $,/-' Multiplicand Multiplier #roduct U - B
MD& &emainder U - B
9+AT #rogram
1e"ice
3ile name - +& -
O776& Occurrence
Dalue
1ata Structure Occurrence
Dalue
- +& -
O#+9 3ile 9ame - +& -
O&<< 7omparand 7omparand
OT@+&
O6T O!O7: 1ata area
name
- +& -
#%&M Target field Source field #arameter
#!IST #!IST name
#OST $8' #rogram
de"ice
3ile name I931S name - +& -
&+%1 $n' 3ile name>
&ecord name
1ata Structure - +& +O3
&+%17 $n' Search
argument
3ile name>
&ecord name
1ata Structure - +& +O3
&+%1+ $n' Search
argument
3ile name>
&ecord name
1ata Structure - +& +O3
&+%1# $n' 3ile name>
&ecord name
1ata Structure - +& CO3
&+1#+ $n' Search
argument
3ile name>
&ecord name
1ata Structure - +& CO3
&+! #rogram
de"ice
3ile name - +& -
&+S+T O9O:+G Structure or
Daria)le
%44 of %4&
Co&es (actor - (actor . 0esult (iel& 0esultin$ In&+
&+T&9
&O!C: - +& -
S7%9 $-' 7omparator
string :
length
Case string :
start
!eft-most
position
- +& 31
S+!+7
S+T?T Search
argument
3ile name 9& +& -
S+T!! Search
argument
3ile name 9& +& +2
S+TO3 $,' O3 O3 O3
S+TO9 $,' O9 O9 O9
S@T19 O9 - -
SO&T% %rray name
S2&T $,/-' Dalue &oot
S6C $,/-' Minuend Su)strhend 1ifference U - B
S6CST $p' !ength to
e<tract
Case string :
start
Target String - +& -
T%? !a)el
T+STC $,' Cit num)ers 7haracter field O3 O9 +2
T+ST9 $,' 7haracter field 96 C9 C!
T+STB $,' 7haracter field
TIM+ 9umeric field
69!7: 1ata area>
record or file
name
- +& -
6#1%T 3ile name 1ata structure - +& -
.@<< 7omparand 7omparand
.&IT+ 3ile name 1ata structure - +& +O3
A3OOT $,/-' %rray name Sum U - B
A!%T+ $#' 3rom :To String :start Target String - +& -
B-%11 %ddend Sum U - B
B-S6C Su)trahend 1ifference U - B
"e$en&:
$,' %t least one resulting indicator reEuired.
$-' % found indicator is reEuired if the result field is not specified.
$8' Gou must specify factor - or the result field. Gou may specify )oth.
$#' #ad the result ;ith )lan=s.
$,/-' @alf ad*ust the result.
$n' 9o loc=.
%4. of %4&
%4* of %4&
Appendi1 : : AS/400 !ata &imits
S/400 (ata limits)
7tes in one record +2,:??
Fields per record ),***
6e fields in one record 120
6esiCe in btes 256
0ecords in one file 16,777,215
7tes in one file 2,1(:,()+,?()
#atabase siCe siCe of disD storage
Logical Files ';ieEs, from one phsical file +,?)?
%hsical files used in one Logical File ';ieE, +2
9aximum files in a F2I8 +2
9aximum field siCe in btes +2,:??
9aximum decimal number @,@@@,@@@,@@@,@@@,@@@,@@@,@@@,@@@,@@@,@
@@
%47 of %4&
Appendi1 C : !P5/400 !estrictions
(unction 0estriction
%9/O& lines $positions 7 and of calculation
specifications'
Ma<imum of 7 per operation.
%rrays and ta)les Ma<imum of -00 per program.
%rray/ta)le input record length for compile time Ma<imum length is 0.
7haracter field length Ma<imum length is -45.
7ontrol fields $position 4( and 50 of input specifica-tions'
length
Ma<imum length is -45.
1ata structure length Ma<imum of ((((.
1ata structure occurrences $num)er of' Ma<imum of (((( per data structure.
+dit .ord Ma<imum length of -4 for literals or ,,4 for named
constants.
+lements in an array/ta)le $positions 85 through 8( of
e<tension specifications'
Ma<imum of (((( per array/ta)le.
3ile Ma<imum of 40 per program.
!e"els of nesting in structured groups Ma<imum of ,00.
!oo=-ahead 7an )e specified only once for a file. 7an )e specified
only for primary and secondary files.
9amed 7onstant Ma<imum length of -45 for character named constant>
4,- for he<adecimal named constant> and 80 digits ;ith (
decimal positions for numeric named constant.
O"erflo; indicator Only , uniEue o"erflo; indicator can )e specified per
printer file.
#arameters Ma<imum of -44
#rimary file $# in position ,5 of file description specifi-
cations'
Ma<imum of , per program.
#rinter file $#&I9T+& in positions 40 through 45 of file
description specifications'
Ma<imum of per program.
#rinting lines per page Minimum of -I ma<imum of ,,-.
#rogram status data structure Only , allo;ed per program.
&ecord address file $& in position ,5 of file description
specifications'
Only , allo;ed per program.
&ecord length for program descri)ed file $positions -4
through -7 of file description specifications'
Ma<imum length is ((((.
Structured groups $see le"els of nesting'
Su)routines Ma<imum of -44 per program.
Ta)les $see arrays'
%ny de"ice record siFe restraints o"erride this "alue.
%4& of %4&