Text preview for : SB21-0771-1_FDP_QueryFacilityForSystem3_ProgramDescription_OperationsManual_5798-ANB.pdf part of



| Home

s B 21 - 0 7 7 r - L




Field
Developed
Program Query Facility For Systern,/3


Program Number: 5798-ANB

Program Descripti-on/ This manual describes the capabilities
Operations l'lanual of the system and the proqrams. Dis-
cussion of design assumptions and
potential modification areasi are
included. Record and file l.ayouts
are described and primary processing
procedures specified. This manuaf is
both a system description and an in-
stallation and operations reference
document.

This is a reprint of SB21-0'77L-0
incorporating changes relea:sed in the
following technical newslet'ber:

sN20 6L37
-




IBnf;
P R'SGRAMMf l\-G tiE IiV I Ci:S

Durrng a specifiec numh)c:r f months immediately following
o
rnitial" avaii abiiit.y r:f each ricensed program designated as
t.he Prcgrarrunj-ng s+::rvices; perj,od, and refeienced in the sup-
plement- to Amended i,tcei'rse Agreement for IBM program prodi:cts,
the cus;tomer may submrt documentation to a desigiated rBM
.iocation when he encount.ers a problem which his diagnosis
indicates r-s caused i:y d, r-rcenlecl program error. During this
period only, IBM tirrouqli the program sponsor(s) will, with-
out adclitionerl charge, r'esponci to an error in the current
unartered rel-ease of the: l-icensed program by issuing known
error correct-ion intorna,tion to the Customei reporting the
probrem and/c>r i.ssuing corrected code or notice of aviit-
ability of corrected. coiie. However, rBM does not guarantee
service resul,ts cr reprrsent or warrant that all errors will
be corrected. Any on*sjte programrting services or assistance
will be provj-ded at a chrarge.

Program error correctiorr reguests and/or comments concerning
tire contents c,f this putrrication should be addressed to:


fBIrl Corporation
8712 West Dodge Road
O m ; : h "n N e b r a s k a 6 8 1 1 4
r
Attn: Mr. Don Larimer

WARRANTY

E A C H L I C E N S E D P R O G & A M. I T ; D I S T R I B U T E D O N A } I ' A S I S ' B A S I S
WITHOUT WARzu\NT'YOI.' ANY KIND EITTIER EXPRESS OR IMPLIED.

Requests for copies of l.BM publications should be made to
your IBM Repr:esentative or to the IBM Branch Office servinq
your loca lit1' ,


O Copyrigtrt Internatj.onal- Busi-ness l"lachines Corporation I97 2
sN20-5137


T A B L E O F C O N T E N T S

Ege
Introduction t

System Overview . 2

System Description 2
Proc;ramming Systens 2
System Configuration 2

Progran Descriptions 3

Proqram A!,lB0l The sort Specification
, Generator 3
1
Intermediate Disk sort Phase .
Proqram AI{802, The Report Program 7
Proqram A}IB03, SampIe Fife Creation Program tJ

Modification Aids 8

system/3 Query Facili-ty Commands :tI
rSORT' Control Statement . . .t1
'SELECT' Control Statement .tl
TPRINT' Control Statement L4
'coUNT' Control Statement l5

Installation Instructions I6

Steps for System Generation I6

The Data Element Dictionary l6

Creating the Data Element Dictionary . I8

Tailoring the Source Prograns 20

Modifications to Progran AIIB0I 2L
l'lodifications to Program AM02 22

optional Modi fications 24

Sub-Totals (Ll Totals) 24
Cafculations 24
Progran Size Reduction . 24A
Catal.ogued Sort SPecifications 248
Processing Binary Formatted Numeric Data 248

Operations Instructions 25

User Prepared fnPut 25
Procedures . 25
Errors
26

and Linitations 2A
System Capacities

Sample Problem InPut arrd OutPut . 29

Generating t}te SamPle Problem 29
F I G U R E S



Page

Figure I -- System,/3 Query Facility Phase tr 4

Figure 2 -- Systemr/3 Query Pacility Phase fI 5

Figure 3 -- System/3 Queri, Facility Phase IfI. 6

Figure 4 -- Examples of Conrrnand Statements " Y

'ln
Figrure 5 -- A Sample Query and Resulting Report.

Figure 6 -- Routine for Frocessirrg Binary Data . 31

Figure 7 -- Sanple FiIen L]ser's Data Elernent Dictionary Guide 5Z



Figure 8 -- Sample File, Record Fo$nat Specifications 33

Figure 9 -- Sample file n Data Element Dictionarlt 34

F igure 10 -- Sanple File n Data Element Dictionary 35

Figure l1 -- Sample Data, Progran AllB03 36

Figure L2 -- Sanple Output 37

Figure 13 -- Sample Output 38

Figure 14 -- Modifications for Subtotals 39

Figure 15 -- Modifications for CaLculations 40

Figrure 16 -- I'todifications to R.educe Program Size 42




Lt
INTRODUCTION


