Service Manuals, User Guides, Schematic Diagrams or docs for : IBM system3 GC21-7567-2_IBM_System3_RPGII_AdditionalTopicsProgrammersGuide_Dec79

<< Back | Home

Most service manuals and schematics are PDF files, so You will need Adobre Acrobat Reader to view : Acrobat Download Some of the files are DjVu format. Readers and resources available here : DjVu Resources
For the compressed files, most common are zip and rar. Please, extract files with Your favorite compression software ( WinZip, WinRAR ... ) before viewing. If a document has multiple parts, You should download all, before extracting.
Good luck. Repair on Your own risk. Make sure You know what You are doing.




Image preview - the first page of the document
GC21-7567-2_IBM_System3_RPGII_AdditionalTopicsProgrammersGuide_Dec79


>> Download GC21-7567-2_IBM_System3_RPGII_AdditionalTopicsProgrammersGuide_Dec79 documenatation <<

Text preview - extract from the document
IBMSystem/3
               Topics
RPGll Additional
Programmer's
           Guide




Program
      Numbers:
         (Model
  5702-RG1     10)
         (Model
  5704-RG1     15)
         (Model
  5704-RG2     15)
         (Modet
  5705-RG1     12l.
P a g eo f G C 1 l 1 7 5 6 7 . 2
                    ,
l s s u e d O J u n e 19 7 8
           3
By TNL: cl!21'5616




Third Edition(July1974)

This is a malor revision of , and obsoletes,GC21-7567-1. Inf ormation concerning lBlVl
S y s t e m / 3 l V l r : d e l1 5 h a s b e e n a d d e d a n d n u m e r o u s c o r r e c t i o n s h a r v eb e e n m d i l e . C h a n g e s t o
t o x t a n d i l l u s t r a t i o n s a r e i n d i c a t e d b y a v e r t i c a l l i r r e t o t h e l e i t o f t h e c h a n g e ; n e r , vo r
e x t e n s i v e l y r e v i s e c ii l l u s t r a t i o n s a r e d e n o t e d b V t h e s ' r ' m b o l o a t t h e l e f t o f t h e c a p t i o n .


T h i s e d i t i o r ra p p l i e s o t h e { o l l o w r r r g B M S y s t e r n / 3 P G l l p r o g r a mp r o d u c t s
                                    t                          I                      R

      Version              Mod if icat ion                   Program Number                          System/3 Model

                                                                                                             'l
      15                   00                                5 7 0 2 - RO 1                          I and 0 Disl.
      6                    00                                5 7 0 4 - RG 1                          1 5 A ,B , C
      zl                   00                                57C)4 rG2F                              15D
      4                    00                                5 7 0 5 - RG 1                          12

C h a n g e s r e p e r i o d i c a l l y a d e t o t h e i n f o r m a t i o nh e r e i n : b e l o r eu s i n gt h i s p u b l i c a t i o n
                a r                       m
i n c o n n e c t i r s n i t h t h e o p e r a t i o no f I B M s y s t e m s r e l e r r a t h e l a t e s tI B M S V s t e m / 3
                         w                                                          ,
B ' i b l i o g r a p h y , ,C 2 0 - 8 0 8 0 , o r t h e e d i t i o n st h a t a r e a p p i i c a b l e n r l c u T i e n t .
                         G                   {                                                          a

T h i s p u b l i c , 3 t i o c o n t a i n se x a m p l e s { d a t a a n d r e p o r t su s e di n d a i l y b u s i r r e so p e r a t i o n s
                              n                            o                                                                  s
J o i l l u s t r a t ,ts e m a s c o r n p t e t e l y s p o s s i b l et,h e e x a t n p l e sn c l u d et h c n a m e so f
                         h                            a                                        i
i n d i v i d u a l sc o m p a n i e sb r a n d s , n d p r o d u c t s . A l l o f t h e s en a m e sa r e f i c t i t i o u sa n d a n y
                      ,                   ,         a
s m i l a r i t y t o t h e n a m e sa r r da d d r e s s eu s e db V a n a c t u a l b u s i n e s e n t e r p r i s es e n t i r e l y
                                                               s                                         s                i
coincidental.

L J s e h i s p u b r l i c a t i o n n l y f o r t h e p u r p o s e ss t a t e d i n t h e P r e f a c e .
      t                              o

Publications are not stocked at the address below. Reqr,lestsor copies of IBM publications
                                                            f
and for technical inforrnation about the system shoulcl he made to your IBM representative
c,rto the lEi\4 branch office serving your locaiity.


1 ' h i sp u b l i c a t i o nc o u l d c o n t a i n t e c h n i c a li n a c c u r a c i eo r t y p o g r a p h i c ae r r o r s . U s e t h e
                                                                                            s                          l
F l e a d e r ' C o r n m e n tF o r m a t t h e b a c k o f t h i s p u b l i c a t r o n o m a k e c o m m e n t sa b o u t t h i s
                 s                                                                               t
p ' u b l i c a t i o n .l f t h e f o r m h a s b e e n r e m o v e d , d d r e s s o u r c o m m e n t st o I B M C o r p o r a t i o n ,
                                                                            a            y
F u b l i c a t i o n sD e p a r t m e n t2 4 5 . R o c h e s t e r M i n n e s o t a 5 9 0 1 . C o m m e n t sb e c o m et h e
                          ,                                               .                 5
p r o p e r t yo l l B M .



( ) l n t e r n a t i c , n a l u s i n e s M a c h i n e s o r p o r a t i o n1 9 - 1 1 1 9 7 4
                             B              s             C                            .
                                                                                                                                                                              P a g eo f G C 2 1 ' 1 5 6 1 - 2
                                                                                                                                                                              lssued 4 May 1976
                                                                                                                                                                                        2
                                                                                                                                                                              B v T N L : G N 2 1- 5 3 8 9

                                                                                                                                                                                                Preface




                     p              s
T h i sr r r a n u a lr e s e n ta d v a n c e R P Gl l p r o g r a m m i ntg p i c s
                                                d                              o                           ORGANIZATTON F THE MANUAL
                                                                                                                      O
f o r a p r p l i c a t i o n o g r a m m e r s d s t u d e n t s , h o m u s tc o d e
                          pr                an                  w
p r o g r a mfs r I B M S y s t e m / 3 :
                  o                                                                                        T h i s p u b l i c a t i o n h a s e l e v e nc h a p t e r s . C h a p t e r s1 - 6 c o v e r
                                                                                                           i n f o r m a t i o n t h a t i s b a s i ct o m o s t d a t a p r o c e s s i n go b s :
                                                                                                                                                                                              j
o    M l o d e l6                                                                                          R P G l l p r o g r a ml o g i c ,c l e t a i l e dn f o r m a t i o na b c u t w r i t i n g
                                                                                                                                                               i
                                                                                                           i n p u t , o u t p u t , a n d c a l c u l a t i o ns p e c i f i c a t i o n s n d t h e c o n -
                                                                                                                                                                                          a
o    l V o d e l8                                                                                          c e p t sa n d s p e c i f i c a t i o ni s v o l v e d n m u l t i f i l e p r o c e s s i n g .
                                                                                                                                                     n              i
                                                                                                           A d d i t i o n a l p r o g r a m m i n gt o p i c s t h a t y o u m a y r e q u i r ef o r
o    M l o d e l1 0 ( C a r d S y s t e m )                                                                y o u r j o b a r e p r e s e n t e di n C h a p t e r s7 - 11 : c o n t r o l l i n g i n p u t
                                                                                                           a n d o u t p u t d u r i n g c a l c u i a t i o ni m e , t a b l e s a r r a y s , a t a
                                                                                                                                                             t                    ,           d
o    Mlodel 0
          1                                                                                                s t r u c t u r ea n d t h e D E B U G o p e r a t i o n .
                                                                                                                            ,

o    lVlode12
           l
                                                                                                            RELATED PUBLICATIONS
o    lVlodel 5
           1
                                                                                                            T h e r ea r e n u m e r o u sI B M S y s t e m / 3p u b l i c a t i o n s o n t a i n i n g
                                                                                                                                                                                     c
T h e S i y s t e m / 3 o d e l 8 i s s u p p o r t e db y S y s t e m / 3 M o d e l 1 0
                         M                                                                                  further information on RPG ll. The following are the re-
c o n t r o l p r o g r a m m i n ga n d p r o g r a m p r o d u c t s . T h e f a c i l i t i e s          latedreference anuals:m
d e s c r i b e di n t h i s p u b l i c a t i o nf o r t h e M o d e l 1 0 a r e a l s o a p p li -
cable to the Model 8, although the Model 8 is not referred                                                  .    IBM System/3 Card System RPG ll Reference Manual,
t o . l \ o t e t h a t n o t a l l d e v i c e s n d f e a t u r e st h a t a r e a v a i l a b l e
                                                  a                                                              S C 21 - 7 5 0 0
on tlre Model 10, areavailable n the Model 8. Therefore,
                             o
Model 8 usersshould be familiar with the contents of the                                                    .    IBM System/3 RPG ll ReferenceManual,SC2l 7504
IBM liystem/3 Modet 8lntroduction,cc2l-5144                                                            |         (Model 10, Model 12 and Model 15)

                                                                                                            o IBM System/3 Model 6 RPG ll Reference Manual,
PREFIEQUISITES                                                                                                   sc21 7511

T h i s r n a n u a la s s u m e sh a t y o u h a v ec o d e d a n d t e s t e d s o m e
                                       t                                                                    l f y o u a r e p r o g r a m m i n go n a d i s k s y s t e m ,i t w o u l d b e h e l p -
b a s i c R P G l l p r o g r a m st h a t i n c l u d e l i s t i n g r e c o r d so n a                   f u l i f y o u w o u l d u n d e r s t a n d h e d i s k c o n c e p t sa n d d i s k f i i e
                                                                                                                                                             t
p r i n t e r , s i m p l ec a l c r - r l a t i o ng r o u p t o t a l s , a n d t h e u s e o f
                                                    s,                                                      p r o c e s s i n gn f o r m a t i o n i r r t h e f o l l o w i n g b o o k s b e f o r e r e a d -
                                                                                                                              i
m o r e t h a n o n e r e c o r d t y p e . Y o u m a y h a v e g a i n e dt h i s                          ing this book:
e x p e r i e n c e h r o u g h I B M e d u c a t i o nc o u r s e s , r o g r a m m e d
                    t                                                p
instruction courses,or previous data processing                            experience.                      o IBM System/3 Disk ConceptsanclPlanning Guide,
l n t r o < T u c t i o no R P G l l , G C 2 1 . 7 5 1 4 ,c o n t a i n ss o m e o f
                        t                                                                                     G C Z | - 7 5 71
t h i s b a s i ci n f o r m a t i o n .
                                                                                                            .    IBM System/3 RPG ll Disk File Processing Programmer's
                                                                                                                 Guide. GC217566
                                                                                                                                         How To UseThe Manual




This publication is a programmer's guide; it is not intended                                               For ease illustration.
                                                                                                                   of             many of the examples this book
                                                                                                                                                      in
to servethe same purpose as a referencemanual of language                                                  usecard-like figures represent
                                                                                                                               to         records.This doesnot
specificationsand does not replacea referencemanual.                                                       imply that a carddevicemust be usedfor input or output
R P C il l p r o g r a m m i n gt o p i c s a r e a p p r o a c h e d n d o r g a n i z e d
                                                                       a                                   in thesesituations.Any of severalinput/outputdevices
                  t                                                              j
a c c c , r d i n go t h e i r n o r m a l u s e i n a d a t a p r o c e s s i n go b , u s i n g          might be used, depending which System/3
                                                                                                                                    on                modeland
e x a r n p l e s h e n e v e rp o s s i b l e . U n l i k e a r e f e r e n c e a n u a l ,
                   w                                                                  m                    configuration you are using.
i n d i ' r i d u a l h a p t e r sa r e s e l f - c o n t a i n e d n i t s o f i n f o r m a t i o n ,
                    c                                              u
interrdedto be read from beginning to end. However, if you
d e s i n e n f o r m a t i o n a b o u t a s p e c i f i ct o p i c , y o u m a y g o
              i                                                                                            ReYiewOuestions
direrctlyto that topic by using the index or the table of
c o n t e n t s . l t a n i n d i v i d u a lc h a p t e r h a s a s p e c i a lp r e r e q u i s i t e    Review questions and answers provided the end of
                                                                                                                                         are         at
t o p i c , t h a t t o p i c i s c l e a r l y i d e n t i f i e do n t h e t i t l e p a g eo f          eachchapter.Wherechapters     containseveral relatedtopics.
the r:hapter.                                                                                              thesequestions grouped subtopic. lf you wish,you
                                                                                                                          are          by
                                                                                                           may turn to the end of the chapterafter you complete  each
Altfrough the chapters are complete units, there is a logical                                              subtopic. answer reviewquestions
                                                                                                                    to        the                  and reinforce what
progressionof topics through chapters 1-6. Therefore, you                                                  you havelearned, beforecontinuing chapter.
                                                                                                                                              the
may wish to read them consecutively. lf you have read the
RPC;ll Programming Fundamentals Programmed Instruc
tion course, Vou do not need to read chapters 1-6 consecu-
tivelly.
                                                                                                                                      P a q ec t G C 2 1 - 7 5 6 7 - 2
                                                                                                                                      l s s u e d 1 D e c e m b e r1 9 7 9
                                                                                                                                                 2
                                                                                                                                      By TNL: cN21-5709

                                                                                                                                                    Contents




HOW TO USE THE MANUAL                                                 iii   CI-IAPTER3. CONTROLI-ING PRII\ITEROUTPUT                                                     3-1
                                                                            Inlroduction                                                                                 3 2
CH]APTER . RPG II LOGIC
           1                                                      1-1       Using Overflow and Fetch Over-flow To Control Page
Introducti
         on                                                       1-2        Formatlrng                                                                                  32.
Basic Data Processing Logic                                       1-2          Overtlow Indicators                                                                       ?,)
B a r ; i cR P G l l L o g i c                                    1-4          Specificarions for Usrng Overflow Indicators                                              3 4
    Specific Steps in Easic RPG tl Logic                          t-r)         P r e v e n t i n g R e c o r d s F r o m P r - i n t i n gO v e r l - h e
     First Program Cycle .                                        1-1            P e r fo r a t i o n                                                           . 3-6
    Sumrnary of Basic RPG ll Logic                                1-7          Fetch Overflow                                                                     3 8
