Upload
ravikiran8p
View
218
Download
0
Embed Size (px)
Citation preview
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 1/12
IBM MAINFRAMES
COBOL Training Class-9
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 2/12
Usage Clause
The data can be stored in different format’s by using USAGE
CLAUSE the programmer can defined the data storage and
format of a particular field at the time of declaration.
Possible values for USAGE CAUSE !isplay "default# Character format.
Computation $ C%&P
C%&P'( $ C%&P')
C%&P'* "%+# Pac,ed !ecimal
-hen e use display usage clause each character ill store in
a one byte
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 3/12
Refreshing Basics
Nibble: 4 Bits Is One Nibble.
Byte: 8 Bits Is One Byte.
Half Word: ! Bits Or " Bytes Is One Half Word.
#$ll Word: %" Bits Or 4 Bytes Is One #$ll Word.
&o$ble Word: !4 Bits Or 8 Bytes Is One &o$ble Word.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 4/12
Comu!a!ion COM"
/n CO'( data items the data stored is represented in
Binary format.
P/C clause can contain S and ) only. "0 1%T A%-E!#
* WS+&A,AI,E' (IC S)-* CO'(. The memory allocation ill be as follos
S2"3(# 4 S2"35# 6alf ord 7inary.
S2"38# 4 S2"32# 9ull ord 7inary.
S2"(3# ' S2"(:# !ouble ord 7inary.
&ost significant bit is %1 if the number is negative.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 5/12
Comu!a!ion COM"-# an$ COM"-%
C%&P'( is used for Single ord floating point item. This
ill occupy 5 bytes
C%&P') is used for declaring !ouble ord floating'pointitem. This ill occupy : bytes
P/C Clause should not be specified for both C%&P'( and
C%&P').
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 6/12
Comu!a!ion COM"-&
C%&P'* is used to store the data in Pac,ed !ecimal$
he;adecimal representation.
/n this To digits are stored in each byte.
P/C clause can contain S/ 0 and ).
ast nibble is for sign. "9 for unsigned positive< C for signed
positive and ! for signed negative# < east significant bit is %1 if
the number is negative
&emory calculation is done ith the 9ormula – S2"1# C%&P'*
#or E1en number "1$)# = ( #O2 O&& number "1=(#$).
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 7/12
'ifference (e!)een COM" * COM"-&
(. Comp is a binary usage< hile comp'* indicates 3a5ed
dei6al.
). /n comp only S and 2 are alloed< hile in C%&P'* S / )
and 0 are alloed
*. 9or 7i7er bo$ndaries comp is better here as comp'* for
lo9er bo$ndaries
5. 9or comp the ma;imum bytes can be 8 bytes< here as for
comp'* it ould be bytes>8. 9or comp the sign bit is stored at 'ost Sinifiant Bit here
as for comp'* the sign is stored at Least Sinifiant Bit.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 8/12
ON SI+E ERROR
%1 S/?E E++%+ clause is coded to trap si@e errors in arithmetic
operation.
E;ample
A!! A T% 7 %1 S/?E E++%+ !/SPAB E++%+D’.
/f the condition occurs< the code in the %1 S/?E E++%+ phrase is
performed< and the content of the destination field remains unchanged.
/f the %1 S/?E E++%+ phrase is not specified< the assignment is
carried out ith truncation.
There is no %1 S/?E E++%+ support for the 'O0E statement
9i;ed'point overflo. !ivision by 3 can also be trapped.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 9/12
On O,erflo) Syn Cla$se ; Sla5 Byte
ON O0E2#LOW an be oded 9it7 S,2ING and
UNS,2ING. If t7ere is S,2ING tr$nation t7en t7e
i63erati1e state6ents follo9ed ON O0E2#LOW 9ill be
e<e$ted.
SB1C clause is specified ith C%&P< C%&P'( and C%&P')
items. These items are e;pected to start at half$full$double
ord boundaries for faster address resolution. SB1C clause
does this but it may introduce slac, bytes "unused bytes#
before the binary item.
3( -S'TEST.
(3 -S'0A+( P/C "3)#.
(3 -S'0A+) P/C S2"F# C%&P SB1C.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 10/12
RETURN-CO'E
+ETU+1'C%!E is a special register and its content is moved to
register(8 hen the control is given bac, to %S. So move the return
code to this register in the program.
+ETU+1'C%!E should not be declared in your program.
E; &%0E (333 to +ETU+1'C%!E. 'A= 4*)>
This sets return code as (333 for the step as 'A=CC that e;ecutes this
program.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 11/12
ABEN' CO'E
WO2?ING+S,O2AGE SEC,ION.
* WS+A (IC )-".
* WS+B (IC )-".
* WS+C (IC )-".
@@ WS+AB+CO&E (IC S)-4 CO'(.
(2OCE&U2E &I0ISION.
'AIN+(A2A.
ACCE(, WS+A.
ACCE(, WS+B.
CO'(U,E WS+C WS+A WS+B ON SIE E22O2
'O0E ** ,O WS+AB+CO&E. 'A= 8)"
CALL DILBOABN*D USING WS+AB+CO&E.
&IS(LA WS+C.
S,O( 2UN.
7/27/2019 COBOL_Training_Class-9.ppsx
http://slidepdf.com/reader/full/coboltrainingclass-9ppsx 12/12
Than. /ou