Sei sulla pagina 1di 10

Data Area

Day 13
Data Area:
Overview:
This module enables the student to understand the concept of Data Area.
Outline:
Topics covered,
Create Data Area.
Change Data Area
Delete Data Area.
Retrieve Data Area
Data area opcodes.
Objective:
By the end of this module, the student should be able to
Create a Data!Area
Change Data Area
Delete Data Area.
Retrieve Data Area
"nderstand the Data Area opcodes.
# Du$e%tar Technologies &vt. 'td. 1(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
Defnition
Data Area is an ob*ect used for passing information bet+een programs +ithin a *ob and
bet+een *obs.
T+o programs cannot simultaneously use the same data area for update. ,f the program
calls another program that uses the same data area +ith "-'C. opcode before the other
program is called.
Steps to create data Area.
1. Type CRTDTAARA on Command prompt.
/. &ress 01
3. The screen sho+n belo+ +ill get displayed.
Create Data Area (CRTDTAARA)

Type choices, press Enter.

Data area . . . . . . . . . . . DTA1 Name
Library . . . . . . . . . . . PB0101! Name, "CRL#B
Type . . . . . . . . . . . . . . "C$AR "DEC, "C$AR, "L%L, "DD&
Len'th(
Len'th . . . . . . . . . . . . )1 1*)000
Decima+ positions . . . . . . 0*,
#nitia+ -a+.e . . . . . . . . . /D0E1TAR TEC$N!L!%#E1/
Te2t /3escription/ . . . . . . . "BLAN0











Bottom
456E2it 476Prompt 486Re9resh 4106A33itiona+ parameters 41)6Cance+
4156$o: to .se this 3isp+ay 4)76&ore ;eys



4. &ress 2nter and Data Area +ill get created +ith initial value 3Du$estar
Technologies4
# Du$e%tar Technologies &vt. 'td. /(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
Change Data Area.
1. Type C56DTAARA on Command prompt.
/. &ress 01
3. The screen sho+n belo+ +ill get displayed.
Chan'e Data Area (C$%DTAARA)

Type choices, press Enter.

Data area speci9ication(
Data area . . . . . . . . . . DTA1 Name, "LDA, "%DA, "PDA
Library . . . . . . . . . . PB!101! Name, "L#BL, "CRL#B
1.bstrin' speci9ications(
1.bstrin' startin' position . 1 1*)000, "ALL
1.bstrin' +en'th . . . . . . . 18 1*)000
Ne: -a+.e . . . . . . . . . . . /DATA AREA /








Bottom
456E2it 476Prompt 486Re9resh 41)6Cance+ 4156$o: to .se this 3isp+ay
4)76&ore ;eys


4. &ress 2nter and Data Area +ill get changed
Delete Data Area.
1. Type D'TDTAARA on Command prompt.
2. &ress 01
. The screen sho+n belo+ +ill get displayed.
De+ete Data Area (DLTDTAARA)

Type choices, press Enter.

Data area . . . . . . . . . . . DTA1 Name, 'eneric"
Library . . . . . . . . . . . PB0101! Name, "L#BL, "CRL#B...














Bottom
456E2it 476Prompt 486Re9resh 41)6Cance+ 4156$o: to .se this 3isp+ay
4)76&ore ;eys

# Du$e%tar Technologies &vt. 'td. 3(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
4. !ress "nter to Delete the Data Area
#etrieve Data Area
$o retrieve the value o% data area we have to write a C& progra'
1. Create a C& progra' C&2
Co+.mns . . . ( 1 <1 E3it PB01011=&>CLP
1E66? CL)
4&T "" ...@... 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0001.00 P%&
000).00 DCL BAR(an3BAR1) T>PE("C$AR) LEN(10)
0005.00 RTBDTAARA DTAARA(PB0101!= DTA1 (1 10)) RTNBAR(an3BAR1)
0007.00 1NDP%&&1% &1%(an3BAR1)
0008.00 ENDP%&
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""











456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys
(C) C!P>R#%$T #B& C!RP. 1,C1, )00).
/. #etrieve Data Area (#$)D$AA#A7 is used to retrieve values %ro' a data
area
Retrie-e Data Area (RTBDTAARA)

Type choices, press Enter.

Labe+ . . . . . . . . . . . . .
Data area speci9ication(
Data area . . . . . . . . . . ? DTA1 Name, "LDA, "%DA, "PDA
Library . . . . . . . . . . ? PB0101! Name, "L#BL, "CRL#B
1.bstrin' speci9ications(
1.bstrin' startin' position . ? 1 1*)000, "ALL
1.bstrin' +en'th . . . . . . . ? 10 1*)000
CL -ariab+e 9or ret.rne3 -a+.e ? an3BAR1 Character -a+.e
Comment . . . . . . . . . . . .







