Sei sulla pagina 1di 48

COBOL FAQs This COBOL FAQs was taken from http://www.cobug.com/cobug/ ocs/cobo!"nter#iewQuestions$$%&.htm!

1. What is a reentrant program? How will you make a program Reentrant? Ans: A reentrant program, while being executed resides in the common irtual area so that one copy o! it may be shared among all callers. "se R#$% compiler option. &. What is the di!!erence between a '1 le el and (( le el? Ans: '1 le el can ha e suble els !rom '& to )*. (( cannot ha e suble el. +. What are the !ew ad antages o! ,- ./0/1 22 o er /-3,- ./0/1? Ans:%he working storage and linkage section limit has been increased. %hey are 1&4 megabytes as supposed to 1 megabytes in /-3,- ./0/1. 2ntroduction o! A55R#-- special register. +16bit addressing. 2n using ./0/1 on 7. we ha e only !lat !iles and the programs can access only limited storage, whereas in ,- ./0/1 22 on 839 the programs can access up to 1:80 or &;0 depending on the addressing and can use ,-A8 !iles to make 23/ operations !aster. ). What are the steps you go through while creating a ./0/1 program executable? Ans: 50& pre6compiler <i! embedded -=1 is used>, .2.- translator <i! .2.- program>, .obol compiler, 1ink editor. 2! 50& program, create plan by binding the 50R8s. ?. What are the minimum re@uirements to compile a program without errors? Ans: 2denti!ication 5i ision. 7rogram625. 7rogram6name. A> 2s compute wAu a alid statement? Bes, it is. 2t is e@ui alent to mo e u to w. 0> 2n the abo e example, when will you pre!er compute statement o er the mo e statement? When signi!icant le!t6order digits would be lost in execution, the ./87"%# statement can detect the condition and allow you to handle it. %he 8/,# statement carries out the assignment with destructi e truncation. %here!ore, i! the siCe error is needs to be detected, ./87"%# will be pre!erred o er 8/,#. %he /$ -2D# #RR/R phrase o! ./87"%# statement, compiler generates code to detect siCe6o er!low. :. What happens when the /$ -2D# #RR/R phrase is speci!ied on a ./87"%# statement? Ans:2! the condition occurs, the code in the /$ -2D# #RR/R phrase is per!ormed, and the content o! the destination !ield remains unchanged. 2! the /$ -2D# #RR/R phrase is not speci!ied, the assignment is carried out with truncation. %here is no /$ -2D# #RR/R support !or the 8/,# statement.

(. How will you associate your !iles with external data sets where they physically reside? Ans:"sing -#1#.% clause, the !iles can be associated with external data sets. %he -#1#.% clause is de!ined in the 921#6./$%R/1 paragraph o! 2nput6/utput -ection that is coded #n ironment 5i ision. %he 9ile structure is de!ined by 95 entry under 9ile6-ection o! 5ata 5i ision !or the /-. 4. How will you de!ine your !ile to the operating s'stem? Ans:Associate the !ile with the external data set using -#1#.% clause o! 2$7"%6/"%7"% -#.%2/$. 2$7"%6/"%7"% -#.%2/$ appears inside the #$,2R/$8#$% 52,2-2/$. 5e!ine your !ile structure in the 921# -#.%2/$ o! 5A%A 52,2-2/$. *. #xplain the use o! 5eclarati es in ./0/1? Ans:5eclarati es pro ide special section that are executed when an exceptional condition occurs. %hey must be grouped together and coded at the beginning o! procedure di ision and the entire procedure di ision must be di ided into sections. %he 5eclarati es start with a "-# statement. %he entire group o! declarati es is preceded by 5#.1AR2,#- and !ollowed by #$5 5#.1AR2%2,#- in area A. %he three types o! declarati es are #xception <when error occurs during !ile handling>, 5ebugging <to debug lines with E5E coded in w6s section> and 1abel <!or #/9 or beginning...> declarati es. 1'. A statically bound subprogram is called twice. What happens to working6storage ariables? Ans:%he working6storage section is allocated at the start o! the run6unit and any data items with ,A1"# clauses are initialiCed to the appropriate alue at the time. When the subprogram is called the second time, a working6storage items persist in their last used state. Howe er, i! the program is speci!ied with 2$2%2A1 on the 7R/;RA8625, working6storage section is reinitialiCed each time the program is entered. 7R/;RA8625. is 2$2%2A1 7R/;RA8. /ther erbs used with 7R/;RA8625 are R#."R-2,# and ./88/$. 11. When is ./88/$ attribute used? Ans:./88/$ attribute is used with nested ./0/1 programs. 2! it is not speci!ied, other nested programs will not be able to access the program. 7R/;RA8625. 7gmname is ./88/$ 7R/;RA8. 1&. 2n which di ision and section, the -pecial6names paragraph appears? Ans: #n ironment di ision and .on!iguration -ection. 1+. What is the 1/.A16-%/RA;# -#.%2/$? Ans:1ocal6-torage is allocated each time the program is called and is de6allocated when the program returns ia an #F2% 7R/;RA8, ;/0A.G, or -%/7 R"$. Any data items with a ,A1"# clauses are initialiCed to the appropriate alue each time the program is called. %he alue in the data items is lost when the program returns. 2t is de!ined in the 5A%A 52,2-2/$ a!ter W/RG2$;6-%/RA;# -#.%2/$

1). What does passing 0B R#9#R#$.# mean? Ans:When the data is passed between programs, the subprogram re!ers to and processes the data items in the calling programEs storage, rather than working on a copy o! the data. When .A11 . . . 0B R#9#R#$.# identi!ier. 2n this case, the caller and the called share the same memory. 1?. What does passing 0B ./$%#$% mean? Ans:%he calling program passes only the contents o! the literal, or identi!ier. With a .A11 . . . 0B ./$%#$%, the called program cannot change the alue o! the literal or identi!ier in the calling program, e en i! it modi!ies the ariable in which it recei ed the literal or identi!ier. 1:. What does passing 0B ,A1"# mean? Ans:%he calling program or method is passing the alue o! the literal, or identi!ier, not a re!erence to the sending data item. %he called program or in oked method can change the parameter in the called program or in oked method. Howe er, because the subprogram or method has access only to a temporary copy o! the sending data item, those changes do not a!!ect the argument in the calling program. "se 0y alue, 2! you want to pass data to . program. 7arameters must be o! certain data type. 1(. What is the de!ault, passing 0B R#9#R#$.# or passing 0B ./$%#$% or passing 0B ,A1"#? Ans: 7assing by re!erence <the caller and the called share the same memory>. 14. Where do you de!ine your data in a program i! the data is passed to the program !rom a .aller program? Ans: 1inkage -ection 1*. 5e!ine the structure o! a ./0/1 subroutine. Ans:%he 7R/.#5"R# 52,2-2/$ header must ha e a using a phrase, i! the data needs to be passed to the program. %he operands o! the "-2$; phrase must be de!ined in the 12$GA;# -#.%2/$ as '16le el or ((6le el entries. $o ,A1"# clause is allowed unless the data de!ined is a condition name. 2! the program needs to be returned to the .A11#R, use #F2% 7R/;RA8 statement at the end o! the program. ;/0A.G is an alternati e, but is nonstandard. &'. What is di!!erence between next sentence and continue Ans:$#F% -#$%#$.# gi es control to the erb !ollowing the next period. ./$%2$"# gi es control to the next erb a!ter the explicit scope terminator. <%his is not one o! ./0/1 22Es !iner implementations>. 2tEs sa!est to use ./$%2$"# rather than $#F% -#$%#$.# in ./0/1 22. ./$%2$"# is like a null statement <do nothing> , while $#F% -#$%#$.# trans!ers control to the next sentence <HH> <A sentence is terminated by a period>. .heck out by writing the !ollowing code example, one i! sentence !ollowed by + display statements: 2! 1 I ' then next sentence end i! display Eline 1E display Eline &E. display Eline +E. JJJ $ote6 there is a dot <.> only at the end o! the last & statements, see the e!!ect by replacing $ext -entence with .ontinue JJJ

&1. What is the di!!erence between -tructured .obol 7rogramming and /bKect /riented ./0/1 programming? Ans:-tructured programming is a 1ogical way o! programming using which you di ide the !unctionalityEs into modules and code logically. //7 is a $atural way o! programming in which you identi!y the obKects, !irst then write !unctions and procedures around the obKects. -orry, this may not be an ade@uate answer, but they are two di!!erent programming paradigms, which is di!!icult to put in a sentence or two. &&. 72. -*<)>./87 2- "-#5 2$7-72%# /9 ./876+ WH2.H /.."72#- 1#-- -7A.#.WHB? Ans:-*<)> ./87 uses only & bytes. *<)> ./876+ uses + bytes. + bytes are more than & bytes. Hence ./87 is pre!erred o er ./876+ in this case. &+. How many number o! bytes and digits are in ol ed in -*<1'> ./87? 4 bytes <double word> and 1' digits. "p to *<*> comp use !ull word, up to *<14> comp needs double word. &). Which picture clause will you use to de!ine a hexadecimal item in a ,A1"# clause? Ans: '1 ws6hexitem 72. F<&> alue FE'&'.E. '1 ws6hex rede!ines 72. -*<+> comp6+. &?. How many numbers o! decimal digits are possible, when the amount o! storage allocated !or a "-A;# ./87 item is a> hal! word b> !ull word c> double word? Ans: & bytes <hal!word> !or 16) 5igits ) bytes <!ullword> !or ?6* 4 bytes <doubleword> !or 1'614 &:. What is a scope terminator? ;i e examples. -cope terminator is used to mark the end o! a erb e.g. #,A1"A%#, #$56#,A1"A%#L 29, #$56 29. &(. How many dimensions are allowed !or a table? Ans: ( &4. How many subscripts or indexes are allowed !or an /.."R- clause? Ans: ( &*. Why cannot /ccurs be used in '1 le el? Ans: 0ecause, /ccurs clause is there to repeat !ields with the same !ormat, but not the records. +'. .an a R#5#92$#- clause be used along with an /.."R- clause?

Ans: Bes, i! the R#5#92$#- clause is subordinate to /.."R- clause. +1. .an you speci!y 72. clause and a ,A1"# with an /.."R- clause? Will the !ollowing code compile without errors? '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# -7A.#-. Ans: Bes, the code will compile without any errors. +&. What would be the output, when the !ollowing code is executed? '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# EAAAAAE. Ans:2t cannot be executed because the code will compile with error E M,A1"#M literal MEAAAAEM exceeded the length speci!ied in the M72.%"R#M de!initionE. ++. '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# EAE. '+ W-6#F R#5#92$#- W-6%A01#6#1 72. F<?>. What can you expect? Ans: .ompile error. 5irect Rede!inition o! /.."R- clause is not allowed. +). '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#-. ') 9211#R6F 72. F<1> ,A1"# EAE. ') W-6#F R#5#92$#- 9211#R6F 72. F<1>. What would be the output o! 52-71AB W-6%A01#? Ans: EAAAAAE. %he code will compile and execute as Rede!inition o! an item subordinate to /.."R- clause. +?. 2s this allowed? '1 W-6%A01#. '+ 9211#R6F 72. F<?> ,A1"# EAAAAAE. '+ W-6#F R#5#92$#- 9211#R6F. ') W-6%A01#6#1 /.."R- ? %28#- 72. F<1>. Ans: Bes

+?. 2s this allowed? '1 W-6%A01#. '+ 9211#R6F 72. F<?> ,A1"# EAAAAAE. '+ W-6#F R#5#92$#- 9211#R6F /.."R- ? %28#- 72. F<1>. Ans: Bes +:. Which -#AR.H erb is e@ui alent to 7#R9/R8...,ARB2$;? %he serial -#AR.H erb <-#AR.H without A11> +(. What would be the output, when the !ollowing code is executed? '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# EAE. ::: 52-71AB W-6%A01#. Ans: %he output will display EAAAAAE +4. .an a -#AR.H be applied to a table which does not ha e an 2$5#F de!ined? Ans: $o, the table must be indexed. +*. What are the di!!erent rules applicable to per!orm a serial -#AR.H? Ans: %he -#AR.H can be applied to only a table which has the /.."R- clause and 2$5#F#5 0B phrase, 0e!ore the use o! the -#AR.H the index must ha e some initial alue. %o search !rom beginning, set the index alue to 1. "se the -#AR.H erb without A11 phrase )'. A table has two indexes de!ined. Which one will be used by the -#AR.H erb? Ans: %he index named !irst will be used, by -earch. )1. What are the di!!erent rules applicable to per!orm a binary -#AR.H? Ans:%he table must be sorted in ascending or descending order be!ore the beginning o! the -#AR.H. "se /.."R- clause with A-.35#-. G#B 2- dataname1 option %he table must be indexed. %here is no need to set the index alue. "se -#AR.H A11 erb )&. How does the binary search work?