R P t Gl l L o g i c R e l a t e d T o I n d i c a r o r s        1-7       Aligning Forms                                                                         J -    l l
     1P (F rst Page) Indicators                                  1-13       Editrng                                                                                3 -1 2
     Last []ecord Indicator (LR) .                                t - t o      Methods ot Fditinil                                                                 312
    Record ldentifying Indicators (0,|-99)                       1-'19         Editing and End Posrtron                                                            3 19
    Field Indicators(01-99)                                                 Using *PLACE To Print Duplicate Information
                                                                 1-25                                                                                              3- 1 9
    R e s u l t i n g I n d i c a r o r s( 0 i - 9 9 )           1-31          Specifrcatrons For Llsing *PLACE                                                    ?     11

    H a l t I n d i c a t o r s ( H 1- H 9 )                     I -JJ         FormationOf Print Lrrres                                                            3-22
    Overf ow Indicator (OA-OG. OV)                               1-41          Printrng A FielcJ everal Times On The Same Line
                                                                                                            S                                                      3-26
    Matching Records Indicator (MR)                              1-42       Using Two Pnnter Uutput Filesin One Program                                            ) a a

    Setting Indicators                                           | -z+J        Model 10 Card and Disk Systems                                                      328
                                                                               Model 6 .                                                                           328