The Purpose of this manual is to provide the user familiarity with the
capabilities of the Systemr/3 euery Facility and define the means by
which a functioning syst.r r"y be created.. Described in detail are
the Facility as a system' the operationar aspects of the Facirity, and
a definition of each of the corunand statenents that may be used to
rrrite a query- The necessary functions to tairor the programs to gen-
erate the system are enunerated. For information on how to modify
the Facirity to execute on a system/3 Model 6, refer to the systems
Guide.
SYSTEM O\ER\IIE[.I
%




The system/3 Query Facility is a tool that alrows the user, progreunner,
and non-progranmer alike to selectivery access disk data files f,or prepar-
ing reports or gatherj-ng statj.strcs. By using the functions provided in
four simple -onruner-nds
and the functions of the systen/3 Disk sort, the user
can rapidly formurate queries to the system and receive responses in the
form of printed output without expending time and effort for writing and
testl-ng prograrns.



System Descriptron

The system,/3 Query Facil.ity is cornprised of trro programs written J-n RpG rr.
rnput to the first proqrarn rs the 'sELEcr'and 'soRT,comnands.
This pro_
gran transrates these statements into control statements that are compatibre
wrth the System,/3 disk sort"

upon processing these contrcl statements, the sort utiJ-ity then produces
ajl output file of the records the user has selected, pJ_acing them in the
defrned sequence- Th-is fire then becomes lnput to the second program of
the facility which processes the d.ata and produces a report according to
tlte defrn:'tions established by the 'pRllrr' and ,@tJlJT, command.s. Frgure 4
presents sa:nples of the control statements; Figure 5 illustrates how a
query night be wrj_tten and the resuLting
report.

The commandr; are designed to give a great deal of functior^ to the user and
dernand rittle concern for rigid formatti.ng. They are written in a manner
that conveys meaning to the writer of a query, making a reguest simpre and
direct, and provides resuLts in a minj_mumof time.


Progranrn.t nq SVsterns

?he prograrnlj rdere written and tested under RpG II (5702_RGI , Velston 5,
l4odrficatrotr r,evel- 0) for the system,/3 Model l0 (disk). rnstructions are
provrded fo:r adaptatj.on to a Systernr/3 Model 6. fn addition to the RpG II
compiler, the tirsk sort program (5702-sMr) is required.


Svstem Conf:Lguration

The object programs require 9216 bytes of nemory. With a normal size core-
resident syr;tem control program (approxinatety lX bytes) a 12x central
processor :-r; required. The programs wilL execute on an other:wise minimr.un
System/3 Moavailable f<>r sort work areas and output areas.
PROGRAMDESCRTPTIONS
-


The Systemr/3 Query Facility j-s comprised of two
RpG rr programs. These two
Programs, in conjunction with the Disk sort programr procss
conrnands which result eue:ry Fac1lity
in a printed report contarnj-ng the information selected
and sequenced by the user's cormrands. A discussion of the indivi-duar pro-
grams follows' (For a discussion of commands and their formats refer to
page 1l).




This progrErm processes the user,s 'sELEcr,
'SELECT' and 'soRT, statements. The
statement j-s optional; the 'SORT, statement
is required. The
order in which the two statements are input to the program is not import-
ant. Frgure 1 illustrates the execution of program ANBOI_.

The OG, and data required. for execut:-on rs:

// LOAD ANB01, Fl
// RLIN
qFr Faq,
(optional)
(2nd card of rSEI.FcI'
statement is optional)
J\Jt(t.
/L




The ocl and data are praced in MFCUT. Brank cards
shourd be praced in
MFcu2 for punching the output cards. No printed output is produced.

The punched output consists of system/3 sort specifications which are
suppried as input to ttre sort phase. (see the section "operations rn-
structions") .

The following limitations are placed on the "sEr,Ec:l,,and "S9RT,,statements:

a. The 'SELECT'
statement may span only two cards.

b- A maximum of lo "sELEcr" relationships may be specified in the
"SELECT" statement.

c' A maximum of l0 data element names may be specified in the ,SoRr'
statement.

rf requirements are such that these linits must be exceeded, this must
be planned for at generation time. Instructj-ons for modification are
included on page 20.
Program
AI'JB0l




Sort
Specs




Flgr:re I -- System/3 euery Facility phase I
I
q E




Figure 2 -- Systen,/3 Query Facility Phase II
Program Sorted
l\lJB02 Master
Fi le




Cards




Figure 3 -- Systev3 euery Facitity phase III
Intermediate Disk Sort phase

Upon compLetion of program Al,IBOl , the punched output is
removed from
Stacker 4 of the MFCU and placed directly behind the following OCLrt in
MFCU1:

LOAD $DSORT, FI
FILE NAME-INPUT, UNIT-uu, pAO(-ppppppr LABEL-I....]
FILE NIU'IE-WORK, UNIT-uu, pACK-pppppp, TRACKS-nnn,
RETAIN-S
FILE NAME-OUTptn, UNIT-uu, pAe(-pppppp, TF(ACKS-nnn, RETAIN-T, I,ABEL-S3QFOtIT
RIJN




Cards produced by AliBOl

/
\
E -Y
r i n 2 ill.ustrates the execution of the sort phase.
*Where u u r l - - . - . 1 , p p p p p p '
nnn, are the appropriate entries for unii.t,
VTOC file J-abel, voLume label, and number of tracks respectrvely.




This program processes t}e user's 'PRINT' and 'coUNTr statements. The
'PRIIIT' statement is
required; the 'cotr.lrr statement is optj.onar. The
order in whj-ch they are input is not important. Figure 3 illustrates the
flow for this progran. The disk input file, which was produced by the
sort phase, is interpreted for printing and tabulation via the 'pRl:NT'
and' COUNT'statements.

The ocl, and data required, placed in MFCUI, are as follows:

// LoAD AI.rBo2, FI
// FILE NAl,tE-INPUT, UNIT-uu*, pACK-pppppp*, LABEL-S3eFOUT
// RUN
PRINI
COTJNT (optional)


The report ls produced on the system printer at this time. Figure 3 illus-
trates the execution of phase III, progran ANB02.


*uu - unit sorted master file resides on.
pppppp - pack label for above unit.
Program Al$803, Sample_File Creation prqgram

rn order eo run the sample prograrn, a samp"le f,ile must be created. The
following OCL must be placed in MFCUI along with the sample data in order
to executre tlle sampJ.e file creation program:

// LOAD ,AriBO3,FI
// F'ILE 1\IAI,IE-SAI\,IPLE,
UNIT-UU, PACK-PPPPP, LABEL.SA.I,IPLE,
TRACIGS-I, RETAIN'T
// RUr.t


(
I
J
Sample Data
I
I

(



Where uu and pppppp are the appropriate urrit and pack desigrnations

Modification Aids

There are two basic categories of modifications discussed elsewhere in
the docunentation. The first category involves tailoring the prograns to
the hardware configuration (Systern/: Model l0) and specific master file
of the user. This includes modifying for increased printer capacj.ty,
allowing for more information in control statements, and adjusting for
the size of the Data Element Dictionary" These changes are presented in
detail in ttre section on "Installation Instructions", pages 16 to 23 of
this manual.

The second category which :-s a general discussion on how to nodify these
programs to execute on Lhe Systen,/3 Model 6 is contained in the Systems
Guide.
SELECT (SEX EQ T) AND (A@ LT 40) AI.ID (CPRNRY EQ +) AND (\ENII'IB EQ +)

SELECT (ONHAND LT BAKORD) ON 135qORD GT O)

SELECT (STATE EQ IA) N.ID (STATUS EQ D)

SORA AGE, STATE, YEAR

soRT I15M, ONHAI{D

SORT AI"IOTJNT, DATE

PRTNT NAIVE, ADDR, CITT, AMOIJNT, DUE

PRINI ITEM, ONHAT.ID,
ONORD, BAKORD

PRrt0T c.usTl\lo, cusNAl'i, ADDRS, BALDTE

COUNT N'TOUNT

@UNT EIALUDUE, CURRNT, PASTDUE




Figure 4 -- Exarnples of CommandStaterents
The Problem: To determine all items that either have yielded a year:-to-
A.tfi"rri; of $1,000 or more, or, those which have sold more than !!50
rrnits. Thesr: itenns should br,sorted by item cLasE, and by the margin
amount (descr:nding) within that. The printed output should contain the
item class, .item description, item nrmber, quantity sold, and the gross
margin. The margin amount should be tabulated and Printed at the end of
the report. A courrt of records is automatic.


The Required Query Conuna-nds:

SELECT (I''ARGIN@ 1O0C).00) oR (QUAIIITY 250)
GE

SORT ITMCLS, MARGIN-D

PRTNI ITMCLS, DESCR, ITEMNO, QUAI{TY, I'IARGIN

MARGIN



The Resulti r!g-_Repor.!.,

CLA.SS DESCRTPTION ITTI{ SOLD GROSSMARGIN

A93 #13 @AR 1468 LZ 2260.OO
A93 #18 GAR L469 58 I108.00
A93 #24 GEAR 5201 252 12.50
BOI PINION 309 I r000.00
B0l A.Y LE\IER 24L5 868 868.00



RECPRDS PRINIED = 5


TO4AL MARGIN = 5248.50




5 -- A Sample and Resulting RePort
Figure Query




10
rn order: for the system to process
a user,s request, his probre,m must be
e:rpresserd to the facility in the forrrr of .or*r.rrd".
(a query') informs This set of,conunands
the system which specific records to serect, the sequence
in which to output the records, the data to print on the output report, and
the nruneri-c data fier-ds for which
totar-s are to be accumulated. A query
can be cromprised of four statement
types" Their detailed descriptions and
formats are found in the following pages.
rsoRl I
Control Statement

The 'SOFJT statement is required for any query. This conunand def:-nes how
the records are to be sequenced by specitying-the
data element natnes to use
for sequencing' The first data element name has the most significance
sorting; in
the last is least significant" All sequencing is assumed to be
ascendj'ng; descending sequence for specific
data elements can be specified
(see below) . The normal System,/S col:-aeing sequence
i-s used, whi-ch, in
generar, treats bLanks and speciar characters as r-ovrest valr:es, forr_owed
by alphabetic characters (A to z) , then by numerics (0
to g). For more
detaiL, refer to the Disk Sort ManuaL (SC2l_7522)
.

The format is as follows:

SORT der r de, , de, , d"r.,

where d:r, a data erement name. The characters 'soFT'must
1" s.tart in
corumn r of the card and be followed by one or more blanks. Data eLement
names must be separated by comnas, and any number of branks (0 up) may
follow a conma- The Program is written to allow a maximum of l0 data
el-erent names in ttre 'soRT'i statement. As previousry rentioned, a d,ata
element can be specified as a descending sort contror fierd. This is
accomplished by sinply folrowing the data erement name in the ,soRT,
conunand by ttre characters '-D'.

The fol-lowing are examples of 'SORT' statements:

SORT STATE, CITY, NAlttE
SORT \ENDOR, TIEM
SORT SALES-D
SOFT AGE, IQ-D, GRADE

'SELECTT
Control Statement

The 'SEIIEO| statement gives the user the abilitl/ ro extract records from
hj-s data file using the por^rer of Boolean logic. Records that meet tl:e
criteria specified in the 'sELEcrt statement appear j-n the outprrr report;



11
aLl- others are ignored" This Eives the user the abil.ity to retrie.ye cate-
gories of data from hi-s fil-es (such as all the customers iu New yo:rk or
all back-ordered itens). Jt is aLso possible for the user to elqll:re his
files seek.inq unique relatiorrships and correlations. This techniq,ug rn.t
be used to discover trends i:r olher patterns not readily provided ioy other
programnrng technrques .

The 'SEJ'ECT' statement is comprised of a series of Boolean relationships
that are rinked together tiy the 'AND' or 'oR' logical operators. The
Boolean relationships are sirnple comparisons between two data elements or
between e riata eLement and a constant. The rel-ationship is enclosed in
parentheses. T'o forrn the rellationsh.ip, ihe two data element nannes (or
data eLement and const-ant.) 11tr Eiep;irated by the comparative operators EQ
(equal ), NE (not equal), j.,T {l"ess than), GT (greater than), LE (less t}ran
or equal) , @ (greater than or eciual). The first name rn the relatbionship
must be a data element name; the secorrd may L:e a constant or a data ele-
nent. nane (tf it is not forurd in the Data Element Dictionary by the pro-
grarn' it is assr-uned to be a constant.) . Alphabetic constants may brg from
I to 20 characters in length. Numerj-c constants can be from I to .[5 digits;
in addition' a minus si-gn may preceerl the nuneric constant and a drrcimal
poj"nt may be inserted. sone exanples of these relationsliips are:

{AGE 61 20) d. e. - cons'Eant

(AG Ct 20.0) equj-valent to above d.e. - constant

(NAIG EQ JONES) d.e. - cons:tant

(NAI4E NE ) d. e. - cons'tant (blanks)

(NAME GT AAAAA) d.e. - cons'b,Eu1t

(reup LT -10) d. e. - cons'tant

(oNHAliD' @ ONOFDR) d.e. - d.e.

To construct a 'SELESI' statement, the Boolean relationships are l:Lnked
together by the linkage operators 'AND' or 'OR' to define the tota.L criteria
by which tc, extract the r e c o r d s . The format is as folloqrsr

SELECT (Relr) ANp,/oR (ReI?) AND/OR (Rel )
n


The characters 'SELECT'must begin in card (two cards
colurnn I of the first
are permitt.ed) followed by one or more blanks. The 'AND' and 'OR' opera-
tors may be preceeded or foll-owed by one or more blanks. If 2 cards are
used for tbLe statement, the data in the first card must end with a right
parenthesis, (')') and the second card must begin with the operator 'Al.lD'
or noR' in colunn '1t.




I2
It is inrportant to recoqnj-ze
how the program groups the logical
ships accrrding to the placement rel_ation-
of the 'AND' ancl 'OR' operators.
reco:rd to be selected when For a
two or more rel-at,ionships are linked by 'AND',
it must meet the criteria of alL the relationships. For example:
SELESI (ACfr GT 20) AND (SEX
EQ F)

states that the selected
records must be for individuals
ferrur],e and over tlie age of 2O. who are both
But if

S . E L E C T( A C E G T 2 0 ) OR (SEX Ee F,)

is s;p'ecrfied, arr rndividuars
over the age of 20 wir_r be serercted
wrth 'r11 ferrales; the'oR'operator along
acts as a logical separatror to arrow
for sr=Lection of records ^.u!-r-rrg
any one of severar relationships.
use o:t 'oR' as a separator becomes more compr.ex when rj-nking
The
of 'AI'ID' relationships . For example :
serera1 groups


Si'LECl' (A@ EQ rO) AND (SEX
EQ F) OR (AGE EQ 12) AND (SEX EQ F)

wrLl- extract alt records for both l_O and 12 year old females. However,
the statenrent- were wrltten J_f
as:

SELEC? (sEx EQ F) AND (AGE EQ 10)
OR (ae EQ 12)
would select all, L0 year old
females and all_ 12 year o.l_ds, regardless
sex; tl:e 'oR' operator has been used. to group the relationshi,ps.
of
A hray to
vrew tlre affect of the ooR' operator is to rep,.ace it with br,ackets;
J-s a conveni-ent way to desk check ttris
tl.e ''ELECT'portion of a q,uery. rn
genera,l , the procedure is:

sEiLErl' I{tlEir) AND (Rel2) *p (Re13) on 1ps1n)) on
[(Rel,-) allo (Rera)J

can be handwritten as:

SELECT t(Rett) AND (Ret2) and (Re13)l
line I

or t (Re14)l line

or I ( R e L ' ) A } i D ( R e 1 u )J li-ne

If t-he record meets either the bracketed criteria of line 1, l.ine 2, OR
hne 3, it will be selected.

In strrrunai:y, the ' S E L E C T ' s t a t e m e n t can be invoked in a sirnple fashion,
or can be used to pose a relatively complex query to the system.


l ?
few ex;rrnplesof ' C E L E C T ' s t a t e m e n t s follow:

SELnCn{rmu c r 6 1 0 0 ] A N D ( \ m N D O RE Q 5 6 2 1 ) O R ( I I E M
LT 5OOO)
A}ID (ITE}.l GT 4 0 0 0 ) A h l D ( v E N n O R E Q 4 8 0 2 )

SELECT (STATN E Q N Y }

SELEC:T (DATE nQ 0b0172) AND ( rrn/cE EQ 232)

SELNfl' (OI'JHANN EQ O) OR (SALES LT 2500.00)


:ilRINT' Crontroi Statement

The 'PRfNir' stacement is -required for any query.
The operands are a series
of data element- nannes separated by corrnas.
Thj-s staterent causes the speci-
f i ' e d d a t o e l e m e i n t s t r - r b e e < l i t e d a n c i .p r i n t e d
for each record encountered. rt
a-l-so extracls the specifieri heading for the data element from the Data
lllement Lrictionary aricl prrrts it at the top of each page. rn addition to
data eler,entsn the operand'lio'may be specified to suppress the p*ntrng
of any informati-on for each record encountered. Thrs may be used in con-
;unction wj-th the 'COIJNT' statement (and the automatic record count provided)
to obtain total information without printing the detail data, as ttre totals
wrll print even with the presence of the 'l,lor operand.

A 2-d-i9i t nr-unber may also be inserted as an oper;rnd to cause additional
Iateral spaclng between fi-elds when they print on the report. T5e nurnber
corresponds to the desired nunber of blank spaces to be inserted.

The general fc,rmat of the 'PRIMI'
statement is:

PR-INII de,r du",, der, nn, d.4 . derrr liD

where de j.s a 'No' is 3 suprrress ntunber; and
p.rint re!{uest. 'PRIMI'
m u s t b e g i n i n c o l r - u n n . 1, f o l l o w e d
by l or more irLanks" Blanks may be inserted following the comna:s if de-
sired, A maximwn of 15 data el-ement names may be specified;
the use of
nr.:onerics or tile 'No'operemd each counts as a data element name:Ln relation
to the rnaximrlrr of 15. An error will occur if the number of print- positions
requrred to satisfy the print conunand exceeds ttre size of t.l-e system printer.

Exannples are r

PRIIfI NAIIIE, ADDRS, AGE, AMOUNT

PRII\IT I1|1EM, 40, SALES, ZO, GROSS




14
PRTNI LOCATION

PIIIN| AI{OTJNT,BAL, A@, NO

'coUNT'
control Statement

The rcouNT' contror statement
d,irects ttre Query racility
totals of speci.fied nuneri. to accunu.r.ate
iutu erements l'a pri't the resurts at the end
of the report. Any data .f.r*it names specified in ttre rCOUNrr statenent
ffi":::"":ff:"i"':"ff";ixll; donot,they isnored.
are
;i:X;.;;;"i;'iley
The general format rs:

COIJNT d"l, de, , de, , d " n '
de

Where de^ is a nuneric
data element narne that h a s
the 'pRllh' statement. also been specified
The characters 'COLINT' followed in
blank nust begin in colunn by at least one
l.
Examples are:

COUNT AI'{OUNT, BAL, I,tARGfN

coUNT AGE

COTJNT QUA}ITY, COST




t5
r N:s
TAU,ATI rlil.S
"O.N ]:ry:T lgNS

?he fol.lowing pages describe the step-by-step procedures t]:a; rnust be
followeri to generaLe a viable system/3 Query f.acrlj.ty to proce$s your
rnaster file. rf these proqr.rms,*ill. be used in conjunction witl: serreral
files, bhe FaciJ.ity must be generated separately for each one;rnd the
progr;rml3 cataloged wit)'i unique names {column 75-80 r:f ."he RpG l:I header
card) i:n your library "

The card deck as recej.verf from P.I.D. is comprised;':f rhree RpG iI so,Jrce
decks a:rd one deck of sampJ.e data. lthr: order is as follows:

Proqram ANBOI
Proqram ANB02
Proqram ANB03
Samlrle Data

It is rr:comnended that the erit-j-r:e der,'k L:e reproducecl for back-rrp purposes.
The use.r should review the sections (.-rr!
installation and operati.ons before
attempt.tng to generate the system. rr-- would b'e quite benefrciarl to devote
the small amo-unt of effort necessary to generate the sample sys;tem and
execute the sample progr:aln befr:re proceedang wit-je generatj-ng a "Iive', sys-
tem. T,itis is descrihed in tlie section "Sample Problem Input and. Output".


Steps ficr System Cneratj-O1

The fol.Iowrng functj"ons roust be performed in generating the Sys;tern/3 euery
racility:

I. Obta-in a current version of tJre record layout descriptj"on for the
master file.

2. Create a Data Element Dicti"onarry accordi.ng Lo the instr:uctions in
the following section 'The Data Element Dictionary,"


3. Replace the saq>le Data Elernent Dictionary in Lhe two prograns
AlIB0l and AI.IB02 with tJ:e one created in Step 2. (Thrj-s is found
at the end of each program deck between the r*t! &rdt7/*r cards.)

4. After obtaining a sou.rce listing of each progrrm, perfclrm the
required modifications and review tJ:e potential modifj-cations to
the source programs as defined in the section "Tailorirrg the
Source Prograns".

5. Compile and catalog tJre two programs AlrlB0"l- and AllB02.




L6
(t. Create the OO, necessary for executing the facility. This is
described in the section entitl_ed ',program
Descrtption,,.
',7
. (optionar) catalog the ocl, in the procedure Library of the systems
pack if you desire to use the 'CALL'
functions of Sy,sten/3.

u. Exercise the facility enough times to harre used every data element
name in a 'PRtNt' comnand and erzery numeric data erement name in
a 'COtJtlT' comnand, checking the output for accuracy rn content,
format, and heading information. This will herp ver.ify the accur-
acy of the Data Element Dictionary.




I7
THE DATA ELEMEMT DICTIO}IARY


Each program of the
Qu*r1 Faci"lity contains a set of tabLe records
the Data Element Lrjctionary' called
Each record describes one of the drata er.ements
(fierds) found in thre tt"old oi master file that tie programs are gener-
ated to c:orrnu.ricate with-
"iru
The programs store
the forrn of alterr,atlng the Data Element records
tab-les. in
?he first portion of the tabre record,
name of the data e-lement, the
is one table; the latter portion,
parameters, conqrrise the alternate tJ:e descriptive
table.
The creation of the Data Element Dictionary
tfrat must be performeci is the most importanE. function
to generate t.]le system.
rn it i"s a permanent ?he information ,contained
"nnall" of, Lhe input records
are the corTrnunlcat.ian and the data elernenc names
Lj.nk bet-,*een the user
para$eters and the Query Facili.ty.
shor-i]-d oe completeJ'y The
checked for accuracy. The narnes shour.d be
unt-que anC cai:ry neanrng
to any potentral user.
Creating t].e Dat-a Ltl.ement Dj-gtronary

The entries for lhe Data Element Dictionary
cluded in the source decks are punched into carcls and
for the euery Facij.ity; in-
i'nserted :Ln place of the these cards should be
sampre Data Erement Dictionary
of prograrns AbiB'r and ANB02 found at the end
L"tr..r, ttr. | **, a . , , d ,| / * t cards.
information can be taken airecity Most of the
from the record rayout form fo' the master
frle when creating the record for each data
eters that: need addi'tional erement (or fierd). Two param_
consideration are the data element name and
data elemernt heading, The nase should be selected the
users of the facility' to con\rey rrnanrng to the
The headings should also
each fielct, be 'niquery descrj.ptive of
as the heading will print on each page of the report
The nr'unber"of'c:haracter$ in the heading should be somewhat .produced.
prrnt rength of trre *--leld in order reLated to the
to achieve a report pleasing
to the eye.
;"r ':escril.'erj in a singte
card thar adheres ro ilre follow-
ffitr:*:aelement

Card
Columns Concents

1-6 nata Element Nane -- From
one to six characters. The first
:haracter must be ala!3[$!S; the n*. ."y contain 'o special
char.acters or rnibe;A;e bl;k"; each name must be uni.que and
shoul_d convey neaning to
the user.
7-9 Data Element Starting position -_ Three_digit
rng the starting nr.unbers defin_
posi-tion of the data element
re ccrd. in the master

LlJ- LZ Data Lrr-ement Ending position -- Three-digit nunber defi.ning
the ending position of the data element in the naster reccrd.
Card
Columns Content.s

I3-13 Data Element Fornat, -'- one cha.acter defi'r:rq the format of
the field in ttre master record: "c" for alpiramc,ric fi-elds,
rrP'r for packed-decimal
f rel-ds, ,,r,, for zoned_clecimal ( unpack_
ed) fields, and (if Lhe supplemental r.<-rutine to interpret
binary data has been j.,nserted irr the sourse cocler) ,,8,,
for
binary formattecl nurneric fiel-ris.

L4-L4 Decimals -* rJne digit number definrng the number of digils
that exist to the riqht of the rmplied decimal point.. This
entry rs valld onry for numerr.c fierds and must otherwise be
bLank- Two additio'al opt-ions are provrde 0 decimals: First, a negative ,1, (J)
may be specifj.ed in
':olumn 14 to elirm.ate the insertron of conunas and a decimal
point into the edited field (thrs would be used for fier-ds
Iike item number, etc.) f,or numet:i-c date fields,
'Eive 2 (K) a nega_
may be enLered in column 14 te provide sr-ashes in
the edited fietd (e.g. wn/dd/yy) .

15-16 iData Element print positions *- Two-digit number defining the
:ilmtber of print positio^s reqr.dred for the data element and
.its heading in the reports gener.ate 'fhis is normally
tle larger of ei-ther the number of charac-
'Eers in the
heacling or the nunrber of characters in the field
(as it is printed) . The print length for numeric fields
should be computed as follows:

Add to the number of di.gits in the field the fo1r"oi,,rnq:

2 - - r f nrunber of dr.gits are from I-3
3 - - rf nrrmber of d:-git-s are from 4-6
4 - * rf n'.rnicer of digits are from 6-15

lthe entry in col-urnns 15-16 can be greaLer or less than the
"'normal" entry. A greater number can waste princ space and
a smaLLer number cou]d cause truncation of eithe:r headinq or

17-31 Data El-ement Headrng -- Any valid Systemrz3 characters. Ncr_
nal-ry this entry is left-adjust-ed but it may enh.nce the
printed output in certain cases to pad with blan] .Left. If padding is done, this must be consirfered when
rnaking tJ:e Print positions entry in colurnns 15-16.

After the Data Element Dictionarl, is creat-ed, .:-t is important 1!o make a
list of the data eLements and their -escriptions available to ;rII users
of the Query Facility. This:-s.i lortant as it is the single - L i n l conununication between the user arrd his master file when usinq lihe F.acllr_tv
For an exarnple,, see Figure 7.


19
TArrrRrNG lI{E SOURCE
PRp.qRtudS.


The sourr:e prograns AlIB0l and ANB02 rnust be adapted, to the part:Lcular
situa-
tion for which they wirl be used. part of systlm generation is makrng the
appropriate changes to the RpG rr code before compiring. The rerguired
modifical:ions are those reLated to the record size of the maste:: file and
tlte nrunbr:r of data elements in the Data
Element Dictrcnary; the creatron
of the D'rta Element Dj-ctionary is arso memdatory. Additional m(}dj.fications
can be made to all-ow for an increased nr-unber of pr].nt posi-tions and for
allowing more information to be contained in the contro.l. statement.s. These
are desc::ibed in detail in the follow:-ng sections
"
statements in the source progr;uns that require mod,ification are flagqed
with a modification code in corumns 90-95. The action that is r.eq*rred for
each staternent is described in detail on pages 21_23.

rn additj'on, the user may have a need to process nirmeric
data that- rs con-
tained in his master file recsrds in binary format. Thrs is descr:-bed in
the sectj.on "Processing Binary Fields".




20
l.lodifica.t.ions
*tg.Progrq{n ..NQ!*to Tai1or: r}re system
Modifica.-
tf On Codr: l:psc. r r,r i n-
--

I04 * corurnns 37-39 contain Lhe nunbe-r of dat-a er-ements defr.ned
the Data El-ement Dictj-onary in
(table ,TABFLD,
.TABPAR'). and its alternate

II3* Colurnn 5.1 = 2 if master frl_e record length from lCi t_eJ 9
9 bytes;
column 51 = J if lengtlr from 100_999 b y t e s .
116 col"umns 37-39 contain the number
of bytes ar_lowed to contain
the 'sELEcr' statement, The entry is a mu.tipre
pondrng to t-he arbitrary of 96 corres-
maximum number of g6 byt.e recorrls
the 'sET'Ecr' staternent. r;.
i :D , ':!:'...J u 'r
::: ro ;r;;'am arrows the
sratement tO span mui-Liple records
and currently is
set to 2x9b = 192.
117 corunrns 3'/-39 contain an ent.ry that corresponds to the maxi-
mun num'ber of Boo]ean relationshi.ps
that can be specrfied in
the "'E.L,ECI"' statemerit.- This is related to the enLry made
for -L-l'6 in ure sense that the more
'sEr.rrcr'! records that ca::r be spanned
by tie statenoent, the more field*field or fieLd*
litera-l rel'ationships can exist. This must be bet-wee' f o
ano yy.
118 columns 33-34 correspond to the maximum nunber ,sELEcr,
of
relat.i,onships allowed (agrees wiLh 1,17) .
ll9 corumns 37-39 contai-n the max:-mum number of data ei[emerrt-s
that ca' be specified in the 'soRT' st-atement. Th:Ls musl be
b e t w e e n . L i . ..i : r r c i 9 9 .
L20 i--orlu'iurs 3l*34 correspond to the number of tJata elenre;it-,i that
can be s;pecifie 12L columns 33-34 correspond to the maxrmum
size of thel ,sEr.FrcT,
statement (.rgrees with 116) .
123* Columns 46-51 c:orrespond to the record length of th,e mastei.
fil-e (agrees wit_h 207) .
L24* columns 55-57 contain the record re'gth of the naster fir-e.
*Note: codes lo4, lr3, L23, and 124 are the onry ones that need be
considered
to implement th.Is program with the author's pre-defineci lrmrts. The
l:Lmits are:

2 calds :tor Lhe 'SELECT, statement
l 0 ' S E l , E C : f' r e l a t i o n s h i p s
'SORT'
IO dat-a lerliu.._r




2L
Modifications to p san ANB02 to ?aiLor the


Modifica*
tion Code Descr-+Ftien

?01 Columns 25-27 contain the nr.rmber of print, positions on the
systern printer.

202 Columns 37-39 contain the ntmber of print positions on the
system prj-nter.

203 Cr:rumns 37.*39 contain the record length of ttre master file
imust agree with 207) .

:204* coluturs 37-:Jg contain the nr:rnber of data elements defined in
the Data Element Dictionary (table 'TABFLDT and rts
arternate
'TABPAF.U
)

205 colurnns 38-3? conEain the maximum number of data elements
that can J:e specified by the user in trre rpRrNr' statement.
Thl"s nunber rnust be greater than 10, but its upper lindt is
restrrceed by the maximurn number of fierds that can be fit
rnto one line of print, considering print positions required
to be the nunber specified in columns 16-17 of ttre Data
Element Ltictionary record.

206 coLumns l7*39 corrtain the maximrun nurnber of data elements that
can be specifi.ed by the user in the '@uMr' statement. This
nunber must be greater than 10 but its upper linit is bounded
by the nr:mber of corrsider |:he impact on core requirements if you choose an
arbitrarily large nurnber.

207' CcL"r.ms :i-2? c'.:trtain tl:e record length of the master file.

208* col$rns 48^51 contain the record length of the master file
inust- a$ree wir:n 207) .

209 Colurnn 51., array index field length. must be 2 for 9G print
g:ositions or 3 fcr I20 or I32 print positionsl

l L V coLururs 33-35 contain the number of print positions (agrees
wrth 202).

21I * columns 33-34 contain the nurnber of data elements de:fined
in the 'PRIIJT' statement (agrees witl. 2O5).




22
Modifica-
tion Code. Description

2L2 colunns 33-34 contain
the nurnber of data erements
be specified i'n the 'co'N?r that can
statement (agrees with 206).
213* column 51, array
field length, must equaL 2
master fi.r.e recordlnfex -. for a
rength or ro-6g or 3 for q
of l0O_999. Consider yo,r, reu,
i"*,ra length
..,irv- tor- zol---
2L4 colurnrls 33-34 must be
one greater than the number
element names allowed of data
in the ,COUNT,statement
f o r 2 O Gw a s 1 2 , t h e n t h i s tif your entry
must be t3).
215 corumns 4l-43 contain
the nurnber of print positions
system printer (must agree wlth 202). on the



rNote: rf you luish to irnplenent your
system with the rirnits specified
tle author' ttren only the by
rnodifications associated with codes 203,
2O4, 207,20g, and 213 nust
be nade (these relate to the
tfie master record) . The size of
limits are:
96 print poaitions
15 data elenents allowed
in the ,pRflm, stater*nt
r0 data erenrents all0rred in
the ,b*t. statenent




23
sN20-6137



ftPTIO${A,L ffiD"L:f If:ATI0t{s


Tha forrcwing paragraphs djscuns impi.amnr.ltlon of soru-"optional
functione ln tl:e euery Facilj.ty,, Thay hrve r:ot btcn rubJrcted bo rny
formal testing anc are prr:vrd.eii r:n.l"y aa x guide" The Rpc rj cod,r ln
t}ra acconpanying i LJ"uaLrailons *rwy -bo hrlp.tur ro thoro wlrhinq ta
e:r'pand th,c fur:ctl.nn of t&s F*ci,i:.ty, '$Leh Enr oxcrpt,J,on, the uer of
tlreec opt,ionr nay either j-nurea:p$ core roqui.ralnntt or clut* exccrtlrrr
ovcriey* on e nlnLmr:m confiquratl*rn.,


gsllslsle_l r,L_ej"sAsr
rn sfir. caaes it ror-lld 5e ben*tl:::.a"1 t '
,Cf,tri"ll.,lt6tetdfirent-., lg well ars
the numerlc fields sper:*f j-srj. l;:1 *-*116
orrerall t.otals. Fcr exampl_ur *J, j..:'.'p!.r.:r.i.rlr query might. be writte:n to
provide sub-totals fo:: e*r:h v*nd{:;: irs'ssj.i lrs final" totals for a.ll
vendclrs" The RPG 1I etat-emsltt.,r ill.fi,-;;;.i:e 1.4 provide a noans to
accomplieh this f,unctian.

once the rnocii.fj.caLj.on h*s hersn !i,*ile i;,o F:roqrarfl icNBOz, the user mry
requcat sub-'i:ctal6 In hls cll-;.er*f i:y tle *.dd:tinn of, e sta*encnt w:ith
TBREAKt in colurnns l*5. 'Ihe. .pr:.it.le&$!rt:ront-&.-tns no othcr
trnformrllion.
Thl rub-tstals are pr:i.*t.rd ui,*rl*\,er a r*rffiEe :-n contGnt. of thc f:Lrst
oporand cf the xpRlNT' st-rrii.a$rsr"rr .is *rnnxcd. it lr enalogous to
spccifying a n R P G f L f , l h r * a k " ' , ' nt h * r f i r . ; t ipRINT,opcrend. If lthe
TBREAKI ltatantnt is neiL ln,:L.;luimd, cll* sllb*totelr a:r* not produced.

For exarnplc:

PRTNT VENDQF. i?nH,
, cosiT , sEi,-L
cotiNT cclsT, sfii,L
BREAK

would cau.sl6 eub-totars of, f"he CriiiT iind snLL fleldc to be printed for each
vsndor group ando as *xp*cted, ti.nsr f."otals will eppear at the end of
thr report" Thc sequence af t-he '8REAS.i sratamenf- ls not import;rnt.




Calculations

fhit nodlflcation wlll allcw rilc uger bo np*cJ"fy two of the nunrcr:ic fields
in e rccord to bc uced &s operculd.s -tn a calculrtlon. The result of the
celculetlon wlll be rlntoai eiong wit$ th. othar claLa flclds inclLuded in
thc nport. Thr opcntierns trncludod trn tLlr functlon arr edditionr eub-
traction, and multi.p),icatlon"




34
sN20-5 37
1



An additionar command is used to invoke this function. The for:mat is:

cO].rrmns l.-7 'RESULT='
Col.rrmns B-13 Operand 1
Colurnns 14 Operatj,on Code: ,*,, '-,, ,X,
of
Ccl',:mns 1 5* 20 Operand 2

Exa,mples are;

115c111,f=Ql,t XCOST
FIISI-!-LT'=L:ROSS-NET
REIi ULT..VALUEA+VALUE
B

when the report i s 1 r 3 6 r d - d q s 6 ,t h e r e s u l t field prints as the right most
field itt each pr.ir:te'pRINTr slia|emerrl
of a quet\/, but should be used as an operand:i_n a rcotnlT'
statement i.f totaLs cf the resul-t fierd are desired.

The RPG rr r;oalg iri fjgure 15 should be used as a guide for chanF,rlnt prog.r'am ANB02. trn addition an entry in the D.E-D. of thaL program
rnust be made for the field 'RESULT'
as folLows:

RSSUTTOOOCOOU52ORESJULT
tsIELD

to properly define the field.


PIgqrary-S 1 ze- Redrrcti on

In cert.rj:r exr.e;.tional situations it may be desirabl_e to reduce the si.ze
of the prl-nt progran ANB02 or to eliminate excessive overlaying,, One means
to accom|rLish this is to modify the program so that the'PRINT'and'itorJNT'
statemenl-s i:re coded in fi,xed format instead of the free fomat descri.bed
earli.er in thr.": manual. This simply means that the user must punch the
o p e r a n d s i n s l : , e c ' rf i i r : c . lr i r n r i s o f t h e c o m m a n s t a t e m e n t s . The rogic for
scanninq the jtr.'t:-i.,-:rnt statements can then be removed from the proglamr
reducirrg the s;rze of the program.

The modrficat.ions for this are illustrated in figure 15. When i:hese changes
are made, the user must now code the operands of his 'pRrNT' or 'co\lNTr
statementsin the fixed posltions of columns7,13, 19,25,2A.... etc.
T h e o p e r : - a r r d sa r e n o t - s e p a r a t e d b y c o r , m a s a s i n t . h e p a s t . For:example,
statemer:t l;:evio'.lsly coderl as :

PRT.NT I].AME, AGE, AMOUNT, PRSNT

would n<>'lv
be wri tten as :

PRT,NT NAME ACE AI'{OUNTPRCi.''

All other coding r:ales remain unchanged.




24A