Ans:9irst the table is split into two hal es and in which hal!, the item need to be searched is determined. %he hal! to which the desired item may belong is again di ided into two hal es and the pre ious procedure is !ollowed. %his continues until the item is !ound. -#AR.H A11 is e!!icient !or tables larger than (' items. )+. What is the di!!erence between a binary search and a se@uential search? What are the pertinent ./0/1 commands? Ans:2n a binary search the table element key alues must be in ascending or descending se@uence. %he table is Ehal edE to search !or e@ual to, greater than or less than conditions until the element is !ound. 2n a se@uential search the table is searched !rom top to bottom, so <ironically> the elements do not ha e to be in a speci!ic se@uence. %he binary search is much !aster !or larger tables, While se@uential -earch works well with smaller ones. -#AR.H A11 is used !or binary searchesL -#AR.H !or se@uential. )). #xplain the di!!erence between an internal and an external sort. %he pros N cons N internal sort syntax ... Ans:An external sort is not coded as a ./0/1 programL it is per!ormed through O.1 and 7;8A-/R%. /ne can use 208 utility -B$.-/R% !or external sort process. 2t is understandable without any code re!erence. An internal sort can use two di!!erent syntaxes: 1.> "-2$;, ;2,2$; sorts are comparable to external sorts with no extra !ile processingL &> 2$7"% 7R/.#5"R#, /"%7"% 7R/.#5"R# sorts allow !or data manipulation be!ore and3or a!ter the sort. -yntax: -/R% !ile61 /$ A-.#$52$;35#-.#$52$; G#B key..."-2$; !ile6& ;2,2$; !ile6+. "-2$; can be substituted by 2$7"% 7R/.#5"R# 2- para61 %HR" para6& ;2,2$; can be substituted by /"%7"% 7R/.#5"R# 2- para61 %HR" para6&. !ile61 is the sort work!ile and must be described using -5 entry in 921# -#.%2/$. !ile6& is the input !ile !or the -/R% and must be described using an 95 entry in 921# -#.%2/$ and -#1#.% clause in 921# ./$%R/1. !ile6+ is the out!ile !rom the -/R% and must be described using an 95 entry in 921# -#.%2/$ and -#1#.% clause in 921# ./$%R/1. !ile61, !ile6& N !ile6+ should not be opened explicitly. 2$7"% 7R/.#5"R# is executed be!ore the sort and records must be R#1#A-#d to the sort work !ile !rom the input procedure. /"%7"% 7R/.#5"R# is executed a!ter all records ha e been sorted. Records !rom the sort work !ile must be R#%"R$ed one at a time to the output procedure. .How do you de!ine a sort !ile in O.1 that runs the ./0/1 program? "se the -/R%WG'1, -/R%WG'&,..... dd names in the step. $umber o! sort datasets depends on the olume o! data being sorted, but a minimum o! + is re@uired. )?. Which is the de!ault, %#-% 0#9/R# or %#-% A9%#R !or a 7#R9/R8 statement? %#-% 0#9/R#. 0y de!ault the condition is checked be!ore executing the instructions under 7er!orm. ):. What is the di!!erence between 7#R9/R8 ... W2%H %#-% A9%#R and 7#R9/R8 ... W2%H %#-% 0#9/R#? Ans:2! %#-% 0#9/R# is speci!ied, the condition is tested at the beginning o! each repeated execution o! the speci!ied 7#R9/R8 range. 2! %#-% A9%#R is speci!ied, the condition is tested at the end o! the each repeated execution o! the 7#R9/R8 range. With %#-% A9%#R, the range is executed at least once. )(. How do you code an in6line 7#R9/R8? Ans: 7#R9/R8 ... ... #$567#R9/R8.

)4. 2n an #,A1"%# statement is the order o! the WH#$ clauses signi!icant? Bes. # aluation o! the WH#$ clauses proceeds !rom top to bottom and their se@uence can determine results. )*. What is the de!ault alue<s> !or an 2$2%2A12D# and what keyword allows !or an o erride o! the de!ault. Ans:2$2%2A12D# sets spaces to alphabetic and alphanumeric !ields. 2nitialiCe sets Deroes to numeric !ields. 9211#R, /.."R- 5#7#$52$; /$ items are le!t untouched. %he R#71A.2$; option can be used to o erride these de!aults. ?'. What is -#% %/ %R"# all about, anyway? Ans:2n ./0/1 22 the 44 le els can be set rather than mo ing their associated alues to the related data item. <Web note: %his change is not one o! ./0/1 22Es better speci!ications.> COBOL FAQs (( )art "" 1. What is 1#$;%H in ./0/1 22? Ans: 1#$;%H acts like a special register to tell the length o! a group or an elementary item. &. What is the !unction o! a delimiter in -%R2$;? Ans: A delimiter in -%R2$; causes a sending !ield to be ended and another to be started. +. What is the !unction o! a delimiter in "$-%R2$;? Ans: A delimiter when encountered in the sending !ield causes the current recei ing !ield to be switched to the next one indicated. ). How will you count the number o! characters in a null6terminated string? Ans: 8/,# ' %/ char6count 2$-7#.% null6terminated6string %A11B2$; char6count 9/R .HARA.%#R- 0#9/R# FM''M ?. Which statement will you use to mo e non6null characters !rom a null6terminated -tring? Ans: "$-%R2$; null6terminated6string 5#1282%#5 0B FM''M 2$%/ target6area ./"$% 2$ char6count. <%here are other methods, such as 1> using 7#R9/R8 &> using -#AR.H +> using 2$-7#.% and 8/,# etc...> :. (( ./"$%R 72. * ,A1"# D#R/. '1 5A%A6& 72. F<11>. . . 2$-7#.% 5A%A6&

%A11B2$; ./"$%R 9/R 1#A52$; M'M R#71A.2$; 92R-% MAM 0B M&M A9%#R 2$2%2A1 M.M 2! 5A%A6& is ''''A1A0A8A, what will 5A%A6& and ./"$%#R be a!ter the execution o! 2$-7#.% erb? Ans: .ounterA). 5ata6& will not change as the 2nitial E.E is not !ound. (. '1 5A%A6) 72. F<11>. ::: 2$-7#.% 5A%A6) ./$,#R%2$; Mabcde!ghiKklmnop@rstu wxyCM %/ MA0.5#9;H2OG18$/7=R-%",WFBDM A9%#R 2$2%2A1 M3M 0#9/R# 2$2%2A1M?M What will the contents o! 5A%A6) be a!ter the con ersion statement is per!ormed, i! be!ore con ersion a> 5A%A6) A a3!i e3?six b> 5A%A6) A r3Rexx3RRRr c> 5A%A6) A C!our?inspe Ans: a> a392,#3?six b> r3R#FF3RRRR c> C!our?inspe <no change at all> 4. What kind o! error is trapped by /$ -2D# #RR/R option? Ans: 9ixed6point o er!low. Dero raised to the Cero power. 5i ision by '. Dero raised to a negati e number. A negati e number raised to a !ractional power. *. What is the point o! the R#71A.2$; option o! a copy statement? Ans: R#71A.2$; allows !or the same copy to be used more than once in the same code by changing the replace alue. ./7B xxx R#71A.2$; 0B . 1'. When is a scope terminator mandatory? Ans: -cope terminators are mandatory !or in6line 7#R9/R8- and #,A1"A%# statements. 9or readability, itEs recommended coding practice to always make scope terminators explicit. 11. .an you use R#5#92$#- clause in the 921# -#.%2/$? Ans: $o 1&. How will you de!ine your record descriptions in the 921# -#.%2/$ i! you want to use three di!!erent record descriptions !or the same !ile?

Ans: 95 !ilename 5A%A R#./R5- AR# rd'1, rd'&, rd'+. '1 rd'1 72. F<n>. '1 rd'& 72. F<n>. '1 rd'+ 72. F<n>. 1+. When will you open a !ile in the #F%#$5 mode? Ans:When an existing !ile should be appended by adding new records at its end. #F%#$5 mode opens the !ile !or output, but the !ile is positioned !ollowing the last record on the existing !ile. 1). What does a .1/-# W2%H 1/.G statement do? Ans: %he statement closes an opened !ile and it pre ents the !ile !rom !urther being opened by the same program. 1?. Which mode o! opening is re@uired when R#WR2%# is used? Ans: 26/ mode 1:. Why is it necessary that the !ile be opened in 26/ mode !or R#WR2%#? Ans:0e!ore the R#WR2%# is per!ormed, the record must be read !rom the !ile. Hence R#WR2%# includes an input operation and an output operation. %here!ore, the !ile must be opened in 26/ mode. 1(. Which clause can be used instead o! checking !or 921# -%A%"- A 1'? Ans: 921# -%A%"- 1' is the end o! !ile condition. Hence A% #$5 clause can be used. 14. What is the !ormat o! a simple -/R% erb? What kinds o! !iles can be sorted using -/R%? Ans: -/R% work!ile /$ A-.35#-. G#B key1, A-.35#-. G#B key& ... "-2$; input!ile ;2,2$; output!ile /nly se@uential !iles can be sorted in this way. 1*. What are the di!!erent rules o! -/R% that needs to be considered? Ans:%he input and output !iles must remain closed because -/R% opens them and closes during the operation, %he work !ile must ha e a -#1#.% clause. %he work !ile must ha e sort description -5 entry in the 921# -#.%2/$. 2nput and /utput !iles must ha e 95 entries &'. What are 2$7"% 7R/.#5"R# and /"%7"% 7R/.#5"R#?

Ans: -ometimes, it is necessary that the records must be edited be!ore or a!ter the sorting. 2n such cases, -/R% work!ile A-.35#-. G#B key1, ... 2$7"% 7R/.#5"R# 2- ipproc /"%7"% 7R/.#5"R# is outproc 2s used. 2n the 2$7"% 7R/.#5"R# the input !ile is opened, records are read and edited and then are released to the sorting operation. 9inally the !ile is closed. R#1#A-# sortrecname 9R/8 inp6rec. 2n the /"%7"% 7R/.#5"R#, output !ile is opened, the sorted record is returned to the /utput record area and then the record is written. 9inally the !ile is closed. R#%"R$ work!ile R#./R5 into out6rec. &1. What is the !ormat o! a simple 8#R;# erb? .an 2$7"% 7R/.#5"R# and /"%7"% 7R/.#5"R# can be speci!ied !or 8#R;# erb? Ans: 8#R;# work !ile /$ A-.35#-. G#B key1... "-2$; input!ile1, input!ile&... ;2,2$; output!ile 2$7"% 7R/.#5"R# cannot be speci!ied. /nly /"%7"% 7R/.#5"R# can be speci!ied &&. How will you position an indexed !ile at a speci!ic point so that the subse@uent se@uential operations on the !ile can start !rom this point? Ans: "se -%AR% -%AR% !ilename G#B 2- #=3;%31%.. dataname 2$,A125 G#B ... &+. What are the access mode re@uirements o! -%AR% statement? Ans: Access mode must be -#="#$%2A1 or 5B$A82. &). What are the opening mode re@uirements o! -%AR% statement? 9iles must be opened in the 2$7"% or 26/ mode. &?.What is the 12$GA;# -#.%2/$ used !or? Ans:%he linkage section is used to pass data !rom one program to another program or to pass data !rom a 7R/. to a program. 2t is part o! a called program that ElinksE or maps to data items in the calling programEs working storage. 2t is the part o! the called program where these share items are de!ined.