IRE'VIEW1                                                        145           F i i e D e s c r r p t r o nS n e c i l r c a l r o n s                            328
                                                                               Output Format Specifications                                                        3-29
T A N S W E R S O R E V I E W1
              T                                                  146           Example: Enij of the-Monrh Billing                                                  3 -3 1
I 3 H A P T E I R, D E S C R I B I N G N D U S I N G I N P U T
                2                     A                            2-1      REVIEW 3                                                                           . 3-33
Introduction                                                                  Overflow and Fetch Over{low                                                                2?
                                                                                                                                                                   "
llontroi F:ir3ldg                                                             F o r r n sA l i g n m e n l                                                         334
    Split Control Fields                                          2-5         Editing                                                                              334
Checkingthe Sequence Flecord
                    of       Types                                2-6         *PLACF
                                                                                                                                                                   3-35
  Orderof RecordTypes Within a Group                              2-6           Dual PrinterOulpul t ites                                                          3-35
  Check.ing Order of RecordTypes in a Group
           the                                                   2-12
   Incorrect Records Withrn a Group                              2-12       ANSWERS TO REVIEW 3 ,                                                              . 3-36
   Sequenced and Unsequenced Record Types in
     a Group                                                     2-14       CHAPTER 4. CARD OUTPUT.OPERATIONS                                                  .     4-1
   Unexpected or Unused Records Within a Group                   z- tq      Introductron                                                                       .    4-2
Field Record Relation lndicators                                 2 - 15     P u n c h i n g A n d P r i n t r n gO n C a r d s                                 .    4 2
   r O RR e l a t i o n s h i p                                  2-15           Punched Output                                                                 .    4-2
   t0R Relationship With Field Record Relation                                  P r i n t r n gO n C a r d s                                                   .    4 2
     En t r i e s                                                2-16       Using One File For tsoth lrrput And Output                                              4 8
   Field llecord Relation with Control Fields                    2-18           Punching into The Sanre Card That ls Read                                           4-8
   Field Record Relation with Split Control Fields               2-18           Punching Into A Blank Card In The File                                             4-11
CorrditiorringUse of lnput Files (External Indicators)           2-'t9          When To Specify A Combinecl File                                                   4 14
   Using t)ne Prograrn to do More Than One Job                   2-'t9      Stacker Selection                                                                      414
   lEndingThe Program Before Processing All Files                               Input Arrd Cornbined FileCards                                                     415
     Completely                                                  2-22           Stacker Selectirig Output File Cards                                               4 1 1
                                                                                Merging Input And Output FileCards                                                 415
