EXAM ONE STUDY HINTS
A. Study the following material and then go to Part B. and take the practice
- how used
- how used
control break logic
; concepts not code
& two, editing and M/F tasks
- WRITE A COMPLETE COBOL PROGRAM
FROM SCRATCH - CLOSED BOOK
Problem four - discuss changing signs
date stamp in header
picture clauses concepts
procedure division concepts
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.
the procedure division, you should know, at minimum, the OPEN, READ, WRITE,
ADD, COMPUTE, PERFORM, IF and
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.
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
Output (numeric edited):
05 AMT‑OUT PIC ZZZ,ZZZ.99.
AMT‑OUT describes 10 print position:
the 8 digits,
the decimal point
Editing is performed when the
MOVE AMT‑IN TO AMT‑OUT
instruction is executed.
this example, which requests the suppression of leading zeros up to the
0 0 0
0 0 3 0 8
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.
Indicating the sign of a number on the right
order to be handled as a signed number, the input data field must have been
described with an S in the PICTURE.
order for the sign to be indicated on output, the appropriate characters
must be included in the numeric edited field.
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.
plus sign (+) in the rightmost position of a numeric edited field will
a + sign to be printed if the field is positive,
a ‑ sign to
be printed if the field is negative.
Indicating the sign of a number on the left
+ sign or a ‑ sign may be in the leftmost position of a numeric edited
When ‑ is used, if the input field is negative the minus sign will be
printed in its fixed position;
the input field is positive the minus sign will be replaced in output by a
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)
preceded by a fixed + or ‑ sign,
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
(HINT: PIC 99999V99 would not work)
Notice that provision must be made for the number of digits in the input
field plus one.
Z, and * Edit Characters
Floating + and ‑
CR and DB Symbols
Exercise fill in the blank:
Show the printed output for each item below:
__ ___ ______
ZZ9BBCR __ ___
___ ___ ___
___ ___ ___
$$$$,$$$.99 ___ _________
___ ___ ___ __
___ _____ ___
‑ ‑ , ‑ ‑ 9.99
__ ___ ___ ___