&:. 2! you were passing a table ia linkage, which is pre!erable 6 a subscript or an index? Ans:Wake up 6 you ha enEt been paying attentionH 2tEs not possible to pass an index ia linkage. %he index is not part o! the calling programs working storage. 2ndexing uses binary displacement. -ubscripts use the alue o! the occurrence. &(. What is the di!!erence between a subscript and an index in a table de!inition? A subscript is a working storage data de!inition item, typically a 72. <***> where a alue must be mo ed to the subscript and then increment or decrement it by A55 %/ and -"0%RA.% 9R/8 statements. An index is a register item that exists outside the programEs working storage. Bou -#% an index to a alue and -#% it "7 0B alue and 5/W$ 0B alue. -ubscript re!ers to the array occurrence while index is the displacement <in no o! bytes> !rom the beginning o! the array. An index can only be modi!ied using 7#R9/R8, -#AR.H N -#%. $eed to ha e index !or a table in order to use -#AR.H, -#AR.H A11 .obol statements. &4. What is an in line 7#R9/R8? When would you use it? Anything else to say about it? %he 7#R9/R8 and #$567#R9/R8 statements bracket all ./0/1 22 statements between them. %he ./0/1 e@ui alent is to 7#R9/R8 or 7#R9/R8 %HR" a paragraph. 2n line 7#R9/R8s work as long as there are no internal ;/ %/s, not e en to an exit. %he in line 7#R9/R8 !or readability should not exceed a page length 6 o!ten it will re!erence other 7#R9/R8 paragraphs. When the body o! the 7er!orm will not be used in other paragraphs. 2! the body o! the 7er!orm is a generic type o! code <used !rom arious other places in the program>, it would be better to put the code in a separate para and use 7#R9/R8 paraname rather than in6 line per!orm. &*. What is the use o! #,A1"A%# statement? How do you come out o! an #,A1"A%# statement? Ans:# aluate is like a case statement and can be used to replace nested 2!s. %he di!!erence between #,A1"A%# and case is that no EbreakE is re@uired !or #,A1"A%# i.e. control comes out o! the #,A1"A%# as soon as one match is made, %here is no need o! any extra code. #,A1"A%# can be used in place o! the nested 29 %H#$ #1-# statements. +'. What are the di!!erent !orms o! #,A1"A%# statement? Ans: #,A1"A%# #,A1"A%# -=1./5# A1-/ 921#6-%A%"WH#$ AA0 A$5 .A5 WH#$ 1'' A1-/ E''E 2mperati e stmt imperati e stmt WH#$ <5PF>3B A ) WH#$ 6+'? A1-/ E+&E imperati e stmt imperati e stmt WH#$ /%H#R WH#$ /%H#R imperati e stmt imperati e stmt #$56#,A1"A%# #$56#,A1"A%#

#,A1"A%# -=1./5# A1-/ AA0 #,A1"A%# -=1./5# A1-/ %R"# WH#$ 1'' A1-/ %R"# WH#$ 1'' A1-/ AA0 imperati e stmt imperati e stmt WH#$ 6+'? A1-/ 9A1-# WH#$ 6+'? A1-/ <A3.A)> imperati e stmt imperati e stmt #$56#,A1"A%# #$56#,A1"A%# +1. .an you use the 2$-7#.% <with %A11B2$; option> .obol erb in a .2.- ./0/1 program? Ans: Bes, under ./0/1 22 en ironment, but not /-3,- ./0/1. +&. What is an explicit scope terminator? A scope terminator brackets its preceding erb, eg. 29 .. #$5629, so that all statements between the erb and its scope terminator are grouped together. /ther common ./0/1 22 erbs are R#A5, 7#R9/R8, #,A1"A%#, -#AR.H and -%R2$;. ++. What is the signi!icance o! Eabo e the lineE and Ebelow the lineE? Ans:0e!ore 208 introduced 8,-3FA architecture in the 1*4'Es a programEs irtual storage was limited to 1: megs. 7rograms compiled with a &)6bit mode can only address 1: 80 o! space, as though they were kept under an imaginary storage line. With ./0/1 22 a program compiled with a +1 bit mode can be Eabo e the 1: 8b line. <%his Ebelow the lineE, Eabo e the lineE imagery con!uses most main!rame programmers, who tend to be a literal minded group.> +). What was remo ed !rom ./0/1 in the ./0/1 22 implementation? Ans:7artial list: R#8ARG-, $/82$A1 G#B, 7A;#6./"$%#R, ."RR#$%65AB, %28#6/965AB, -%A%#, 91/W, ./"$%, #FA82$#, #FH202%, R#A5B %RA.# and R#-#% %RA.#. +?. #xplain call by context by comparing it to other calls. Ans:%he parameters passed in a call by context are protected !rom modi!ication by the called program. 2n a normal call they are able to be modi!ied. +:. What is the di!!erence between comp and comp6+ usage? #xplain other ./0/1 usages. .omp is a binary usage, while comp6+ indicates packed decimal. %he other common usages are binary and display. 5isplay is the de!ault. .omp is de!ined as the !astest3pre!erred numeric data type !or the machine it runs on. 208 8ain!rames are typically binary and A-)''Es are packed.E +(. 2 understand the possible causes !or -'.1 N -'.) abends, but what are they really? Ans:A -'.1 occurs i! the .7" attempts to execute binary code that isnEt a alid machine instructionL e.g. i! you attempt to execute data. A -'.) is a memory protection iolation. %his occurs i! a program attempts to access storage beyond the areas assigned to it. +4. What happens when we mo e a comp6+ !ield to an edited < say C<*>.CC6>

Ans:%he editing characters are to be used with data items with usage clause as display, which is the de!ault. When you try displaying a data item with usage as computational it does not gi e the desired display !ormat because the data item is stored as packed decimal. -o i! u want this particular data item to be edited u ha e to mo e it into a data item whose usage is display and then ha e that particular data item edited in the !ormat desired. +*. What are the causes !or -'.1, -'.), -'.?, -'.(, -'.0 abends Ans:-'.1 6 8ay be due to 1.8issing or misspelled 55 name &.Read3Write to unopened dataset +.Read to dataset opened output ).Write to dataset opened input ?..alled subprogram not !ound. -'.) may be due to 1.8issing -elect statement<during compile> &.0ad -ubscript3index +.7rotection #xception ).8issing parameters on called subprogram ?.Read3Write to unopened !ile :.8o e data !rom3to unopened !ile. -'.? 8ay be due to 1.0ad -ubscript3index &..lose an unopen dataset +.0ad exit !rom a per!orm ).Access to 23/ area<95> be!ore read. -'.( may be due to 1.$umeric operation on non6numeric data &."n6initialiCe working6storage +..oding past the maximum allowed sub script. -'.0 may be due to 1.5i ision by Dero )'. What will happen i! you code ;/ 0A.G instead o! -%/7 R"$ in a stand6alone ./0/1 program i.e. a program which is not calling any other program. Ans: 0oth gi e the same results when a program is not calling any other program. )1. What is the di!!erence between an #xternal and a ;lobal ,ariable Es? Ans:;lobal ariables are accessible only to the batch program whereas external ariables can be re!erenced !rom any batch program residing in the same system library. )&. WHA% 2- R#7/R%62%#8? Ans: A R#7/R%6item is a !ield to be printed that contains #52% -B80/1)+. Bou are writing report program with ) le els o! totals:city,state,region and country. %he codes being used can be the same o er the di!!erent le els, meaning a city code o! '1 can be in any number o! states, and the same applies to state and region code show. 5o you do your checking !or breaks and how do you do add to each le el? Ans:Always compare on the highest6le el !irst, because i! you ha e a break at a highest le el, each le el beneath it must also break. Add to the lowest le el !or each rec but add to the higher le el only on break. )). What is 7-0 N A.0? Ans:7-0 : 7rogram speci!ication block. 2n!orm about how a speci!ic program is to be access one or more 28- 50. 2t consists o! 7.0<7rg .ommunication 0lock>. 2n!ormation to which segment in 50 can be accessed, what the program is allowed to do with those segment and how the 50 is to be accessed. A.0 : Access .ontrol 0locks are generated by 28- as an expansion o! in!ormation contained in the 7-0 in order to speed up the access to the applicable 505Es. )?. WhatEs a 15-<1inear 5ata -et> and whatEs it used !or ?

Ans:15- is a ,-A8 dataset in name only. 2t has unstructured )k <)'*: bytes> !ixed siCe .2s which do not contain control !ields and there!ore !rom ,-A8Es standpoint they do not contain any logical records. %here is no !reespace, and no access !rom .obol. .an be accessed by 50& and 28- !ast path datasets. 15- is essentially a table o! data maintained on disk. %he Etable entriesE must be created ia a user program and can only be logically accessed ia a user program. When passed, the entire 15- must be mapped into storage, then data is accessed ia base and displacement type processing. ):. What is the 2mportance o! ;1/0A1 clause According to new standards o! ./0/1 Ans:When any data name, !ile6name , Record6name, condition name or 2ndex de!ined in an 2ncluding 7rogram can be re!erenced by a directly or indirectly in an included program, 7ro ided the said name has been declared to be a global name by ;1/0A1 9ormat o! ;lobal .lause is'1 data61 72. *<?> 2- ;1/0A1. )(. What is the 7urpose o! 7/2$%#R 7hrase in -%R2$; command Ans:%he 7urpose o! 7/2$%#R phrase is to speci!y the le!tmost position within recei ing !ield where the !irst trans!erred character will be stored )4.How do we get currentdate !rom system with century? Ans: 0y using 2ntrinsic !unction, 9"$.%2/$ ."RR#$%65A%# )*.what is the di!!erence between search and search all in the table handling? Ans: -earch is a linear search and search all is a binary search. ?'.What is the maximum length o! a !ield you can de!ine using ./876+? Ans: 1' 0ytes <-*<14> ./876+>. COBOL FAQs (( )art """

1.How many -ections are there in 5ata 5i ision?. Ans: -2F -#.%2/$- 1.E921# -#.%2/$E &.EW/RG2$;6-%/RA;# -#.%2/$E +.E1/.A16 -%/RA;# -#.%2/$E ).E-.R##$ -#.%2/$E ?.ER#7/R% -#.%2/$E :.E12$GA;# -#.%2/$E 2n ./0/1 22, there are only ) sections. 1.E921# -#.%2/$E &.EW/RG2$;6-%/RA;# -#.%2/$E +.E1/.A16-%/RA;# -#.%2/$E ).E12$GA;# -#.%2/$E. &.How can 2 tell i! a module is being called 5B$A82.A11B or -%A%2.A11B? Ans:%he /$1B way is to look at the output o! the linkage editor <2#W1>or the load module itsel!. 2! the module is being called 5B$A82.A11B then it will not exist in the main module, i! it is being called -%A%2.A11B then it will be seen in the load module. .alling a working storage ariable, containing a program name, does not make a 5B$A82. call. %his type o! calling is known as 28712.2%# calling as the name o! the module is implied by the contents o! the working storage ariable. .alling a program name literal <.A11>.

+.What is the di!!erence between a 5B$A82. and -%A%2. call in ./0/1. Ans:%o correct an earlier answer:All called modules cannot run standalone i! they re@uire program ariables passed to them ia the 12$GA;# section. 5B$A82.ally called modules are those that are not bound with the calling program at link edit time <2#W1 !or 208> and so are loaded !rom the program library <Koblib or steplib> associated with the Kob. 9or 5B$A82. calling o! a module the 5B$A8 compiler option must be chosen, else the linkage editor will not generate an executable as it will expect null address resolution o! all called modules. A -%A%2.ally called module is one that is bound with the calling module at link edit, and there!ore becomes part o! the executable load module. ).What is the di!!erence between 72. *.** and * **? Ans:72. *.** is a 9/"R67/-2%2/$ !ield that actually contains a decimal point where as 72. * ** is %HR##67/-2%2/$ numeric !ield with implied or assumed decimal position. ?.How is 72. *.** is di!!erent !rom 72. * **? Ans:72. *.** is a !our position !ield that actually contains a decimal point where as * ** is a three position numeric !ield with an implied or assumed decimal point. :.what is 7ic * ** 2ndicates? Ans:72.%"R# * ** is a three position $umeric !ield with an implied or assumed decimal point a!ter the !irst positionL the means an implied decimal point. (.what guidelines should be !ollowed to write a structured ./0/1 program? Ans:1> "se E#,A1"A%#E stmt !or constructing cases. &> "se scope terminators !or nesting. +>"se in6line 7er!orm stmt !or writing Edo E constructions. )> "se %est 0e!ore and test a!ter in the 7er!orm stmt !or writing 5o6While constructions. 4.Read the !ollowing code. '1 ws6n 72. *<&> alue Cero. a6para. mo e ? to ws6n. per!orm b6para ws6n times. b6para. mo e 1' to ws6n. How many times will b6para be executed ? Ans: ? %imes only. it will not take the alue 1' that is initialiCed in the loop. *.What are some examples o! command terminators?

Ans: #$5629, #$56#,A1"A%# 1'.What care has to be taken to !orce program to execute abo e 1: 8eg line? Ans:8ake sure that link option is A8/5#A+1 and R8/5#AA$B. .ompile option should ne er ha e -2D#<8AF>.0"9-2D# can be &G, e!!icient enough. 11.;i e some ad antages o! R#5#92$#- clause. Ans:Bou can R#5#92$# a ,ariable !rom one 72.%"R# class to another 72.%"R# class by using the same memory location. 0y R#5#92$#- we can 2$2%2A12-# the ariable in W/RG2$;6 -%/RA;# -ection itsel!.+. We can R#5#92$# a -ingle ,ariable into so many sub6 ariables. <%his !acility is ery use!ul in sol ing B&''' 7roblem.> 1&.Why do we code s*<)>comp. 2nspite o! knowing comp6+ will occupy less space. Ans:Here s*<)>comp is small integer ,so two words e@ual to 4 bytes. %otally it will occupy & bytes<) words>.here in s*<)> comp6+ as one word is e@ual to 13& byte.) words e@ual to & bytes and sign will occupy 13& bytes totally it will occupy + bytes. 1+.%he maximum number o! dimensions that an array can ha e in ./0/164? is QQQQQQQQ. Ans: -#,#$ in ./0/1 6 4? and %HR## in ./0/1 6 4) 1).$ame the di isions in a ./0/1 program. Ans: 25#$%292.A%2/$ 52,2-2/$, #$,2R/$8#$% 52,2-2/$, 5A%A 52,2-2/$, 7R/.#5"R# 52,2-2/$. 1?.What are the di!!erent data types a ailable in ./0/1? Ans: Alpha6numeric <F>, alphabetic <A> and numeric <*>. 1:.What is (( le el used !or ? Ans: #lementary le el item. .annot be subdi isions o! other items <cannot be @uali!ied>, nor can they be subdi ided themsel es. 1(.What is 44 le el used !or ? Ans: 9or de!ining condition names. 14.What is le el :: used !or ? Ans: 9or R#$A8#- clause. 1*.What does the 2- $"8#R2. clause establish? Ans:2- $"8#R2. can be used on alphanumeric items, signed numeric N packed decimal items and unsigned numeric N packed decimal items. 2- $"8#R2. returns %R"# i! the item only consists o! '6*. Howe er, i! the item being tested is a signed item, then it may contain '6*, P and 6 .

&'.8y program has an array de!ined to ha e 1' items. 5ue to a bug, 2 !ind that e en i! the program access the 11th item in this array, the program does not abend. What is wrong with it? Ans: 8ust use compiler option --RA$;# i! you want array bounds checking. 5e!ault is $/--RA$;#. &1. What is the di!!erence between per!orming a -#.%2/$ and a 7ARA;RA7H? Ans: 7er!orming a -#.%2/$ will cause all the paragraphs that are part o! the section, to be per!ormed. 7er!orming a 7ARA;RA7H will cause only that paragraph to be per!ormed. &&..an 2 rede!ine an F<&''> !ield with a !ield o! F<1''> ? Ans: Bes. &+.What does #F2% do? Ans: 5oes nothing H 2! used, must be the only sentence within a paragraph. &)..an 2 rede!ine an F<1''> !ield with a !ield o! F<&''>? Ans: Bes. Rede!ines Kust causes both !ields to start at the same location. 9or example: '1 W-6%/7 72. F<1> '1 W-6%/76R#5 R#5#92$#- W-6%/7 72. F<&>. 2! you 8/,# E1&E to W-6%/76R#5, 52-71AB W-6%/7 will show 1 while 52-71AB W-6%/76R#5 will show 1&. &?..an 2 rede!ine an F<&''> !ield with a !ield o! F<1''> ? Ans: Bes. &:.What do you do to resol e -/.6( error? Ans:0asically you need to correcting the o!!ending data. 8any times the reason !or -/.( is an un6initialiCed numeric item. #xamine that possibility !irst. 8any installations pro ide you a dump !or run time abends < it can be generated also by calling some subroutines or /- ser ices thru assembly language>. %hese dumps pro ide the o!!set o! the last instruction at which the abend occurred. #xamine the compilation output FR#9 listing to get the erb and the line number o! the source code at this o!!set. %hen you can look at the source code to !ind the bug. %o get capture the runtime dumps, you will ha e to de!ine some datasets <-B-A0/"% etc > in the O.1. 2! none o! these are help!ul, use Kudgement and 52-71AB to localiCe the source o! error. Bou may e en use batch program debugging tools. &(.How is sign stored in 7acked 5ecimal !ields and Doned 5ecimal !ields?

Ans:7acked 5ecimal !ields: -ign is stored as a hex alue in the last nibble <) bits > o! the storage. Doned 5ecimal !ields: As a de!ault, sign is o er punched with the numeric alue stored in the last bite. &4.How is sign stored in a comp6+ !ield? Ans:2t is stored in the last nibble. 9or example i! your number is P1'', it stores hex '. in the last byte, hex 1. i! your number is 1'1, hex 15 i! the number is 61'1, hex &5 i! the number is 61'& etc... &*.How is sign stored in a ./87 !ield ? Ans: 2n the most signi!icant bit. 0it is on i! 6 e, o!! i! P e. +'.What is the di!!erence between ./87 N ./876+ ? Ans: ./87 is a binary storage !ormat while ./876+ is packed decimal !ormat. +1.What is ./8761? ./876&? ./8761 6 -ingle precision !loating point. "ses ) bytes. ./876& 6 5ouble precision !loating point. "ses 4 bytes. +&.How do you de!ine a ariable o! ./8761? ./876&? Ans: $o picture clause to be gi en. #xample '1 W-6,AR "-A;# ./8761. ++.How many bytes does a -*<(> ./876+ !ield occupy ? Ans: Will take ) bytes. -ign is stored as hex alue in the last nibble. ;eneral !ormula is 2$%<<n3&> P 1>>, where nA( in this example. +).How many bytes does a -*<(> -2;$ %RA212$; -#7ARA%# !ield occupy ? Ans: Will occupy 4 bytes <one extra byte !or sign>. +?.What is the maximum siCe o! a '1 le el item in ./0/1 2? in ./0/1 22? 2n ./0/1 22: 1:(((&1? +:.What is ./87 -B$.? Ans: .auses the item to be aligned on natural boundaries. .an be -B$.HR/$2D#5 1#9% or R2;H%. 9or binary data items, the address resolution is !aster i! they are located at word boundaries in the memory. 9or example, on main !rame the memory word siCe is ) bytes. %his means that each word will start !rom an address di isible by ). 2! my !irst ariable is x<+> and next one is s*<)> comp, then i! you do not speci!y the -B$. clause, -*<)> ./87 will start !rom byte + < assuming that it starts !rom ' >. 2! you speci!y -B$., then the binary data item will start !rom address ). Bou might see some wastage o! memory, but the access to this comp !ield is !aster.