RE\/f EW i2                                                      2-25
                                                                            REVIEW 4                                                                               4-21
I\NSWERS TO REVIEW 2 .                                           2-28         P u n c h i n g a n c JP r i i ' r t i n g n C a r d s
                                                                                                                       O                                           4-21
                                                                              Using Orre FrleFor Both Input And Or.rtprut                                          421
                                                                              Stacker Selcction                                                                    423

                                                                            ANSWERS TO REVIEW 4                                                                . 4-25
CHAPTER 5. CONTROLLING OPERATIONS IN AN                                                          R E V I E W5                                                         5-73
  RPG II PI1OGRAM .                                                                      5-1        Additional Uses Of Indicators                                     5-73
lrrtroductiorr                                                                           3 1        Controlling Operations On The Basis of the Next
Additional Llses of Indicators To Control Calculations                                               Record In A File                                                 5-14
  ;:nd Output                                                                            5-2        Moving Data                                                       5-74
     Preventing Operations From Being Done When                                                     B r a n c h r n gI n C a l c u l a t i o n s                      5-75
      An Errrlr Occurs .                                                                 5-2        Using SubroutrnesIn Calculatiorrs                                 5-75
    Controll ng Which Operations Are Done for a                                                     Special Uses Of Control Level Indicators                          5-76
      Specific Program Run                                                               5-7        Binary Field Operatrons                                           5-76
    Controllrng Calculations When Overflow Occurs                                       5 - 11      Dual Input/Output Areas                                           5-76
     Performing Calculations On The Basis of the
      Resultr;Of Other Calculations                                                     5-12     A N S W E R S T O R E V I E W5 .                                .   . 5-77
Conlrolling t]perations on the Basis of the Next
 llecord In A File                                                                      5 - 17   C H A P T E R6 . M A T C H F I E L D SA N D M U L T I F I L E
    Process ng Card or Disk Files                                                       5 - 17    PROCESSING                                                           6-1
    CheckinE For Duplicates                                                             5-20     Introduction                                                          b-l
    Doing Special Operations When There ls Onlv                                                  Checking Sequence Of Records Within A File .                          6-2
     One Record In A Group                                                              5-26         File Containing Only One Record Type                              6,2
    Doing Special Operations For The Last Record                                                     File Containing More Than One Record Type                         Cr-b
     In A Group                                                                         5-28     Using Match Fields With Field-Record Relation for
   Additiorral Points To Consider About Look Aheao                                      s-28      More Than Orre Record Type in a File                                 6-8
Moving Data                                                                             5-28         Match Fields The Same For All Record Tvpes                        6,8
    Specifications For Moving Data                                                      5-29         Match Fields Differ Between Record Types                          6-9
    Saving Information From A Field Bv Move                                                      Matching Records: One Record Type in Each File                       6-12
     Operatrr:ns                                                                        q_e 1
                                                                                                     Processing Order: More Than One Matching Record
    Separating One Field Into Two Parts                                                 E_??          In A Secondary File                                             6-12
    C h a n g i n g F i e l d T y p e ( A l p h a m e r i co r N u m e r i c )          5-34         Processing Order: More Than One Matching Record
Branching In Calculations                                                                             In The Primary File                                             6-20
      Bypassirrg Calculations                                                           5-36         M a t c h i n g R e c o r d s : nr"ora" Which Have No Match
      Branching Backward                                                                5-42          In The Other Fiie                                               6-20
Using Subroutinesin Calculations                                                        5-44     Matching Records: More Than One Record Type In
     Using Subroutines To Do The Same Calculations                                                A File .                                                            6-26
        Several Times In One Cycle                                                       5-45        Match Fields In Different Locations In The
     Controlling Overlay by Using Subroutines                                            5-54         Same Frle                                                       6-26
