Home  |  Class Downloads  |    Online Web Session B  |  Online Web Session C  |









 Part A. Study the following material and then go to Part B. and take the practice test

















system z

control break logic

Problem one

Problem two

Problem three

date stamp in header

simple input picture clauses code

simple procedure division code

Exam one will be:

 A. MC/TF QUESTIONS as discussed in class

 B. The following questions deal with Problem 3, 4 & 5

 there will be    SOME    ‘VERY SHORT ANSWER' ESSAY QUESTIONS       [covering problem 3] 

there will be SOME   ‘MINOR’ DATA DIVISION CODING               [similar to problems 4 and 5]

 there will be SOME  ‘MINOR’ PROCEDURE DIVISION CODING   [similar to problems 4 and 5]

 C.  Be able to discuss at length the concept of control break logic


Therefore: you must understand everything you did in problem 3, and understand all of the code you wrote in problems 4 and 5.


Study them until you can do so, AND MAKE AN 'A' ON THE EXAM !!!!!!!


The majority of the MC questions deal with picture clauses.


 You should know the format and purpose of all the COBOL divisions.

 You should be very familiar with data division issues.

 You should know your MOVE rules.

 Given a sending and receiving set of fields be able to specify contents of each after a MOVE.

Handle moves for any type of data (raw and print fields).

Know the impact that the sign has on a move.

Know the editing rules and how data will look for any editing format.

In the procedure division, you should know, at minimum, the OPEN, READ, WRITE, ADD, COMPUTE, PERFORM, IF  and CLOSE verbs. 


The exam covers VALUE and MOVE clauses extensively. Be sure you know the rules that are applicable to data move functions (move and value) including truncation and padding.

Numeric Edited Data


Input fields or intermediate fields, such as accumulators, which will be used in arithmetic operations, are described as numeric fields, with an implied decimal point, and as having, or not having, an embedded sign in the low‑order digit, e.g., S9(6)V99.


The printing of unedited numeric data will not produce  an acceptable report for most business purposes, since it is usually necessary to show a real decimal point, to suppress leading zeros, to separate thousands by commas, to indicate the sign of the number, and sometimes, to show the dollar sign.


A convenient way to do these things has been provided for the programmer.


The output record may contain Numeric Edited fields.  The PICTURE of such fields is an edit‑word, the pattern by which numeric data will be edited before printing.


When numeric data is moved to the numeric edited field, it is edited under control of the pattern and the edited version is placed in the numeric edited field.




Input   field:                       05  AMT‑IN  PIC S9(6)V99.


Current   value   of   field:        00000308


Output (numeric edited):    05  AMT‑OUT PIC ZZZ,ZZZ.99.


AMT‑OUT describes 10 print position:    the 8 digits,

                                                            the comma,

                                                            the decimal point


Editing is performed when the  MOVE AMT‑IN TO AMT‑OUT  instruction is executed.


In this example, which requests the suppression of leading zeros up to the decimal point,


Input   field                        0 0 0  0 0 3   0 8


Edited by                          Z Z Z, Z Z Z. 9 9


will appear on output as     bbbbbb3. 0 8



Characters Used in Numeric Edited Picture Clause


The character 9 is a "digit selector" and each 9 edits one input digit.  The edited digit requires one print position.


The character . represents the decimal point for alignment purposes, and is itself an "insertion character" which re‑quires a print position.  The implied decimal point of the input field is aligned with the numeric edited decimal point and the input field is padded, right and/or left, with zeros before editing takes place.


The character Z is a digit selector and zero suppress character.  It edits one digit of an input field.  Unless a significant digit has been reached in the input data, zeros and insertion characters are replaced by spaces.


The character * is a digit selector and check protect symbol. Lead zeros and lead insertion characters are replaced with *.


The characters,  B  and 0  ,  are insertion characters.  B designates a blank or space.  They will be inserted  in the edited version if significant digits have been reached; otherwise, they will be replaced by the suppression character.


Examples:                                             Numeric

                                                            Edited                     Printed

Input Picture           Value                      Picture                    Output 


S9(6)V99                12345678               ZZZ,ZZZ.99            123,456.78


S9(6)V99                00056432               ZZZ,ZZZ.99            bbbb564.32


S9(6)V99                00000076               ***,**9.99                ******0.76


S9(6)V99                00000076               999,999.99             000,000.76


9999V99                 003275                   ZZZZ                                bb32


9(4)V99                  002565                   Z,ZZZ.99B(5)           bbb25.65bbbbb