Bottom
456E2it 476Prompt 486Re9resh 41)6Cance+ 4156$o: to .se this 3isp+ay
4)76&ore ;eys

,n this C' program value from Data Area is Retrieve and store the value in variable var1.
and then this value is passed to the program message 8ueue.
# Du$e%tar Technologies &vt. 'td. 1(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13

Data area Opcodes
0ollo+ing are the data area opcodes.
,-, 9"T and "-'C.. :e +ill see all opcodes one by one.
*+ (#etrieve Data area,
,- opcodes retrieves a data area speci;ed in factor / of calculation speci;cation. This
allo+s you to control the loc$ing or unloc$ing of a data area.
+ote: *% -ou want to use data area opcodes *+. O/$ or /&C0 then -ou 'ust
defne this data area with D"1+ opcode using 2+A3)A# in %actor 1 and na'e o%
data area in result feld.
0ollo+ing is the speci;cation format for the ,- opcode.
1actor1 O!"#A$*O+ 1AC$O# 2 #"S/&$ 4* &O "5
<'9C. ,- Data area
name or
<-A=>AR
b b 2R b
0actor1 entry is optional. ,t can be blan$ or contain the reserve +ord <'9C.. 1actor1
'ust be blan6 i% %actor 2 is na'e o% local data area (2&DA, or progra'
initiali7ation para'eters (!*!, data area. 2'9C. in factor 1 indicates that the data
area cannot be updated or loc$ed by another program until ?i7 an "-'C. operation is
processed, ?ii7 an 9"T operation +ith no factor1 entry is processed or ?iii7 the R&6(1))
program implicitly unloc$s the data area +hen the program ends.
0actor / entry contains the name of data area or the reserve +ord <-A=>AR. 9pcode ,-
+ith <-A=>AR retrieves all the data area de;ned in the program ?%ee program &6=DTA37
@ou can specify resulting indicator in positions AB and AC ?'9 entry7. This indicator +ill set
on if an error has occurred during the operation.
O/$ (/pdate Data area,
The out opcode update the data area speci;ed in factor/.
1actor1 O!"#A$*O+ 1AC$O# 2 #"S/&$ 4* &O "5
<'9C. 9"T Data area
name or
<-A=>AR
b b 2R b
0actor 1 entry is optional. ,t can be blan$ or contain the reserve +ord <'9C.. 0actor 1 must
be blan$ if factor / is name of local data area ?<'DA7 or program initialiDation parameters
?&,&7 data area. <'9C. in factor 1 indicates that data area remains loc$ed after it is
updated. :hen factor1 is blan$, the data area is unloc$ed after it is updated.
0actor / entry contains the name of data area to be updated or the reserve +ord
<-A=>AR. 9pcode 9"T +ith <-A=>AR updates all the data area de;ned in the program.
@ou can specify resulting indicator in positions AB and AC ?'9 entry7. This indicator +ill set
on if an error has occurred during the operation.
# Du$e%tar Technologies &vt. 'td. A(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
/+&C0 (/nloc6 a Data Area or #elease a #ecord,
The "-'C. operation is used for / purpose.
The "-'C. operation unloc$s data areas and allo+s the most recently loc$ed record to be
unloc$ed for an update dis$ ;le.
The follo+ing is the speci;cation format for the ,- opcode.
1actor1 O!"#A$*O+ 1AC$O# 2 #"S/&$ 4* &O "5
b "-'C. Data area
name or 0ile
-ame
b b 2R b
0actor/ must contain the name of the data area to be unloc$ed, the name of an update
dis$ ;le, or the reserve +ord <-A=>AR. 8hen 2+A3)A# is specifed in %actor2 all
data areas in the progra' which are loc6ed. will be unloc6ed.
0actor / must not refer to the local data area of the program initialiDation parameter ?&,&7
data area. ,f factor / contains ;le name then that ;le must be de;ned as an update dis$
;le.
@ou can specify resulting indicator in positions AB and AC ?'9 entry7. This indicator +ill set
on if an error has occurred during the operation.

#!9 !rogra' %or *+ opcode
Co+.mns . . . ( 1 <1 E3it PB01011=&>RP%
1E66? DTARP%1
4&T " ..... ". 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0000.01 C"De9ine Data Area :ith "NA&BAR
0001.00 C "NA&BAR DE4N DTA1 )1
0001.0) C"Retrie-e Data Area :ith #N
000).00 C "L!C0 #N DTA1
0005.00 C &!BE /P.ne/ 4LD1 10
0007.00 C &!BE "BLAN01 4LD) 80
0007.0) C"Concatenate DTA1 -a+.e :ith 4LD1 -a+.e an3 store it in 4LD)
0008.00 C DTA1 CAT 4LD1 4LD)
000A.00 C 4LD) D1PL>
000A.0) C"n+oc; Data Area
000<.00 C NLC0DTA1
000C.00 C 1ET!N LR
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""