RPG ll LinkageEditor                                                                     5-54        Processrng Records Which Do Not Have Match
      LinkageEditor Map                                                                  5-55         Frelds                                                          6-29
     Simple Ctverlays                                                                    5-56    Matching Records: When All Records In One File
     Speciai Open                                                                      5-56.1     Have Been Processed                                                 6-30
     Overlay litarting Addresses                                                       5-56.1    Use of Match Fields and Control Fields In the Same
     Fitting Available Storage                                                         5-56.3     File                                                                6-34
      R P G l l l . - o g i ca n d F u n c t i o n S h i f t i n g                     5-56.3    Determining Whether Files Should Be Primary or
S p e c i a l U s e r so f C o n t r o l L e v e l I n d i c a t o r s                 5-56.4     Secondary                                                           6-38
     Internal Control Level Indicator L0                                               5-56.4
     Using Control Level Indicators As Calculation                                               R E V I E W6                                                         6-41
       ConditioningIndicators                                                           5-59        ReviewProblern                                                    6-44
     Group Printing                                                                     5-59
B i n a r y F i e l c lO p e r a t i o n s ( C o n t r o l l i n g S w i t c h e s )    5-67     ANSWERSTOREVIEW6.                                                   .6-46
    BITON OperationCode                                                                 5-67        Solutron l-o The Review Problem                                   6-49
    BITOFOperationCode                                                                  5-67
    TESTB0peration Code                                                                 5-68
   Example                                                                              5-69
           'Ihe
Increasing      Speed of Operations (Dual l/O Areas)                                    5-69
     D u a l I n p r uA r e a s
                      t                                                                 5-69
     D u a l O u t p u tA r e a s                                                       5-tl
                                                                                                                                          P a g eo f G C 2 1 - 7 5 6 7 - 2
                                                                                                                                          lssued21 December 1979
                                                                                                                                          By TNL: GN21-5709

C H A P T E R7 . P R O G R A M M E DC O N T R O LO F I N P U T                                      CHAPTER 9" ARRAYS                                               9-1
 AI{D OUTPUT                                                                                7-1     Introduction                                                    9-2
Introduction                                                                                l-2     When To Use an ,ArravInsteadof a Table                          9-2
l\lterringThe Order of Processing Files (Force                                                      DefiningAn Array                                                9-2
   0peration)                                                                            . 7-2      Referencing ElementsIn An Array
                                                                                                                All                                                 9-4
      i3peofy'ing The Next File To Process                                                             Array to Array Calculations                                  9-4
      Alternating Processing Between Two Files                                           . 7-4         Calculations Using Arrays and Single Fields(Or
       Forcing A Number of Records From a File                                              1   1
                                                                                                        Constantsi                                                 9-7
       l-ook-Ahead To Determine Whether A File ls To                                                   Adding All Elements  Within An Array                        9-8
         Be Forced                                                                         /- tc       Output of an Entire Array                                   9-g
Pro,ressingDemand Files (Read Operation)                                                  7-22         Accumulating  Groups Of Totals                             9-14
      llonsirjerations For Using READ and Demand                                                    Referencing IndividualElements an Array
                                                                                                                                    of                            9-19
         Files                                                                            7-26         IndexingAn Array                                           9-20
f ] e p r e t i t i v eO u t p u t ( E x c e p t O p e r a t i o n )                      7-26         Output of IndividualElements An Array
                                                                                                                                     of                           9-22
      lJsing EXCPT and *PLACE                                                             7-26         ReferencingOnly Part of a Field                            9-23
      llonditioning The Use of EXCPT Operation                                            7-29      LOKUPOf An Array                                              9-27
                                                                                                       Searching Array For A Particular
                                                                                                                 An                       Element                 9-27
]lE\/tEW 7                                                                              . .7-31        Searching Array For More Than One Element
                                                                                                                 An                                               9-32
   FC)RCE                                                                                  7-31        Output During An Array Search                              9-34
   I 1 E A D.                                                                              7-32     LoadingArrays                                                 9-35
   EXCP'T                                                                                  7_33        CompileTime Arrays                                         9-35
                                                                                                       Pre-execution Time Arravs                                  9-36
l\NrSU,/EtlS REVIEW 7
           TO                                                                            .7-34         Storing Input Data Into ExecutionTime Arrays               9-38
                                                                                                       Arrav Data Consecutive More Than One Record
                                                                                                                               On
                                                                                                        (Model 6, Model 10 Disk System,and Model 15)              9-44