+(.How do you re!erence the !ollowing !ile !ormats !rom ./0/1 programs? Ans:9ixed 0lock 9ile 6 "se /R;A$2-A%2/$ 2- -#="#$%2A1. "se R#./R52$; 8/5# 2- 9, 01/.G ./$%A2$- '. 9ixed "nblocked 6 "se /R;A$2-A%2/$ 2- -#="#$%2A1. "se R#./R52$; 8/5# 2- 9, do not use 01/.G ./$%A2$-. ,ariable 0lock 9ile 6 "se /R;A$2-A%2/$ 2- -#="#$%2A1. "se R#./R52$; 8/5# 2- ,, 01/.G ./$%A2$- '. 5o not code the ) bytes !or record length in 95. i.e. O.1 record length will be max record length in program P ) ,ariable "nblocked 6 "se /R;A$2-A%2/$ 2- -#="#$%2A1. "se R#./R52$; 8/5# 2- ,, do not use 01/.G ./$%A2$-. 5o not code ) bytes !or record length in 95 ie O.1 rec length will be max rec length in pgm P ). #-5- ,-A8 !ile 6 "se /R;A$2-A%2/$ 2-#="#$%2A1. G-5- ,-A8 !ile 6 "se /R;A$2-A%2/$ 2- 2$5#F#5, R#./R5 G#B 2-, Alternate Record Gey 2s RR5- 9ile 6 "se /R;A$2-A%2/$ 2- R#1A%2,#, R#1A%2,# G#B 27rinter 9ile 6 "se /R;A$2-A%2/$ 2- -#="#$%2A1. "se R#./R52$; 8/5# 2- 9, 01/.G ./$%A2$- '. <"se R#.98A90A in O.1 5.0>. +4.What are di!!erent !ile /7#$ modes a ailable in ./0/1? 2n which modes are the !iles /pened to write. Ans:5i!!erent /pen modes !or !iles are 2$7"%, /"%7"%, 26/ and #F%#$5. /! which /utput and #xtend modes are used to write new records into a !ile. +*.2n the O.1, how do you de!ine the !iles re!erred to in a subroutine? Ans: -upply the 55 cards Kust as you would !or !iles re!erred to in the main program. )'..an you R#WR2%# a record in an #-5- !ile? .an you 5#1#%# a record !rom it? Ans: .an rewrite<record length must be same>, but not delete. )1.What is !ile status *&? Ans: 1ogic error. e.g., a !ile is opened !or input and an attempt is made to write to it. )&.What is !ile status +*? Ans:8ismatch in 1R#.1 or 01/.G-2D# or R#.98 between your ./0/1 pgm N the O.1 <or the dataset label>. Bou will get !ile status +* on an /7#$. )+.What is -tatic, 5ynamic linking ? Ans:2n static linking, the called subroutine is link6edited into the calling program , while in dynamic linking, the subroutine N the main program will exist as separate load modules. Bou choose static3dynamic linking by choosing either the 5B$A8 or $/5B$A8 link edit option. <# en i! you choose $/5B$A8, a .A11 identi!ier <as opposed to a .A11 literal>, will translate to a 5B$A82. call>. A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use 2$2%2A1 or you do a .A$.#1. A dynamically called routine will always be in its initial state. )).#xplain $#F% and ./$%2$"# erbs !or !ile handling.

Ans:A %he .ontinue erb is used !or a situation where there in no #/9 condition. i.e. %he records are to be accessed again and again in a !ile. Whereas in the next erb the indexed !ile is accessed se@uentially, whence when index clause is accessed se@uentially read next record command is used. )?.What is A8/5#<&)>, A8/5#<+1>, R8/5#<&)> and R8/5#<A$B>? <applicable to only 8,-3#-A>. Ans: %hese are compile3link edit options. A8/5# 6 Addressing mode. R8/5# 6 Residency mode. A8/5#<&)> 6 &) bit addressing. A8/5#<+1> 6 +1 bit addressing. A8/5#<A$B> 6 #ither &) bit or +1 bit addressing depending on R8/5#. R8/5#<&)> 6 Resides in irtual storage below 1: 8eg line. "se this !or +1 bit programs that call &) bit programs. </-3,- .obol pgms use &) bit addresses only>. R8/5#<A$B> 6 .an reside abo e or below 1: 8eg line. ):.What compiler option would you use !or dynamic linking? 5B$A8. )(.What is --RA$;#, $/--RA$;# ? Ans:%hese are compiler options w.r.t subscript out o! range checking. $/--RA$;# is the de!ault and i! chosen, no run time error will be !lagged i! your index or subscript goes out o! the permissible range. )4.How do you set a return code to the O.1 !rom a ./0/1 program? Ans: 8o e a alue to R#%"R$6./5# register. R#%"R$6./5# should not be declared in your program. )*.How can you submit a Kob !rom ./0/1 programs? Ans: Write O.1 cards to a dataset with 33xxxxxxx -B-/"%A<A,2$%R5R> where EAE is output class, and dataset should be opened !or output in the program. 5e!ine a 4' byte record layout !or the !ile. ?'.What are the di!!erences between /- ,- ./0/1 and ,- ./0/1 22? Ans: 1. /-3,- .obol pgms can only run in &) bit addressing mode, ,- .obol 22 pgms can run either in &) bit or +1 bit addressing modes allowing program to address abo e 1: 8eg main storage line. &. Report writer is supported only in /-3,- .obol. +. "-A;# 2- 7/2$%#R is supported only in ,- ./0/1 22. ). Re!erence modi!ication eg: W-6,AR<1:&> is supported only in ,- ./0/1 22. ?. ./0/1 22 introduces new !eatures <#,A1"A%#, -#% ... %/ %R"#, .A11 ... 0B ./$%#F%, etc> :. -cope terminators are supported in ./0/1 22. (. /-3,- .obol !ollows A$-2 () stds while ,- ./0/1 22 !ollows A$-2 4? stds. 4. "nder .2.- .alls between ,- ./0/1 22 programs are supported.

*. ./0/1 22 supports structured programming by using in6line 7#R9/R8 Es. 1'. ./0/1 22 does not support old !eatures <R#A5B %RA.#, R#7/R%6WR2%#R, 2-A8, etc.>. 11. 2n non6.2.- en ironment, it is possible. 2n .2.-, this is not possible. COBOL FAQs (( )art "* 1. What are the !ew ad antages o! ,- ./0/1 22 o er /-3,- ./0/1? Ans: %he working storage and linkage section limit has been increased. %hey are 1&4 megabytes as supposed to 1 megabytes in /-3,- ./0/1. 2ntroduction o! A55R#-- special register. +16bit addressing. 2n using ./0/1 on 7. we ha e only !lat !iles and the programs can access only limited storage, whereas in ,- ./0/1 22 on 839 the programs can access up to 1:80 or &;0 depending on the addressing and can use ,-A8 !iles to make 23/ operations !aster &. What are the steps you go through while creating a ./0/1 program executable? Ans: 50& pre6compiler <i! embedded -=1 is used>, .2.- translator <i! .2.- program>, .obol compiler, 1ink editor. 2! 50& program, create plan by binding the 50R8s. +. $ame the di isions in a ./0/1 7rogram Ans: 2denti!ication 3 #n ironment3 5ata3 7rocedure 5i isions ). What are the di!!erent data types a ailable in ./0/1? Ans: Alpha6numeric <F> , Alphabetic <A> and numeric <*>. ?. What does the 2$2%2A12D# erb do? Ans:Alphabetic, Alphanumeric !ields N alphanumeric edited items are set to -7A.#-. $umeric, $umeric edited items set to D#R/. 9211#R , /.."R- 5#7#$52$; /$ items le!t untouched :. What is the di!!erence between a '1 le el and (( le els? Ans: '1 le el can ha e suble els !rom '& to )*. (( cannot ha e suble el. (. What are (( le els used !or? Ans: #lementary le el item. .annot be subdi isions o! other items <cannot be @uali!ied>, nor can they be subdi ided themsel es. 4. What is 44 le el used !or? Ans: 9or condition names. *. What is le el :: used !or?

Ans: 9or R#$A8#- clause. 1'. What does the 2- $"8#R2. clause establish? Ans:2- $"8#R2. can be used on alphanumeric items, signed numeric N packed decimal items and unsigned numeric N packed decimal items. 2- $"8#R2. returns %R"# i! the item only consists o! '6*. Howe er, i! the item being tested is a signed item, then it may contain '6*, P and 6 . 11. 2s compute wAu a alid statement? Ans: Bes, it is. 2t is e@ui alent to mo e u to w. 1&. 2n the abo e example, when will you pre!er compute statement o er the mo e statement? Ans:When signi!icant le!t6order digits would be lost in execution, the ./87"%# statement can detect the condition and allow you to handle it. %he 8/,# statement carries out the assignment with destructi e truncation. %here!ore, i! the siCe error is needs to be detected, ./87"%# will be pre!erred o er 8/,#. %he /$ -2D# #RR/R phrase o! ./87"%# statement, compiler generates code to detect siCe6o er!low. 1+. What happens when the /$ -2D# #RR/R phrase is speci!ied on a ./87"%# statement? Ans:2! the condition occurs, the code in the /$ -2D# #RR/R phrase is per!ormed, and the content o! the destination !ield remains unchanged. 2! the /$ -2D# #RR/R phrase is not speci!ied, the assignment is carried out with truncation. %here is no /$ -2D# #RR/R support !or the 8/,# statement. 1). How will you associate your !iles with external data sets where they physically reside? Ans:"sing -#1#.% clause, the !iles can be associated with external data sets. %he -#1#.% clause is de!ined in the 921#6./$%R/1 paragraph o! 2nput6/utput -ection that is coded #n ironment 5i ision. %he 9ile structure is de!ined by 95 entry under 9ile6-ection o! 5ata 5i ision !or the /-. 1?. How will you de!ine your !ile to the operating system? Ans:Associate the !ile with the external data set using -#1#.% clause o! 2$7"%6/"%7"% -#.%2/$. 2$7"%6/"%7"% -#.%2/$ appears inside the #$,2R/$8#$% 52,2-2/$. 1:. #xplain the use o! 5eclarati es in ./0/1? Ans:5eclarati es pro ide special section that are executed when an exceptional condition occurs. %hey must be grouped together and coded at the beginning o! procedure di ision and the entire procedure di ision must be di ided into sections. %he 5eclarati es start with a "-# statement. %he entire group o! declarati es is preceded by 5#.1AR2,#- and !ollowed by #$5 5#.1AR2%2,#- in area A. %he three types o! declarati es are #xception <when error occurs during !ile handling>, 5ebugging <to debug lines with E5E coded in w6s section> and 1abel <!or #/9 or beginning...> declarati es. 1(. How do you de!ine a table3array in ./0/1?

Ans: '1 ARRAB-. '? ARRAB1 72. F<*> /.."R- 1' %28#-. '? ARRAB& 72. F<:> /.."R- &' %28#- 2$5#F#5 0B W-62$5#F. 14. .an the /.."R- clause be at the '1 le el? Ans: $o 1*. A statically bound subprogram is called twice. What happens to working6storage ariables? Ans:%he working6storage section is allocated at the start o! the run6unit and any data items with ,A1"# clauses are initialiCed to the appropriate alue at the time. When the subprogram is called the second time, a working6storage items persist in their last used state. Howe er, i! the program is speci!ied with 2$2%2A1 on the 7R/;RA8625, working6storage section is reinitialiCed each time the program is entered. &'. -igni!icance o! the ./88/$ Attribute ? Ans:./88/$ attribute is used with nested ./0/1 programs. 2! it is not speci!ied, other nested programs will not be able to access the program. 7R/;RA8625. 7gmname is ./88/$ 7R/;RA8. &1. 2n which di ision and section, the -pecial6names paragraph appears? Ans: #n ironment di ision and .on!iguration -ection. &&. What is the 1/.A16-%/RA;# -#.%2/$? Ans:1ocal6-torage is allocated each time the program is called and is de6allocated when the program returns ia an #F2% 7R/;RA8, ;/0A.G, or -%/7 R"$. Any data items with a ,A1"# clauses are initialiCed to the appropriate alue each time the program is called. %he alue in the data items is lost when the program returns. 2t is de!ined in the 5A%A 52,2-2/$ a!ter W/RG2$;6-%/RA;# -#.%2/$ &+. What does passing 0B R#9#R#$.# mean? Ans:When the data is passed between programs, the subprogram re!ers to and processes the data items in the calling programEs storage, rather than working on a copy o! the data. When .A11 . . . 0B R#9#R#$.# identi!ier. 2n this case, the caller and the called share the same memory. &). What does passing 0B ./$%#$% mean? Ans:%he calling program passes only the contents o! the literal, or identi!ier. With a .A11 . . . 0B ./$%#$%, the called program cannot change the alue o! the literal or identi!ier in the calling program, e en i! it modi!ies the ariable in which it recei ed the literal or identi!ier.

&?. What does passing 0B ,A1"# mean? Ans:%he calling program or method is passing the alue o! the literal, or identi!ier, not a re!erence to the sending data item. %he called program or in oked method can change the parameter in the called program or in oked method. Howe er, because the subprogram or method has access only to a temporary copy o! the sending data item, those changes do not a!!ect the argument in the calling program. "se 0y alue, 2! you want to pass data to . program. 7arameters must be o! certain data type. &:. What is the de!ault, passing 0B R#9#R#$.# or passing 0B ./$%#$% or passing 0B ,A1"#? Ans: 7assing by re!erence <the caller and the called share the same memory>. &(. Where do you de!ine your data in a program i! the data is passed to the program !rom a .aller program? Ans: 1inkage -ection &4. 5e!ine the structure o! a ./0/1 subroutine. Ans:%he 7R/.#5"R# 52,2-2/$ header must ha e a using a phrase, i! the data needs to be passed to the program. %he operands o! the "-2$; phrase must be de!ined in the 12$GA;# -#.%2/$ as '16le el or ((6le el entries. $o ,A1"# clause is allowed unless the data de!ined is a condition name. 2! the program needs to be returned to the .A11#R, use #F2% 7R/;RA8 statement at the end o! the program. ;/0A.G is an alternati e, but is nonstandard. &*. What is di!!erence between next sentence and continue Ans:$#F% -#$%#$.# gi es control to the erb !ollowing the next period. ./$%2$"# gi es control to the next erb a!ter the explicit scope terminator. <%his is not one o! ./0/1 22Es !iner implementations>. 2tEs sa!est to use ./$%2$"# rather than $#F% -#$%#$.# in ./0/1 22. ./$%2$"# is like a null statement <do nothing> , while $#F% -#$%#$.# trans!ers control to the next sentence <HH> <A sentence is terminated by a period>. .heck out by writing the !ollowing code example, one i! sentence !ollowed by + display statements: 2! 1 I ' then next sentence end i! display Eline 1E display Eline &E. display Eline +E. JJJ $ote6 there is a dot <.> only at the end o! the last & statements, see the e!!ect by replacing $ext -entence with .ontinue JJJ +'. What is the di!!erence between -tructured .obol 7rogramming and /bKect /riented ./0/1 programming? Ans:-tructured programming is a 1ogical way o! programming using which you di ide the !unctionalityEs into modules and code logically. //7 is a $atural way o! programming in which you identi!y the obKects, !irst then write !unctions and procedures around the obKects. -orry, this may not be an ade@uate answer, but they are two di!!erent programming paradigms, which is di!!icult to put in a sentence or two. +1. 72. -*<)>./87 is used in spite o! ./876+ which occupies less space why? Ans:-*<)> ./87 uses only & bytes. *<)> ./876+ uses + bytes. + bytes are more than & bytes. Hence ./87 is pre!erred o er ./876+ in this case.

+&. How many number o! bytes and digits are in ol ed in -*<1'> ./87? Ans: 4 bytes <double word> and 1' digits. "p to *<*> comp use !ull word, up to *<14> comp needs double word. ++. How many numbers o! decimal digits are possible, when the amount o! storage allocated !or a "-A;# ./87 item is a> hal! word b> !ull word c> double word? Ans: & bytes <hal!word> !or 16) 5igits ) bytes <!ullword> !or ?6* 4 bytes <doubleword> !or 1'614 +). What is a scope terminator? ;i e examples. Ans: -cope terminator is used to mark the end o! a erb e.g. #,A1"A%#, #$56#,A1"A%# , 29, #$5629. +?. How many dimensions are allowed !or a table? Ans: ( +:. How many subscripts or indexes are allowed !or an /.."R- clause? Ans: ( +(. Why cannot /ccurs be used in '1 le el? Ans: 0ecause, /ccurs clause is there to repeat !ields with the same !ormat, but not the records. +4. .an a R#5#92$#- clause be used along with an /.."R- clause? Ans: Bes, i! the R#5#92$#- clause is subordinate to /.."R- clause. +*. .an you speci!y 72. clause and a ,A1"# with an /.."R- clause? Will the !ollowing code compile without errors? '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# -7A.#-. Ans: Bes, the code will compile without any errors. )'. What would be the output, when the !ollowing code is executed? '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# EAAAAAE. Ans:2t cannot be executed because the code will compile with error E M,A1"#M literal MEAAAAEM exceeded the length speci!ied in the M72.%"R#M de!initionE.

)1. '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#- 72. F<1> ,A1"# EAE. '+ W-6#F R#5#92$#- W-6%A01#6#1 72. F<?>. What can you expect? Ans: .ompile error. 5irect Rede!inition o! /.."R- clause is not allowed. )&. '1 W-6%A01#. '+ W-6%A01#6#1 /.."R- ? %28#-. ') 9211#R6F 72. F<1> ,A1"# EAE. ') W-6#F R#5#92$#- 9211#R6F 72. F<1>. What would be the output o! 52-71AB W-6%A01#? Ans: EAAAAAE. %he code will compile and execute as Rede!inition o! an item subordinate to /.."R- clause. )+. .an a -#AR.H be applied to a table which does not ha e an 2$5#F de!ined? Ans: $o, the table must be indexed. )). What is the di!!erence between -#AR.H and -#AR.H A11? Ans: -#AR.H 6 is a serial search. -#AR.H A11 6 is a binary search N the table must be sorted < A-.#$52$;35#-.#$52$; G#B clause to be used N data loaded in this order> be!ore using -#AR.H A11. )?. What should be the sorting order !or -#AR.H A11? Ans:2t can be either A-.#$52$; or 5#-.#$52$;. A-.#$52$; is de!ault. 2! you want the search to be done on an array sorted in descending order, then while de!ining the array, you should gi e 5#-.#$52$; G#B clause. <Bou must load the table in the speci!ied order>. ):. What is binary search? Ans:-earch on a sorted array. .ompare the item to be searched with the item at the center. 2! it matches, !ine else repeat the process with the le!t hal! or the right hal! depending on where the item lies. )(. .an a -#AR.H be applied to a table which does not ha e an 2$5#F de!ined? Ans: $o, the table must be indexed. )4. A table has two indexes de!ined. Which one will be used by the -#AR.H erb? Ans: %he index named !irst will be used, by -earch.

)*. What are the di!!erent rules applicable to per!orm a binary -#AR.H? Ans:%he table must be sorted in ascending or descending order be!ore the beginning o! the -#AR.H. "se /.."R- clause with A-.35#-. G#B 2- dataname1 option %he table must be indexed. %here is no need to set the index alue. "se -#AR.H A11 erb ?'. How does the binary search work? Ans:9irst the table is split into two hal es and in which hal!, the item need to be searched is determined. %he hal! to which the desired item may belong is again di ided into two hal es and the pre ious procedure is !ollowed. %his continues until the item is !ound. -#AR.H A11 is e!!icient !or tables larger than (' items. COBOL FAQs (( )art * 1. What is the di!!erence between a binary search and a se@uential search? What are the pertinent ./0/1 commands? Ans: 2n a binary search the table element key alues must be in ascending or descending se@uence. %he table is Ehal edE to search !or e@ual to, greater than or less than conditions until the element is !ound. 2n a se@uential search the table is searched !rom top to bottom, so <ironically> the elements do not ha e to be in a speci!ic se@uence. %he binary search is much !aster !or larger tables, While se@uential -earch works well with smaller ones. -#AR.H A11 is used !or binary searchesL -#AR.H !or se@uential. &. How do you sort in a ./0/1 program? ;i e sort !ile de!inition, sort statement syntax and meaning. Ans: -yntax: -/R% !ile61 /$ A-.#$52$;35#-.#$52$; G#B key. "-2$; !ile6& ;2,2$; !ile6+. "-2$; can be substituted by 2$7"% 7R/.#5"R# 2- para61 %HR" para6& ;2,2$; can be substituted by /"%7"% 7R/.#5"R# 2- para61 %HR" para6&. !ile61 is the sort work!ile and must be described using -5 entry in 921# -#.%2/$. !ile6& is the input !ile !or the -/R% and must be described using an 95 entry in 921# -#.%2/$ and -#1#.% clause in 921# ./$%R/1. !ile6+ is the out!ile !rom the -/R% and must be described using an 95 entry in 921# -#.%2/$ and -#1#.% clause in 921# ./$%R/1. !ile61, !ile6& N !ile6+ should not be opened explicitly.