Indicating the sign of a number on the right


In order to be handled as a signed number, the input data field must have been described with an S in the PICTURE.


In order for the sign to be indicated on output, the appropriate characters must be included in the numeric edited field.


A minus sign (‑), a two‑character field (CR or DB) included in the rightmost position of a numeric edited field will be printed if the input data is negative.


A plus sign (+) in the rightmost position of a numeric edited field will cause:


          a + sign to be printed if the field is positive,

          a ‑ sign to be printed if the field is negative.




Input Picture           Value                                Edited                     Printed


S9999V99               ‑123456                            Z,ZZZ.99BBCR       1,234.56  CR

                               000385                                                                 3.85 

                              ‑000006                                                                   .06  CR


999V99                   ‑53220                              ZZZ.99BB‑                 532.20


S999V99                 ‑33460                                                               334.60 




Indicating the sign of a number on the left


A + sign or a ‑ sign may be in the leftmost position of a numeric edited field.


When ‑ is used, if the input field is negative the minus sign will be printed in its fixed position;


if the input field is positive the minus sign will be replaced in output by a space.


When + is used, if negative the ‑ sign will print,  if positive the + sign will print.



The Stationary Dollar Sign


The $ is an allowable numeric edited character and may be given a fixed position, either as the first character of the string, (HINT: make the print field big enough, because the $ will always print)


       e.g.,    $ZZZ,ZZZ.99BCR


or preceded by a fixed + or ‑ sign,


       e.g.,    ‑$ZZZ,ZZZ.99.



The Floating Dollar Sign or Plus Sign or Minus Sign



The $ or ‑ or + may be used in a string to provide for lead zero suppression and for "floating" the $ or + or ‑ to a print position immediately preceding the first significant digit.



The numeric edited field $$,$$$.99 would be the correct PIC for a field which would edit an input field  PIC 9999V99.    (HINT: PIC 99999V99 would not work)



Notice that provision must be made for the number of digits in the input field plus one.



Input Picture                     Value                      Edited                      Printed


9999V99                           003450                   $$,$$$.99                    $34.50   

                                        000000                                                          $.00 

                                        123456                                                 $1,234.56



   S9999V99                      -763894                  --,---.99                 -7,638.94

                                          763894                                                 7,638.94

                                         -005665                                                      -56.65



S9999V99                         ‑763894                  ++,+++.99          -7,638.94

                                          763894                                           +7,638.94

                                          000785                                                  +7.85


 The $,   Z, and * Edit Characters


                Source field                           Receiving field


              Picture      Value                     Picture          Edited result


a)  9999V99            000123                   9999.99          0001.23

b)  9999V99            000123                   ZZZZ.99               1.23

c)  9999V99            000123                   $$$$$.99            $1.23

d)  9999V99            000123                   $ZZZZ.99        $      1.23

e)  9999V99            000123                   $****.99           $***1.23





  Floating + and ‑ Characters


           Source field                                Receiving field


          Picture          Value                       Picture         Edited result


a)  S9(4)                  1234                      ++,+++         +1,234

b)  S9(4)                  0123                      ++,+++          +123

c)  S9(4)                 -1234                      ++,+++         -1,234

d)  S9(4)                  1234                        --,---             1,234




     CR and DB Symbols


          Source field                                 Receiving field


       Picture             Value                       Picture                   Edited result


a)  S9(5)                           98765                     $$$,999CR             $98,765

b)  S9(5)                           ‑-98765                    $$$,999CR             $98,765CR

c)  S9(5)                            98765                    $$$,999DB              $98,765

d)  S9(5)                           ‑98765                    $$$,999DB              $98,765DB



Exercise fill in the blank:


Show the printed output for each item below:




Input              Input           Edited

Picture          Value            Item             Printed Output



S9(6)V99      00034573     ‑Z(6).99        __ ___ ______    



999               565               ZZ9BBCR   __ ___ ___ ___



S9(4)V99      076396         ZZZZ.999+   __ ___ ___ ___



999               324               9B9B9B0B0   _ ___ ___ ___



9(6)V99        00056789     $$$$,$$$.99  ___ _________




9(6)V99        00056789      $ZZZ,ZZZ.99     ___ ___ ___ __  



9(4)V99        ‑005387        ‑$9,999.99           ___ _____ ___



S9(4)V99      ‑005387        ‑ ‑ , ‑ ‑ 9.99        __ ___ ___ ___


Part B. Next take the practice test for Exam 1 - please  go to this link to download the practice questions  and take the test