456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys

# Du$e%tar Technologies &vt. 'td. B(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
#!9 !rogra' %or O/$ Opcode

Co+.mns . . . ( 1 <1 E3it PB01011=&>RP%
1E66? DTARP%)
4&T " ..... ". 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0001.00 C"De9ine Data Area :ith "NA&BAR
000).00 C "NA&BAR DE4N DTA1 )1
0005.00 C"Retrie-e Data Area :ith #N
0007.00 C "L!C0 #N DTA1
0008.00 C &!BE /PNE/ 4LD1 10
000A.00 C &!BE "BLAN01 4LD) 80
000<.00 C"Concatenate DTA1 -a+.e :ith 4LD1 -a+.e an3 store it in 4LD)
000C.00 C DTA1 CAT 4LD1 4LD)
000,.00 C 4LD) D1PL>
000,.01 "&!BE#N% D$ELL!E T! T$E DATA AREA
000,.05 C &!BEL/$ELL!/ DTA1
000,.07 "PDAT#N% DATA AREA
000,.08 C !T DTA1
000,.0A "D#1PLA>#N% DATA AREA
000,.0< C DTA1 D1PL>
0010.00 C"n+oc; Data AREA
0011.00 C NLC0DTA1
001).00 C 1ET!N LR
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""



456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys

# Du$e%tar Technologies &vt. 'td. C(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
":a'ple o% /se o% Data Area :
,n this eEample +e store the name of the school in the data area. +e retrieve the name of
school from the data area through a cl program ?C'37 .
,n follo+ing eEample, +e display the details of the students. the name of school on display
screen comes from the data area.
0irst +e +ill create a Data Area %C599' and store the name of the school in that.
DDS %or the !h-sical fle (S$/D,:
Co+.mns . . . ( 1 <1 Bro:se PB0101D=&>DD1
1E66? 1TD
4&T A" .....A". 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0001.00 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
000).00 "
0005.00 " 1TDENT &A1TER
0007.00 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
0008.00 R 1TDR
000A.00 R!LL 5 0 C!L$D%(/R!LL N&BER/)
000<.00 NA&E 10 C!L$D%(/NA&E !4 1TDENT/)
000C.00 CLA11 ) 0 C!L$D%(/1TDENT CLA11/)
000,.00 1EC 1 C!L$D%(/CLA11 1ECT#!N/)
0010.00 0 R!LL
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""






456E2it 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e 41)6Cance+
41A6Repeat 9in3 4)76&ore ;eys
(C) C!P>R#%$T #B& C!RP. 1,C1, )00).
Displa- 1ile #ecord (S1,:
!!!!!!!!!! TT(TT(TT
DD=DD=DD
******************************************************************************



NA&E..................( !!!!!!!!!!

R!LL N&BER...........( ,,,*

CLA11.................( ,,*

1ECT#!N...............( !








******************************************************************************
456EF#T
Gor; screen 9or recor3 11( Press $e+p 9or 9.nction ;eys.
DDS %or the Displa- fle (S$/D,:
# Du$e%tar Technologies &vt. 'td. F(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
Co+.mns . . . ( 1 <1 E3it PB0101D=&>1CR
1E66? 1TD#N
4&T A" .....A". 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0000.10 A"HHT1 1D )008051< 15807A PB0101 REL*B8R)&0 8<))*GD1
0000.)0 A"HHEC
0000.50 A D1P1#I()7 C0 "D15)
0000.70 A R 11
0000.80 A"HHT1 1D )008051< 15807A PB0101 REL*B8R)&0 8<))*GD1
0000.A0 A C405(05)
0000.<0 A 1 <)T#&E
0000.C0 A ) <)DATE
0000.,0 A EDTCDE(>)
0001.00 A 1 )1ER
0001.10 A 5 )/**************************
0001.)0 A ***************************
0001.50 A *********/
0001.70 A C!L!R(BL)
0001.80 A )) )/**************************
0001.A0 A ***************************
0001.<0 A *********/
0001.C0 A C!L!R(BL)
0001.,0 A 1CNA&E 10A ! 1 58D1PATR($#)
000).00 A )5 7/456EF#T/
000).10 A C!L!R(BL)
000).)0 A < 8/NA&E..................(/
000).50 A , 8/R!LL N&BER...........(/
000).70 A 11 8/CLA11.................(/
000).80 A 15 8/1ECT#!N...............(/
000).A0 A 1NA&E 10A ! < 57
000).<0 A 1R!LL 51 0B , 57
000).C0 A 1CLA11 )1 0B 11 57
000).,0 A 11EC 1A ! 15 57
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""