2$7"% 7R/.#5"R# is executed be!ore the sort and records must be Released to the sort work !ile !rom the input procedure. /"%7"% 7R/.#5"R# is executed a!ter all records ha e been sorted. Records !rom the sort work !ile must be Returned one at a time to the output procedure. +. How do you de!ine a sort !ile in O.1 that runs the ./0/1 program? Ans:"se the -/R%WG'1, -/R%WG'&,..... did names in the step. $umber o! sort datasets depends on the olume o! data being sorted, but a minimum o! + is re@uired. ). #xplain the di!!erence between an internal and an external sort. %he pros N cons N internal sort syntax .? Ans:An external sort is not coded as a ./0/1 programL it is per!ormed through O.1 and 7;8A-/R%. /ne can use 208 utility -B$.-/R% !or external sort process. 2t is understandable without any code re!erence. An internal sort can use two di!!erent syntaxes: 1.> "-2$;, ;2,2$; sorts are comparable to external sorts with no extra !ile processingL &> 2$7"% 7R/.#5"R#, /"%7"% 7R/.#5"R# sorts allow !or data manipulation be!ore and3or a!ter the sort. ?. What is the di!!erence between per!orming a -#.%2/$ and a 7ARA;RA7H? Ans:7er!orming a -#.%2/$ will cause all the paragraphs that are part o! the section, to be per!ormed. 7er!orming a 7ARA;RA7H will cause only that paragraph to be per!ormed. :. What is the use o! #,A1"A%# statement? Ans:# aluate is like a case statement and can be used to replace nested 2!s. %he di!!erence between #,A1"A%# and case is that no RbreakS is re@uired !or #,A1"A%# i.e. control comes out o! the #,A1"A%# as soon as one match is made. (. What is the di!!erence between 7#R9/R8 ... W2%H %#-% A9%#R and 7#R9/R8 ... W2%H %#-% 0#9/R#? Ans:2! %#-% 0#9/R# is speci!ied, the condition is tested at the beginning o! each repeated execution o! the speci!ied 7#R9/R8 range. 2! %#-% A9%#R is speci!ied, the condition is tested at the end o! the each repeated execution o! the 7#R9/R8 range. With %#-% A9%#R, the range is executed at least once. 4. Which is the de!ault, %#-% 0#9/R# or %#-% A9%#R !or a 7#R9/R8 statement? Ans: %#-% 0#9/R# *. How do you code an in6line 7#R9/R8? Ans: 7#R9/R8 ... ... #$567#R9/R8. 1'. When would you use in6line per!orm? Ans:When the body o! the per!orm will not be used in other paragraphs. 2! the body o! the per!orm is a generic type o! code <used !rom arious other places in the program>, it would be better to put the code in a separate 7ara and use 7#R9/R8 paraname rather than in6line per!orm.