CH,APTER 8. TABLES                                                                          8-1
lntr,cductron                                                                               8-2     REVTEWI                                                      . 9-53
     l S e a r c h i n ga S i n g l e T a b r e                                             B-4
     Desigrring Table Input Records                                                         g-4
                                                                                                    A N S W E R S T OR E V I E W g .                             .9-55
     D e s c r i b r i n gT a b l e I n p u t R e c o r d s W i t h E x t e n s i o n
        S p e c i fi c a t i o n s                                                         B-5      C H A P T E R1 0 . W O R K I N G W I T H D A T A
     {loding The Table Lookup Operation (LOKUP)                                            B-7       STRUCTI.JRE                                                . 1O-1
l-wo Table Search                                                                          8-8      Character   Structure                                         1O-2
     Designing Table Input Flecords For Two Tables                                        8 - 11       Representation Characters 96-ColumnCards
                                                                                                                         Of                On                     10-2
     D e s c r i L r i n gT w o T a b l e s W i t h E x t e n s i o n
                                                                                                       Representation Of Negative Numbers                     . 10-3
        S p e c i fi c a t i o n s                                                        8 - 13       Representation of Characters In Storage                . 10-4
     Codinq The Table Lookup Operation (LOKUP)                                            B-1  4       Difference Between Character Representation on
L J s i u g I a b l e D a t a I n C a l c u l a t i o n sa n d O u t p u t                8 - 14         Cards and In Storage                                     10-4
     Conditiioning Operations On The Basis of a Table
                                                                                                       ldentifying Bit Combinations With Numerical
        Lookup                                                                            8-1  4        Values                                                   10-13
     l?efererrrcing ata Following A Successful Search
                              D                                                           8 - 16       Assigning Numerical Values to Zone ancl Digit
     llearching For Low, High, or Equal Conditions                                        8 - 19         Portions                                                10-16
     lVoving Data In A Table Entry                                                        8-21         Saving Disk Storage Space                                 10- 9
                                                                                                                                                                    1
     l V l o d i fy i n g T h e C o n t e n t s O f A T a b l e                           8-22      Collating Sequence of Characters                             10-21
t.oading liables                                                                          8-25         Collating By Zone or Digit                                10-25
     llomp le Time Tables                                                                 B-25      Altering the Collating Sequence                              10-2_8
  P r e - e x  ' c u t i o nl - i m e T a b l e s                                         B-25         Specifying Changes In Collating Sequence .                10-28
  l*oading Pre-execution Time Tables                                                      B-26         Coding Characters To Be Equal                             10-33
Oulput or an EntireTable                                                                  8-28         Recording Specifrcations For The Altered
                                                                                                         Seouence                                                10-38
flE\/lEW I                                                                               . 8-29
     lleview Problem                                                                      8-30




                                                                                                                                                                     vll
Alterrng The Structure of Characters                                                10-39    C H A P T E R1 1 . D E B U G               't
                                                                                                                                           1"1
     How Move Zone Operations Work                                                  10-39    lntroduction                               11-2
     Coding a Move Zone Operation                                                   10-39    Using The DEBUG Function                   I t-l
     D i f f e r e n c , e sI n T h e M o v e Z o n e O p e r a t i o n s           10-40       Specifications    For DEBUG             11,-2
     Field Forrnat and Move Zone Operations                                         10-41       Formatof RecordsCreatedBv DEBUG
     Example of a Move Zone Operation                                               10-41       Getting ResultsFrom DEBUG
     C l ' r o o s r n gt h e M o d e l C h a r a c t e r F o r F a c t o r 2       't0-42                                              .r
                                                                                                Placement DEBUG
                                                                                                             of                           1-5
T r an s l a t i n g C h a r a c t e r s                                            10-44       Making Your ProgramWork For All Cases   11 , 5
     Need For FileTranslation                                                       10-44
     Specifyrn'gFile Translation                                                    10-44    R E V I E W1 1                             11-7
     Recording Specifrcations For The Translation
      Table                                                                         10-48    A N S W E R S T O R E V I E W1 1           11-8
REVIEW 1O                                                                           1049     INDEX                                      x"1
  Character Structure                                                               10-49
  Collating liequence of Characters .                                           .   10_49
                   'l-he
  Altering                  Collating Sequence                                  .   10_50
  Alrering l-he Structure of Characters                                         .   10-50
  T r a n s l a t i r r r ;C h a r a c t e r s                                  .   10_50

ANiSYYgPgTO REVTEW10                                                                1O_S1
                                                                                                                                       Chapter1. RPG ll Logic




CHAPTER 1 DESCRIBES:

       B a s i cR P G l l l o g i c .


       R P G l l l o g i c r e l a t e dt o i n d i c a t o r s .



A F T E R R E A D I N G T H I S C H A P T E RY O U S H O U L D B E A B L E T O D E S C R I B E :

       B a s i ct h r e e - s t e p o g i c o f a d a t a p r o c e s s i n go b .
                                  l                                         j


       D e t a i lt i m e a n d t o t a l t i m e .


       S p e c i f i cs t e p si n a b a s i c R P G I I j o b t h a t i n c l u d e s e t a i l a n d t o t a l o p e r a t i o n s .
                                                                                      d


       R P G l l l o g i c r e l a t e dt o t h e f o l l o w i n g i n d i c a t o r s : 1 P , L R , r e c o r d i d e n t i f y i n g
       i n d i c a t o r s , i e l d i n d i c a t o r s , e s u l t i n gi n d i c a t o r s , a l t i n d i c a t o r s( H 1 - H 9 ) , o v e r f l o w
                           f                             r                                    h
       i n d i c a t o r s( O A - O G , O V ) , m a t c h i n gr e c o r d si n d i c a t o r ( M R ) .

       fuofe.' You can use the review questions contained in Review / at the end of this
       chapter to test your comprehension of the chapter. Answers follow the review
       o u e s to n s .
                t




                                                                                                                                                           RPGll Logic   1-1
 INTRODUCTION                                                                                             R P G l l l o g i c i s b u i l t a r o u n d t h e s ei n d i c a t o r s . T h e i r s t a t u s
                                                                                                          ( o n o r o f f i a f f e c t st h e s e q u e n c e f t h e p r o g r a m ' so p e r a t i o n s .
                                                                                                                                                              o
 W h a t p r o c e d u r e s o y o u f o l l o w i f y o u a r e p r e p a r i n gb i l l s t o
                               d                                                                          T h e l o g i c i s s e t u p t o t e s t t h e s t a t u so f v a r i o u si n c l i c a t o r s t
                                                                                                                                                                                                          a
 s e n dt o c u s t o m e r s ?B e f o r e y c u c a n d o a n y t h i n g y o u n e e o                  s p e c i f i ct i m e s . B y t e s t i n g i n d i c a t o r s , h e p r o g r a m k n o w s
                                                                                                                                                                           t
 s o m e i n l o r m a t i o n . Y o u h a v et o k n o w t h r e et h i n g s : ( 1 )                    what to do next.
 t h e c u s t o m e r ' sb a l a n c ea t t h e b e g i n n i n go f t h e m o n t h ; ( 2 )
 h i s p u r c h a s e sa n d ( 3 ) h i s p a y m e n t s . O n c e y o u h a v e
                           ;                                                                             R P G | | p r o g r a m l o g i c i s d e s i g n e d o t a k e c a r eo f a l l t y p e s o f
                                                                                                                                                              t
 g a t h e r e dt h i s i n f o r m a t i o n , y o u c a n p e r f o r m t h e n e c e s s a r y        jobs. You must understand his logicto write specifcations
                                                                                                                                                     t                                      i
calculationso find the amount due. Finally you record
                    t                                                                                    w h i c h m a k e c o r r e c t u s eo f i t .
t h i s a m o u n t o n t h e b i l l . Y o u g o t h r o u g h t h e s es a m ep r o -
c e d u r e sf o r e a c h c u s t o m e r .                                                             B e c a u s eh e l o g i c i s a r a t h e r c o m p l e x t o p i c , i t i s d e s c r i b e d
                                                                                                                       t
                                                                                                         s e g m e n tb y s e g m e n t . H o w e v e r ,w h e n y o u h a v e f i n i s h e d
T h i s i s a t y p e o f j o b y o u c a n e a s i l yh a v ey o u r c o m f l u r e r o o              r e a d i n gt h i s s e c t i o n .y o u w i l l h a v ea p i c t u r e o f h o w t h e
f o r y o u , T o d o t h e j o b , h o w e v e r ,t h e c o m p u t e r m u s t k n o w                 c o m p l e t e R P G l l p r o g r a m l o g i cw o r k s .
t h e s a m et h i n g s y o u k n o w . Y o u m u s t , t h e r e f o r e ,t e l l i t
e x a c t l y w h a t i n f o r m a t i o n t o e x p e c t ,w h a t t o d o w i t h t h e
i n f o r m a t i o n ,a n d w h a t t o g i v ey o u a s a r e s u l t . T h i s y o u d o              B A S I C D A T A P R O C E S S I N GL O G I C
t h r o u g h s p e c i f i c a t i o n s o u w r i t e : F i l e D e s c r i p t i o n ;E x t e n .
                                        y
s i o n ; L i r r eC o u n t e r ; I n p u t ; C a l c u l a t i o n ; n d O u t p u t - F o r m a t .
                                                                     a                                   U s u a l l y ,a l l r e c o r d si n a f i l e o f i n p u t r e c o r d sa r e n o t r e a d a t
                                                                                                         o n c e . Y o u r c o m p u t e r p r o b a b l y i s n o t l a r g ee n o u g ht o s t o r e
T o d o t h i s b i l l i n g j o b , y o u d o t h i n g s i n a l o g i c a lo r c j e r . y o u       a n d w o r k w i t h i n f o r m a t i o n f r o m a l l r e c o r d sa t t h e s a m e
readinformation first. You do calculations econd. Finally,               s                               t i m e . T h e r e f o r e ,r e c o r d sa r e r e a d o n e a t a t i m e . T h r e e
a s a r e s u l t o f t h e c a l c u l a t i o n sy o u r e c o r d t h e a m o u n t o w e d .
                                                   ,                                                     s t e p s ,a s s h o w n i n F i g u r e 1 - 1 , a r e d o n e f o r e a c h r e c o r d r e a d .
T h e n y o u b e g i n t o d o t h e s a m et h i n g s r n t h e s a m eo r d e r f o r
tne next customer.                                                                                       The phrasepragram cycle refersto all the operations per-
                                                                                                         formed from the time one recordis readuntil the next rec-
T h e c o n r p u t e rm u s t a l s o d o t h i n g s i n a l o g i c a lo r d e r . T h e              o r d i s r e a d . O n e p r o g r a m c y c l e i s t h e r e f o r eo n e r e v o l u t i o n
i n f o r m a t i o n y o u s u p p l y t h r o u g h s p e c i f i c a t i o n s o e s n ' tg i v e
                                                                                d                        a r o u n d t h e c i r c l e u s e dt o i l l u s t r a t et h e p r o g r a m l o g i c . S i n c e
t h e c o m p u t e r t h e l o g i c i t n e e d st o d o y o u r j o b ; t h e R p G l l               o n e p r o g r a mc y c l e ( o n e r e v o l u t i o n ) i s n e e d e df o r e a c n r e c -
C o m p i l e r s u p p l i e s h i s . R P G l l l o g i c s u p p l i e db y t h e c o m -
                               t                                                                         o r d r e a d , m a n y p r o g r a m c y c l e sa r e r e q u i r e df o r e v e r y j o b .
p i l e r i s t h e f r a m e w o r k f o r y o u r j o b . W h e n y o u r s o u r c ep r o -
g r a m i s r : o m p i l e d ,y o u r s o u r c es t a t e m e n t s r e f i t t e d i n t o t h e
                                                                    a                                    C o n s i d e rh o w t h e t h r e e s t e p l o g i c s h o w n i n F i g u r e 1 - l w o r k s
f r a m e w o r k o f R P G l l p r o g r a ml o g i ct o m a k e a c o m p t e t e                      f o r a j o b w h i c h r e q u i r e sa d e t a i l e dl i s t i n go f p u r c h a s e s a d e
                                                                                                                                                                                                  m
p r o g r a m . T h e g e n e r a t e d r o g r a mt h e n h a s a l l t h e i n f o r m a -
                                          p                                                              b y e a c hc u s t o m e r . T h e i n p u t f i l e i s i n a s c e n d i n g r d e r b y
                                                                                                                                                                                         o
t i o n i t n e e d st o d o y o u r j o b i n a l o g i c a lm a n n e r .                              c u s t o m e rn u m b e r . E a c h r e c o r d c o n t a i n sc u s t o m e rn a m e
                                                                                                         ( N A M E ) , n u m b e r ( N U M ) , a n d c h a r g e( C H R G ) . I n f o r m a t i o n
W h a t h a p p e n si f , i n d o i n g y o u r b i l l i n g j o b , y o u f i n d t h a t a           from the record is merely transferred to the printed page.
c u s t o m e rp a i d m o r e t h a n h e o w e d ? Y o u k n o w i m m e d i a t e l y                 O n e l i n e i s p r i n t e d f o r e a c hr e c o r dr e a d . E a c h r e c o r d r e a d
t h a t h e h a s a c r e d i t b a l a n c ea n d i n d i c a t es o o n t h e i n v o i c e .          is known asa detail recordand each line printed is a detail
H o w d o e st h e B P G | | p r o g r a mr e c o g n i z e h i s s i t u a t i o n ?
                                                                    t                                    line.
And how doesit know what to do when sucha situation
occurs?                                                                                                  The job begins: the f irst recordis read. No calculations re                                   a
                                                                                                         p e r f o r m e d . A r e c o r d i s t h e r r p r i n t e d . T h i s e n d st h e f i r s t p r o -
T h e R P G l l p r o g r a m u s e ss i g n a l s h i c h t e l l i t w h e n a p a r t i c -
                                                         w                                               g r a m c y c l e . T h e s e c o n db e g i n sw i t h t h e r e a d i n go f a n o t h e r
u l a r s i t u a t i o no c c u r sa n d w h a t t o d o w h e n t h a t s i t u a t i o n              r e c o r d . F i g u r e 1 - 2 s h o w st h e i n p u t a n d o u t p u t o f t h e d e t a i l
d o e s o c c u r . T h e s es i g n a l s r e k n o w n a s i n d i c a t o r s . T h e r e
                                               a                                                         p r i n t i n gj o b .
a r e m a n y d i f f e r e n t k i n d s o f i n d i c a t o r sw h i c h s i g n a rm a n y
d i f f e r e n t s i t u a t i o n s . Y o u , a s a p r o g r a m m e r ,m u s t k n o w h o w         S u p p o s e , o w e v e r ,i n s t e a do f m e r e l y l i s t i n gt h e c h a r g e s
                                                                                                                        h
t o s p e c i f y t h e i n d i c a t o r ss o t h a t t h e y s i g n a lt o t h e c o m p u r e r      m a d e b y e a c h c u s t o m e ry o u a l s ow i s h t o f i n d t h e t o t a l
what you want them to.                                                                                   c h a r g e s o r e a c h c u s t o m e r ,a s s h o w n i n F i g u r e 1 - 3 .
                                                                                                                     f




t-z
                                           a


                                                                                                  \
                                           Writeor punch
                                                                                                   a record
                                           resu
                                              lts




                                                            Perform calculations




                                                                    .@
                           Figure 1-1. BasicLogic of a Data Processing ob
                                                                     J




                             1796 JOHN BART      2493

                         I762 BILLBELL   13142

                     1645 JOE AARON

              ,I&5   JOE AARON   742




                                                                                        1645                         J O EA A R O N                            7.42
                                                                                        1645                         J O EA A R O N                            6.43

                                                                                                                                                              13.85*


                                                                                                                                                              '13'1
                                                                                                                                                                 .42
                                                                                        1762                         BILL BELL

                                                                                                                                                              131.42*


                                                                                        1796                         J O H NB A R T                           24.93
                                                                                        1796                         J O H NB A R T                            2.98


                                           Printed reoort




Figure 1-2. Detail Printing Job                                             F i g u r e 1 - 3 . C a l c u t a t i n ga n d P r i n t i n g T o t a l s

                                                                                                                                                         RPGll Logic
T o d o t h i s , y o u m u s t d o c a l c u l a t i o n so a c c u m u l a t e
                                                                t                           a total          BASIC RPG II LOGIC
i n a d d i t i o n t o p r i n t i n g o u t i n d i v i d u a l ( d e t a i l )r e c o r d s .
                                                                                                 But
w h e n d o y o u p r i n t o u t t h e t o t a l y o u h a v ec a l c u l a t e d ?
                                                                                                 The         R P G l l l o g i c ,t h e r e i o r e , i s a n e x t e n d e dv e r s i o no f t h i s 3 - s t e o
t o t a l f o r a c u s t o m e r ,o f c o u r s e ,s h o u l d b e p r i n t e d a f t e r
                                                                                                 all         l o g i c . l t c a l l sf o r c a l c u l a t i o n s n d o u t p u t o p e 



◦ Jabse Service Manual Search 2024 ◦ Jabse PravopisonTap.bg ◦ Other service manual resources online : FixyaeServiceinfo