456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys

C& !rogra' C&2:
Co+.mns . . . ( 1 <1 E3it PB01011=&>CLP
1E66? C CL5
4&T "" ...@... 1 ...@... ) ...@... 5 ...@... 7 ...@... 8 ...@... A ...@... <
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0001.00 =" PR!%RA& T! PA11 PARA&ETER "=
0001.00 P%& PAR&(JBAR1)
000).00 DCL BAR(JBAR1) T>PE("C$AR) LEN(10)
000).01 DCL BAR(JBAR)) T>PE("C$AR) LEN(10)
0005.00 RTBDTAARA DTAARA(1C$!!L (1 10)) RTNBAR(JBAR))
0007.00 C$%BAR BAR(JBAR1) BALE(JBAR))
0008.00 ENDP%&
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""









456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys
(C) C!P>R#%$T #B& C!RP. 1,C1, )00).
# Du$e%tar Technologies &vt. 'td. G(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Data Area
Day 13
#!9 !rogra' Description:
Co+.mns . . . ( 1 <1 E3it PB01011=&>RP%
1E66? 1C$!!1
4&T 4F .....44i+ename#PEA4........L..#........De-ice@......0E2it@@Entry@A....
""""""""""""""" Be'innin' o9 3ata """""""""""""""""""""""""""""""""""""
0001.00 41TD #4 E 0 D#10
000).00 41TD#N C4 E G!R01TN
0005.00 "
0007.00 C "#N05 D!GEK"!44
0008.00 C 05 LEABE
0008.01 "CALL#N% T$E CL PR!%RA& T! 4EATC$ 1C$!!L NA&E 4R!& DATA AREA
0008.0) "1C$!!L
000A.00 C CALL /CL)/
000<.00 C PAR& 11NA&E 10
000C.00 C &!BEL11NA&E 1CNA&E
000,.00 C "L!BAL 1ETLL1TDR
0010.00 C "#N,0 D!GEK"!44
001).00 C READ 1TD ,0
0015.00 C EF1R P)1
0017.00 C EF4&T11
0017.01 C 05 LEABE
0018.00 C ENDD!
001A.00 C ENDD!
001<.00 C 1ET!N LR
001C.00 "
001,.00 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
00)0.00 C P)1 BE%1R
00)1.00 C &!BELNA&E 1NA&E
00)1.01 C I*ADDR!LL 1R!LL
00)1.0) C I*ADDCLA11 1CLA11
00)).00 C &!BEL1EC 11EC
00)5.00 C END1R
"""""""""""""""""" En3 o9 3ata """"""""""""""""""""""""""""""""""""""""


456E2it 476Prompt 486Re9resh 4,6Retrie-e 4106C.rsor 4116To''+e
41A6Repeat 9in3 41<6Repeat chan'e 4)76&ore ;eys

# Du$e%tar Technologies &vt. 'td.
1)(1)
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.

Potrebbero piacerti anche