11. 2n an #,A1"%# statement is the order o! the WH#$ clauses signi!icant? Ans: Bes , e aluation o! the when clause proceeds !rom top to bottom 1&. How do you come out o! an #,A1"A%# statement? Ans:A!ter the execution o! one o! the when clauses, the control is automatically passed on to the next sentence a!ter the #,A1"A%# statement. %here is no need o! any extra code. 1+. What is the de!ault alue<s> !or an 2$2%2A12D# and what keyword allows !or an o erride o! the de!ault. Ans:2$2%2A12D# sets spaces to alphabetic and alphanumeric !ields. 2nitialiCe sets Deroes to numeric !ields. 9211#R, /.."R- 5#7#$52$; /$ items are le!t untouched. %he R#71A.2$; option can be used to o erride these de!aults. 1). What is -#% %/ %R"# all about, anyway? Ans: 2n ./0/1 22 the 44 le els can be set rather than mo ing their associated alues to the related data item. 1?. What is 1#$;%H in ./0/1 22? Ans: 1#$;%H acts like a special register to tell the length o! a group or an elementary item. 1:. What is the !unction o! a delimiter in -%R2$;? Ans: A delimiter in -%R2$; causes a sending !ield to be ended and another to be started. 1(. What is the !unction o! a delimiter in "$-%R2$;? Ans: A delimiter when encountered in the sending !ield causes the current recei ing !ield to be switched to the next one indicated. 14. How will you count the number o! characters in a null6terminated string? Ans: 8/,# ' %/ char6count 2$-7#.% null6terminated6string %A11B2$; char6count 9/R .HARA.%#R- 0#9/R# FM''M 1*. (( ./"$%R 72. * ,A1"# D#R/. '1 5A%A6& 72. F<11>. . . 2$-7#.% 5A%A6& %A11B2$; ./"$%R 9/R 1#A52$; M'M R#71A.2$; 92R-% MAM 0B M&M A9%#R 2$2%2A1 M.M

2! 5A%A6& is ''''A1A0A8A, what will 5A%A6& and ./"$%#R be a!ter the execution o! 2$-7#.% erb? Ans: .ounterA). 5ata6& will not change as the 2nitial E.E is not !ound. &'. What kind o! error is trapped by /$ -2D# #RR/R option? Ans: 9ixed6point o er!low. Dero raised to the Cero power. 5i ision by '. Dero raised to a negati e number. A negati e number raised to a !ractional power. &1. What is the point o! the R#71A.2$; option o! a copy statement? Ans: R#71A.2$; allows !or the same copy to be used more than once in the same code by changing the replace alue. ./7B xxx R#71A.2$; 0B . &&. When is a scope terminator mandatory? Ans:-cope terminators are mandatory !or in6line 7#R9/R8- and #,A1"A%# statements. 9or readability, itEs recommended coding practice to always make scope terminators explicit. &+. .an you use R#5#92$#- clause in the 921# -#.%2/$? Ans: $o &). .an 2 rede!ine an F<1''> !ield with a !ield o! F<&''>? Ans: Bes. Rede!ines Kust causes both !ields to start at the same location. 9or example:'1 W-6 %/7 72. F<1> '1 W-6%/76R#5 R#5#92$#- W-6%/7 72. F<&>. 2! you 8/,# R1&S to W-6%/76R#5, 52-71AB W-6%/7 will show 1 while 52-71AB W-6%/76R#5 will show 1&. &?. How will you de!ine your record descriptions in the 921# -#.%2/$ i! you want to use three di!!erent record descriptions !or the same !ile? Ans: 95 !ilename 5A%A R#./R5- AR# rd'1, rd'&, rd'+. '1 rd'1 72. F<n>. '1 rd'& 72. F<n>.

'1 rd'+ 72. F<n>. &:. When will you open a !ile in the #F%#$5 mode? Ans:When an existing !ile should be appended by adding new records at its end. #F%#$5 mode opens the !ile !or output, but the !ile is positioned !ollowing the last record on the existing !ile. &(. What does a .1/-# W2%H 1/.G statement do? Ans: %he statement closes an opened !ile and it pre ents the !ile !rom !urther being opened by the same program. &4. Which mode o! opening is re@uired when R#WR2%# is used? Ans: 26/ mode &*. Why is it necessary that the !ile be opened in 26/ mode !or R#WR2%#? Ans:0e!ore the R#WR2%# is per!ormed, the record must be read !rom the !ile. Hence R#WR2%# includes an input operation and an output operation. %here!ore, the !ile must be opened in 26/ mode. +'. Which clause can be used instead o! checking !or 921# -%A%"- A 1'? Ans: 921# -%A%"- 1' is the end o! !ile condition. Hence A% #$5 clause can be used. +1. How will you position an indexed !ile at a speci!ic point so that the subse@uent se@uential operations on the !ile can start !rom this point? Ans: "se -%AR% -%AR% !ilename G#B 2- #=3;%31%.. dataname 2$,A125 G#B ... +&. What are the access mode re@uirements o! -%AR% statement? Ans: Access mode must be -#="#$%2A1 or 5B$A82.. ++. What is the 12$GA;# -#.%2/$ used !or? Ans:%he linkage section is used to pass data !rom one program to another program or to pass data !rom a 7R/. to a program. 2t is part o! a called program that ElinksE or maps to data items in the calling programEs working storage. 2t is the part o! the called program where these share items are de!ined. +). 2! you were passing a table ia linkage, which is pre!erable 6 a subscript or an index? Ans: 2tEs not possible to pass an index ia linkage. %he index is not part o! the calling programs working storage. 2ndexing uses binary displacement. -ubscripts use the alue o! the occurrence.

+?. What is the di!!erence between a subscript and an index in a table de!inition? Ans:A subscript is a working storage data de!inition item, typically a 72. <***> where a alue must be mo ed to the subscript and then increment or decrement it by A55 %/ and -"0%RA.% 9R/8 statements. An index is a register item that exists outside the programEs working storage. Bou -#% an index to a alue and -#% it "7 0B alue and 5/W$ 0B alue. -ubscript re!ers to the array occurrence while index is the displacement <in no o! bytes> !rom the beginning o! the array. An index can only be modi!ied using 7#R9/R8, -#AR.H N -#%. $eed to ha e index !or a table in order to use -#AR.H, -#AR.H A11 .obol statements. +:. What is the di!!erence between comp and comp6+ usage? #xplain other ./0/1 usages. Ans:.omp is a binary usage, while comp6+ indicates packed decimal. %he other common usages are binary and display. 5isplay is the de!ault. .omp is de!ined as the !astest3pre!erred numeric data type !or the machine it runs on. 208 8ain!rames are typically binary and A-)''Es are packed.E +(. What is ./8761? ./876&? Ans: ./8761 6 -ingle precision !loating point. "ses ) bytes. ./876& 6 5ouble precision !loating point. "ses 4 bytes. +4. How do you de!ine a ariable o! ./8761? ./876&? Ans: $o picture clause to be gi en. #xample '1 W-6,AR "-A;# ./8761. +*. How many bytes does a -*<(> ./876+ !ield occupy ? Ans: Will take ) bytes. -ign is stored as hex alue in the last nibble. ;eneral !ormula is 2$%<<n3&> P 1>>, where nA( in this example. )'. How many bytes does a -*<(> -2;$ trailing separate !ield occupy ? Ans: Will occupy 4 bytes <one extra byte !or sign>. )1. What is the maximum alue that can be stored in -*<4> ./87? Ans: ******** )&. What is ./87 -B$.? Ans:.auses the item to be aligned on natural boundaries. .an be -B$.HR/$2D#5 1#9% or R2;H%. 9or binary data items, the address resolution is !aster i! they are located at word boundaries in the memory. 9or example, on main !rame the memory word siCe is ) bytes. %his means that each word will start !rom an address di isible by ). 2! my !irst ariable is x<+> and next one is s*<)> comp, then i! you do not speci!y the -B$. clause, -*<)> ./87 will start !rom byte + < assuming that it starts !rom ' >. 2! you speci!y -B$., then the binary data item will start !rom address ). Bou might see some wastage o! memory, but the access to this computational !ield is !aster.

)+. What is the maximum siCe o! a '1 le el item in ./0/1 2? in ./0/1 22? Ans: 1:(((&1? )).What is the di!!erence between 72. *.** and * **? Ans:72. *.** is a 9/"R67/-2%2/$ !ield that actually contains a decimal point where as 72. * ** is %HR##67/-2%2/$ numeric !ield with implied or assumed decimal position. )?.How is 72. *.** is di!!erent !rom 72. * **? Ans:72. *.** is a !our position !ield that actually contains a decimal point where as * ** is a three position numeric !ield with an implied or assumed decimal point. ):.What does 72. * ** 2ndicate? Ans:72.%"R# * ** is a three position $umeric !ield with an implied or assumed decimal point a!ter the !irst positionL the means an implied decimal point. )(. What happens when we mo e a comp6+ !ield to an edited < say C<*>.CC6> Ans:%he editing characters are to be used with data items with usage clause as display, which is the de!ault. When you try displaying a data item with usage as computational it does not gi e the desired display !ormat because the data item is stored as packed decimal. -o i! u want this particular data item to be edited u ha e to mo e it into a data item whose usage is display and then ha e that particular data item edited in the !ormat desired. )4. What are the causes !or -'.1, -'.), -'.?, -'.(, -'.0 abends ? Ans: -'.1 6 8ay be due to T 8issing or misspelled 55 name T Read3Write to unopened dataset T Read to dataset opened output T Write to dataset opened input T .alled subprogram not !ound. -'.) may be due to T 1.8issing -elect statement<during compile> T 0ad -ubscript3index T 7rotection #xception

T 8issing parameters on called subprogram T Read3Write to unopened !ile T 8o e data !rom3to unopened !ile. -'.? 8ay be due to T 0ad -ubscript3index T .lose an unopen dataset T 0ad exit !rom a per!orm T Access to 23/ area<95> be!ore read. -'.( may be due to T $umeric operation on non6numeric data T "n6initialiCe working6storage T .oding past the maximum allowed sub script. )*. What is the di!!erence between an #xternal and a ;lobal ,ariable Es? Ans:;lobal ariables are accessible only to the batch program whereas external ariables can be re!erenced !rom any batch program residing in the same system library. ?'. What is 7-0 N A.0? Ans:7-0 : 7rogram speci!ication block. 2n!orm about how a speci!ic program is to be access one or more 28- 50. 2t consists o! 7.0<7rg .ommunication 0lock>. 2n!ormation to which segment in 50 can be accessed, what the program is allowed to do with those segment and how the 50 is to be accessed. A.0 : Access .ontrol 0locks are generated by 28- as an expansion o! in!ormation contained in the 7-0 in order to speed up the access to the applicable 505Es. ?1. WhatEs a 15-<1inear 5ata -et> and whatEs it used !or ? Ans:15- is a ,-A8 dataset in name only. 2t has unstructured )k <)'*: bytes> !ixed siCe .2s which do not contain control !ields and there!ore !rom ,-A8Es standpoint they do not contain any logical records. %here is no !reespace, and no access !rom .obol. .an be accessed by 50& and 28- !ast path datasets. 15- is essentially a table o! data maintained on disk. %he Etable entriesE must be created ia a user program and can only be logically accessed ia a user program. When passed, the entire 15- must be mapped into storage, then data is accessed ia base and displacement type processing. ?&. What is the 2mportance o! ;1/0A1 clause According to new standards o! ./0/1

Ans:When any data name, !ile6name , Record6name, condition name or 2ndex de!ined in an 2ncluding 7rogram can be re!erenced by a directly or indirectly in an included program, 7ro ided the said name has been declared to be a global name by ;1/0A1 9ormat o! ;lobal .lause is'1 data61 72. *<?> 2- ;1/0A1. ?+. What is the 7urpose o! 7/2$%#R 7hrase in -%R2$; command Ans:%he 7urpose o! 7/2$%#R phrase is to speci!y the le!tmost position within recei ing !ield where the !irst trans!erred character will be stored ?). How do we get currentdate !rom system with century? Ans: 0y using 2ntrinsic !unction, 9"$.%2/$ ."RR#$%65A%# ??.How many -ections are there in 5ata 5i ision?. Ans:-2F -#.%2/$- 1.E921# -#.%2/$E &.EW/RG2$;6-%/RA;# -#.%2/$E +.E1/.A16 -%/RA;# -#.%2/$E ).E-.R##$ -#.%2/$E ?.ER#7/R% -#.%2/$E :.E12$GA;# -#.%2/$E 2n ./0/1 22, there are only ) sections. 1.E921# -#.%2/$E &.EW/RG2$;6-%/RA;# -#.%2/$E +.E1/.A16-%/RA;# -#.%2/$E ).E12$GA;# -#.%2/$E. ?:. What is the di!!erence between a 5B$A82. and -%A%2. call in ./0/1.? Ans:%o correct an earlier answer:All called modules cannot run standalone i! they re@uire program ariables passed to them ia the 12$GA;# section. 5ynamically called modules are those that are not bound with the calling program at link edit time <2#W1 !or 208> and so are loaded !rom the program library <Koblib or steplib> associated with the Kob. 9or 5B$A82. calling o! a module the 5B$A8 compiler option must be chosen, else the linkage editor will not generate an executable as it will expect null address resolution o! all called modules. A -tatically called module is one that is bound with the calling module at link edit, and there!ore becomes part o! the executable load module. ?(. How can 2 tell i! a module is being called 5B$A82.A11B or -%A%2.A11B? Ans:%he /$1B way is to look at the output o! the linkage editor <2#W1>or the load module itsel!. 2! the module is being called 5B$A82.A11B then it will not exist in the main module, i! it is being called -%A%2.A11B then it will be seen in the load module. .alling a working storage ariable, containing a program name, does not make a 5B$A82. call. %his type o! calling is known as 28712.2%# calling as the name o! the module is implied by the contents o! the working storage ariable. .alling a program name literal <.A11>. COBOL FAQs (( )art *" +,ainFrame1. $ame the di isions in a ./0/1 program. Ans: 25#$%292.A%2/$ 52,2-2/$, #$,2R/$8#$% 52,2-2/$, 5A%A 52,2-2/$, 7R/.#5"R# 52,2-2/$. &. What are the di!!erent data types a ailable in ./0/1? Ans: Alpha6numeric <F>, alphabetic <A> and numeric <*>.

+. What does the 2$2%2A12D# erb do? Ans: Alphabetic, Alphanumeric !ields N alphanumeric edited items are set to -7A.#-. $umeric, $umeric edited items set to D#R/. 9211#R , /.."R- 5#7#$52$; /$ items le!t untouched. ). What is (( le el used !or ? Ans: #lementary le el item. .annot be subdi isions o! other items <cannot be @uali!ied>, nor can they be subdi ided themsel es. ?. What is 44 le el used !or ? Ans: 9or condition names. :. What is le el :: used !or ? Ans: 9or R#$A8#- clause. (. .an the /.."R- clause be at the '1 le el? Ans: $o. 4. What is the di!!erence between -#AR.H and -#AR.H A11? 6 ;Ans: -#AR.H 6 is a serial search. -#AR.H A11 6 is a binary search N the table must be sorted < A-.#$52$;35#-.#$52$; G#B clause to be used N data loaded in this order> be!ore using -#AR.H A11. *. 8y program has an array de!ined to ha e 1' items. 5ue to a bug, 2 !ind that e en i! the program access the 11th item in this array, the program does not abend. What is wrong with it? Ans: 8ust use compiler option --RA$;# i! you want array bounds checking. 5e!ault is $/--RA$;#. 1'.What is the di!!erence between ./$%2$"# N $#F% -#$%#$.# ? Ans:./$%2$"# is like a null statement <do nothing> , while $#F% -#$%#$.# trans!ers control to the next sentence <HH> <A sentence is terminated by a period> 11..an 2 rede!ine an F<1''> !ield with a !ield o! F<&''>? Ans: Bes. Rede!ines Kust causes both !ields to start at the same location. 9or example: '1 W-6%/7 72. F<1> '1 W-6%/76R#5 R#5#92$#- W-6%/7 72. F<&>.

2! you 8/,# R1&S to W-6%/76R#5, 52-71AB W-6%/7 will show 1 while 52-71AB W-6%/76R#5 will show 1&. 1&..an 2 rede!ine an F<&''> !ield with a !ield o! F<1''> ? Ans: Bes. 1+.How is sign stored in a comp6+ !ield? 6 ;Ans:2t is stored in the last nibble. 9or example i! your number is P1'', it stores hex '. in the last byte, hex 1. i! your number is 1'1, hex &. i! your number is 1'&, hex 15 i! the number is 61'1, hex &5 i! the number is 61'& etc... 1). How is sign stored in a ./87 !ield ? 6 ;Ans: 2n the most signi!icant bit. 0it is on i! 6 e, o!! i! P e. 1?.What is the di!!erence between ./87 N ./876+ ? Ans: ./87 is a binary storage !ormat while ./876+ is packed decimal !ormat. 1:.What is ./8761? ./876&? Ans: ./8761 6 -ingle precision !loating point. "ses ) bytes. ./876& 6 5ouble precision !loating point. "ses 4 bytes. 1(.How do you de!ine a ariable o! ./8761? ./876&? Ans: $o picture clause to be gi en. #xample '1 W-6,AR "-A;# ./8761. 14.How many bytes does a -*<(> ./876+ !ield occupy ? Ans: Will take ) bytes. -ign is stored as hex alue in the last nibble. ;eneral !ormula is 2$%<<n3&> P 1>>, where nA( in this example. 1*.What are di!!erent !ile /7#$ modes a ailable in ./0/1? Ans: /pen !or 2$7"%, /"%7"%, 26/, #F%#$5. &'.What is -tatic,5ynamic linking ? Ans:2n static linking, the called subroutine is link6edited into the calling program , while in dynamic linking, the subroutine N the main program will exist as separate load modules. Bou choose static3dynamic linking by choosing either the 5B$A8 or $/5B$A8 link edit option. <# en i! you choose $/5B$A8, a .A11 identi!ier <as opposed to a .A11 literal>, will translate to a 5B$A82. call>.

A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use 2$2%2A1 or you do a .A$.#1. A dynamically called routine will always be in its initial state. &1.What is A8/5#<&)>, A8/5#<+1>, R8/5#<&)> and R8/5#<A$B>? < applicable to only 8,-3#-A #nterprise -er er>. Ans: %hese are compile3link edit options:6 A8/5# 6 Addressing mode. R8/5# 6 Residency mode. A8/5#<&)> 6 &) bit addressing. A8/5#<+1> 6 +1 bit addressing. A8/5#<A$B> 6 #ither &) bit or +1 bit addressing depending on R8/5#. R8/5#<&)> 6 Resides in irtual storage below 1: 8eg line. "se this !or +1 bit programs that call &) bit programs. </-3,- .obol pgms use &) bit addresses only>. R8/5#<A$B> 6 .an reside abo e or below 1: 8eg line. &&.What compiler option would you use !or dynamic linking? Ans: 5B$A8. &+.How do you set a return code to the O.1 !rom a ./0/1 program? Ans: 8o e a alue to R#%"R$6./5# register. R#%"R$6./5# should not be declared in your program. ,A".F/A,0 ( COBOL ".T0/*"01 Q203T"O.3 4. .ame the i#isions in a COBOL program. "50.T"F"CAT"O. 5"*"3"O.6 0.*"/O.,0.T 5"*"3"O.6 5ATA 5"*"3"O.6 )/OC052/0 5"*"3"O.. 7. 1hat are the ifferent ata t'pes a#ai!ab!e in COBOL8 A!pha(numeric +9-6 a!phabetic +A- an numeric +:-. ;. 1hat oes the "."T"AL"<0 #erb o8 = A!phabetic6 A!phanumeric fie! s > a!phanumeric e ite items are set to 3)AC03. .umeric6 .umeric e ite items set to <0/O. F"LL0/ 6 OCC2/3 50)0.5".? O. items !eft untouche . @. 1hat is AA !e#e! use for 8 0!ementar' !e#e! item. Cannot be sub i#isions of other items +cannot be Bua!ifie -6 nor can the' be sub i#i e themse!#es.

%. 1hat is CC !e#e! use for 8 For con ition names. &. 1hat is !e#e! && use for 8 For /0.A,03 c!ause. A. 1hat oes the "3 .2,0/"C c!ause estab!ish 8 "3 .2,0/"C can be use on a!phanumeric items6 signe numeric > packe ecima! items an usigne numeric > packe ecima! items. "3 .2,0/"C returns T/20 if the item on!' consists of $(:. Dowe#er6 if the item being teste is a signe item6 then it ma' contain $(:6 E an ( . C. Dow o 'ou efine a tab!e/arra' in COBOL8 $4 A//AF3. $% A//AF4 )"C 9+:- OCC2/3 4$ T",03. $% A//AF7 )"C 9+&- OCC2/3 7$ T",03 ".50905 BF 13(".509. :. Can the OCC2/3 c!ause be at the $4 !e#e!8 .o. 4$. 1hat is the ifference between in eG an subscript8 3ubscript refers to the arra' occurrence whi!e in eG is the isp!acement +in no of b'tes- from the beginning of the arra'. An in eG can on!' be mo ifie using )0/FO/,6 30A/CD > 30T. .ee to ha#e in eG for a tab!e in or er to use 30A/CD6 30A/CD ALL. 44. 1hat is the ifference between 30A/CD an 30A/CD ALL8 30A/CD ( is a seria! search. 30A/CD ALL ( is a binar' search > the tab!e must be sorte + A3C0.5".?/503C0.5".? H0F c!ause to be use > ata !oa e in this or erbefore using 30A/CD ALL. 47. 1hat shou! be the sorting or er for 30A/CD ALL8 "t can be either A3C0.5".? or 503C0.5".?. A3C0.5".? is efau!t. "f 'ou want the search to be one on an arra' sorte in escen ing or er6 then whi!e efining the arra'6 'ou shou! gi#e 503C0.5".? H0F c!ause. +Fou must !oa the tab!e in the specifie or er-. 4;. 1hat is binar' search8

3earch on a sorte arra'. Compare the item to be searche with the item at the center. "f it matches6 fine e!se repeat the process with the !eft ha!f or the right ha!f epen ing on where the item !ies. 4@. ,' program has an arra' efine to ha#e 4$ items. 5ue to a bug6 " fin that e#en if the program access the 44th item in this arra'6 the program oes not aben . 1hat is wrong with it8 ,ust use compi!er option 33/A.?0 if 'ou want arra' boun s checking. 5efau!t is .O33/A.?0. 4%. Dow o 'ou sort in a COBOL program8 ?i#e sort fi!e efinition6 sort statement s'ntaG an meaning. 3'ntaG: 3O/T fi!e(4 O. A3C0.5".?/503C0.5".? H0F ke'.... 23".? fi!e(7 ?"*".? fi!e(;. 23".? can be substitute b' ".)2T )/OC052/0 "3 para(4 TD/2 para(7 ?"*".? can be substitute b' O2T)2T )/OC052/0 "3 para(4 TD/2 para(7. fi!e(4 is the sort workfi!e an must be escribe using 35 entr' in F"L0 30CT"O.. fi!e(7 is the input fi!e for the 3O/T an must be escribe using an F5 entr' in F"L0 30CT"O. an 30L0CT c!ause in F"L0 CO.T/OL. fi!e(; is the outfi!e from the 3O/T an must be escribe using an F5 entr' in F"L0 30CT"O. an 30L0CT c!ause in F"L0 CO.T/OL. fi!e(46 fi!e(7 > fi!e(; shou! not be opene eGp!icit!'. ".)2T )/OC052/0 is eGecute before the sort an recor s must be /0L0A30 to the sort work fi!e from the input proce ure. O2T)2T )/OC052/0 is eGecute after a!! recor s ha#e been sorte . /ecor s from the sort work fi!e must be /0T2/.e one at a time to the output proce ure. 4&. Dow o 'ou efine a sort fi!e in ICL that runs the COBOL program8 2se the 3O/T1H$46 3O/T1H$76..... names in the step. .umber of sort atasets epen s on the #o!ume of ata being sorte 6 but a minimum of ; is reBuire . 4A. 1hat are the two wa's of oing sorting in a COBOL program8 ?i#e the formats. 3ee Buestion 4&.

4C. ?i#e the format of 23".? an ?"*".? in 3O/T statement. 1hat are the restrictions with it8 3ee Buestion 4&. /estrictions ( Cannot massage recor s6 canot se!ect recor s to be sorte . 4:. 1hat is the ifference between performing a 30CT"O. an a )A/A?/A)D8 )erforming a 30CT"O. wi!! cause a!! the paragraphs that are part of the section6 to be performe . )erforming a )A/A?/A)D wi!! cause on!' that paragraph to be performe . 7$. 1hat is the use of 0*AL2AT0 statement8 0#a!uate is !ike a case statement an can be use to rep!ace neste "fs. The ifference between 0*AL2AT0 an case is that no JbreakJ is reBuire for 0*AL2AT0 i.e. contro! comes out of the 0*AL2AT0 as soon as one match is ma e. 74. 1hat are the ifferent forms of 0*AL2AT0 statement8 0*AL2AT0 0*AL2AT0 3QLCO50 AL3O F"L0(3TAT23 1D0. AKB A.5 CK5 1D0. 4$$ AL3O J$$J imperati#e stmt imperati#e stmt 1D0. +5E9-/F K @ 1D0. (;$% AL3O J;7J imperati#e stmt imperati#e stmt 1D0. OTD0/ 1D0. OTD0/ imperati#e stmt imperati#e stmt 0.5(0*AL2AT0 0.5(0*AL2AT0 0*AL2AT0 3QLCO50 AL3O AKB 0*AL2AT0 3QLCO50 AL3O T/20 1D0. 4$$ AL3O T/20 1D0. 4$$ AL3O AKB imperati#e stmt imperati#e stmt 1D0. (;$% AL3O FAL30 1D0. (;$% AL3O +A/CK@imperati#e stmt imperati#e stmt 0.5(0*AL2AT0 0.5(0*AL2AT0 77. Dow o 'ou come out of an 0*AL2AT0 statement8

After the eGecution of one of the when c!auses6 the contro! is automatica!!' passe on to the neGt sentence after the 0*AL2AT0 statement. There is no nee of an' eGtra co e. 7;. "n an 0*AL2AT0 statement6 can " gi#e a comp!eG con ition on a when c!ause8 Fes. 7@. 1hat is a scope terminator8 ?i#e eGamp!es. 3cope terminator is use to mark the en of a #erb e.g. 0*AL2AT06 0.5( 0*AL2AT0L "F6 0.5("F. 7%. Dow o 'ou o in(!ine )0/FO/,8 )0/FO/, ... ... 0.5 )0/FO/, 7&. 1hen wou! 'ou use in(!ine perform8 1hen the bo ' of the perform wi!! not be use in other paragraphs. "f the bo ' of the perform is a generic t'pe of co e +use from #arious other p!aces in the program-6 it wou! be better to put the co e in a separate para an use )0/FO/, paraname rather than in(!ine perform. 7A. 1hat is the ifference between CO.T".20 > .09T 30.T0.C0 8 CO.T".20 is !ike a nu!! statement + o nothing- 6 whi!e .09T 30.T0.C0 transfers contro! to the neGt sentence +MM- +A sentence is terminate b' a perio 7C. 1hat oes 09"T o 8 5oes nothing M "f use 6 must be the on!' sentence within a paragraph. 7:. Can " re efine an 9+4$$- fie! with a fie! of 9+7$$-8 Fes. /e efines Nust causes both fie! s to start at the same !ocation. For eGamp!e: $4 13(TO) )"C 9+4$4 13(TO)(/05 /050F".03 13(TO) )"C 9+7-. "f 'ou ,O*0 J47J to 13(TO)(/056 5"3)LAF 13(TO) wi!! show 4 whi!e 5"3)LAF 13(TO)(/05 wi!! show 47. ;$. Can " re efine an 9+7$$- fie! with a fie! of 9+4$$- 8

Fes. ;4. 1hat o 'ou o to reso!#e 3OC(A error8 Basica!!' 'ou nee to correcting the offen ing ata. ,an' times the reason for 3OCA is an un(initia!iOe numeric item. 0Gamine that possibi!it' first. ,an' insta!!ations pro#i e 'ou a ump for run time aben s + it can be generate a!so b' ca!!ing some subroutines or O3 ser#ices thru assemb!' !anguage-. These umps pro#i e the offset of the !ast instruction at which the aben occurre . 0Gamine the compi!ation output 9/0F !isting to get the #erb an the !ine number of the source co e at this offset. Then 'ou can !ook at the source co e to fin the bug. To get capture the runtime umps6 'ou wi!! ha#e to efine some atasets +3F3ABO2T etc - in the ICL. "f none of these are he!pfu!6 use Nu gement an 5"3)LAF to !oca!iOe the source of error. 3ome insta!!tion might ha#e batch program ebugging too!s. 2se them. ;7. Dow is sign store in )acke 5ecima! fie! s an <one 5ecima! fie! s8 )acke 5ecima! fie! s: 3ign is store as a heG #a!ue in the !ast nibb!e +@ bits - of the storage. <one 5ecima! fie! s: As a efau!t6 sign is o#er punche with the numeric #a!ue store in the !ast bite. ;;. Dow is sign store in a comp(; fie! 8 "t is store in the !ast nibb!e. For eGamp!e if 'our number is E4$$6 it stores heG $C in the !ast b'te6 heG 4C if 'our number is 4$46 heG 7C if 'our number is 4$76 heG 45 if the number is (4$46 heG 75 if the number is (4$7 etc... ;@. Dow is sign store in a CO,) fie! 8 "n the most significant bit. Bit is on if (#e6 off if E#e. ;%. 1hat is the ifference between CO,) > CO,)(; 8 CO,) is a binar' storage format whi!e CO,)(; is packe ;&. 1hat is CO,)(48 CO,)(78 CO,)(4 ( 3ing!e precision f!oating point. 2ses @ b'tes. CO,)(7 ( 5oub!e precision f!oating point. 2ses C b'tes. ;A. Dow o 'ou efine a #ariab!e of CO,)(48 CO,)(78 ecima! format.

.o picture c!ause to be gi#en. 0Gamp!e $4 13(*A/ 23A?0 CO,)(4. ;C. Dow man' b'tes oes a 3:+A- CO,)(; fie! occup' 8 1i!! take @ b'tes. 3ign is store as heG #a!ue in the !ast nibb!e. ?enera! formu!a is ".T++n/7- E 4--6 where nKA in this eGamp!e. ;:. Dow man' b'tes oes a 3:+A- 3"?. T/A"L".? 30)A/AT0 fie! occup' 8 1i!! occup' C b'tes +one eGtra b'te for sign-. @$. Dow man' b'tes wi!! a 3:+C- CO,) fie! occup' 8 @ b'tes. @4. 1hat is the maGimum #a!ue that can be store in 3:+C- CO,)8 :::::::: @7. 1hat is CO,) 3F.C8 Causes the item to be a!igne on natura! boun aries. Can be 3F.CD/O."<05 L0FT or /"?DT. For binar' ata items6 the a ress reso!ution is faster if the' are !ocate at wor boun aries in the memor'. For eGamp!e6 on main frame the memor' wor siOe is @ b'tes. This means that each wor wi!! start from an a ress i#isib!e b' @. "f m' first #ariab!e is G+;- an neGt one is s:+@- comp6 then if 'ou o not specif' the 3F.C c!ause6 3:+@- CO,) wi!! start from b'te ; + assuming that it starts from $ -. "f 'ou specif' 3F.C6 then the binar' ata item wi!! start from a ress @. Fou might see some wastage of memor'6 but the access to this computationa! fie! is faster. @;. 1hat is the maGimum siOe of a $4 !e#e! item in COBOL "8 in COBOL ""8 "n COBOL "": 4&AAA74% @@. Dow o 'ou reference the fo!!owing fi!e formats from COBOL programs: FiGe B!ock Fi!e ( 2se O/?A."3AT"O. "3 30Q20.T"AL. 2se /0CO/5".? ,O50 "3 F6 BLOCH CO.TA".3 $ . FiGe 2nb!ocke ( 2se O/?A."3AT"O. "3 30Q20.T"AL. 2se /0CO/5".? ,O50 "3 F6 o not use BLOCH CO.TA".3 *ariab!e B!ock Fi!e ( 2se O/?A."3AT"O. "3 30Q20.T"AL. 2se /0CO/5".? ,O50 "3 *6 BLOCH CO.TA".3 $. 5o not co e the @ b'tes for recor !ength in F5 ie ICL rec !ength wi!! be maG rec !ength in pgm E @

*ariab!e 2nb!ocke ( 2se O/?A."3AT"O. "3 30Q20.T"AL. 2se /0CO/5".? ,O50 "3 *6 o not use BLOCH CO.TA".3. 5o not co e @ b'tes for recor !ength in F5 ie ICL rec !ength wi!! be maG rec !ength in pgm E @. 0353 *3A, fi!e ( 2se O/?A."3AT"O. "3 30Q20.T"AL. H353 *3A, fi!e ( 2se O/?A."3AT"O. "3 ".509056 /0CO/5 H0F "36 ALT0/.AT0 /0CO/5 H0F "3 //53 Fi!e ( 2se O/?A."3AT"O. "3 /0LAT"*06 /0LAT"*0 H0F "3 )rinter Fi!e ( 2se O/?A."3AT"O. "3 30Q20.T"AL. 2se /0CO/5".? ,O50 "3 F6 BLOCH CO.TA".3 $. +2se /0CF,KFBA in ICL 5CB-. @%. 1hat are ifferent fi!e O)0. mo es a#ai!ab!e in COBOL8 Open for ".)2T6 O2T)2T6 "(O6 09T0.5. @&. 1hat is the mo e in which 'ou wi!! O)0. a fi!e for writing8 O2T)2T6 09T0.5 @A. "n the ICL6 how o 'ou efine the fi!es referre to in a subroutine 8 3upp!' the 55 car s Nust as 'ou wou! for fi!es referre to in the main program. @C. Can 'ou /01/"T0 a recor in an 0353 fi!e8 Can 'ou 50L0T0 a recor from it8 Can rewrite+recor !ength must be same-6 but not e!ete. @:. 1hat is fi!e status :78 Logic error. e.g.6 a fi!e is opene for input an an attempt is ma e to write to it. %$. 1hat is fi!e status ;: 8 ,ismatch in L/0CL or BLOCH3"<0 or /0CF, between 'our COBOL pgm > the ICL +or the ataset !abe!-. Fou wi!! get fi!e status ;: on an O)0.. %4. 1hat is 3tatic65'namic !inking 8 "n static !inking6 the ca!!e subroutine is !ink(e ite into the ca!!ing program 6 whi!e in 'namic !inking6 the subroutine > the main program wi!! eGist as separate !oa mo u!es. Fou choose static/ 'namic !inking b' choosing either the 5F.A, or .O5F.A, !ink e it option. +0#en if 'ou choose .O5F.A,6 a CALL i entifier +as oppose to a CALL !itera!-6 wi!! trans!ate to a 5F.A,"C ca!!-. A statica!!' ca!!e subroutine wi!! not be in its initia! state the neGt time it is ca!!e un!ess 'ou eGp!icit!' use "."T"AL or 'ou o a CA.C0L. A 'namica!!' ca!!e routine wi!! a!wa's be in its initia! state.

%7. 1hat is A,O50+7@-6 A,O50+;4-6 /,O50+7@- an /,O50+A.F-8 + app!icab!e to on!' ,*3/03A 0nterprise 3er#er-. These are compi!e/!ink e it options. A,O50 ( A ressing mo e. /,O50 ( /esi enc' mo e. A,O50+7@- ( 7@ bit a ressing. A,O50+;4- ( ;4 bit a ressing. A,O50+A.F- ( 0ither 7@ bit or ;4 bit a ressing epen ing on /,O50. /,O50+7@- ( /esi es in #irtua! storage be!ow 4& ,eg !ine. 2se this for ;4 bit programs that ca!! 7@ bit programs. +O3/*3 Cobo! pgms use 7@ bit a resses on!'-. /,O50+A.F- ( Can resi e abo#e or be!ow 4& ,eg !ine. %;. 1hat compi!er option wou! 'ou use for 'namic !inking8 5F.A,. %@. 1hat is 33/A.?06 .O33/A.?0 8 These are compi!er options w.r.t subscript out of range checking. .O33/A.?0 is the efau!t an if chosen6 no run time error wi!! be f!agge if 'our in eG or subscript goes out of the permissib!e range. %%. Dow o 'ou set a return co e to the ICL from a COBOL program8 ,o#e a #a!ue to /0T2/.(CO50 register. /0T2/.(CO50 shou! not be ec!are in 'our program. %&. Dow can 'ou submit a Nob from COBOL programs8 1rite ICL car s to a ataset with //GGGGGGG 3F3O2TK+A6".T/5/- where JAJ is output c!ass6 an ataset shou! be opene for output in the program. 5efine a C$ b'te recor !a'out for the fi!e. %A. 1hat are the ifferences between O3 *3 COBOL an *3 COBOL ""8 O3/*3 Cobo! pgms can on!' run in 7@ bit a ressing mo e6 *3 Cobo! "" pgms can run either in 7@ bit or ;4 bit a ressing mo es. /eport writer is supporte on!' in O3/*3 Cobo!. 23A?0 "3 )O".T0/ is supporte on!' in *3 COBOL "". /eference mo ification eg: 13(*A/+4:7- is supporte on!' in *3 COBOL "".

0*AL2AT0 is supporte on!' in *3 COBOL "". 3cope terminators are supporte on!' in *3 COBOL "". O3/*3 Cobo! fo!!ows A.3" A@ st s whi!e *3 COBOL "" fo!!ows A.3" C% st s. 2n er C"C3 Ca!!s between *3 COBOL "" programs are supporte . %C. 1hat are the steps 'ou go through whi!e creating a COBOL program eGecutab!e8

5B7 precompi!er +if embe compi!er6 Link e itor.

e sB! use -6 C"C3 trans!ator +if C"C3 pgm-6 Cobo!

"f 5B7 program6 create p!an b' bin ing the 5B/,s. %:. Can 'ou ca!! an O3 *3 COBOL pgm from a *3 COBOL "" pgm 8 "n non(C"C3 en#ironment6 it is possib!e. "n C"C36 this is not possib!e. Fou can a!so use this site to get LOT3 an LOT3 of COBOL Q>A a http://www.geekinter#iew.com/"nter#iew(Questions/,ainframe/COBOL

Potrebbero piacerti anche