1)Suppose i have a variable with s9(18)v99 comp3 . what is the size of variable . If s9(18) comp3 is 10 bytes . There should be some difference between two allocations ? Thanks krishna chaitanya
Memory related
2) How many types of sorts are there in cobol?
Two types of sort are there:-
1) DFSORT
2) SYNCSORT
3) If I want to increase the Limit in GDG. What should I do?
4) Is It Possible to Update or change in VIEW Mode?
yes,bt it wont save the changes which we did after closing the prgm,it will give the msg while closing the prgm "in view mode we can't do the changes"
5) Which of the following characters is NOT valid in column 7? a. - b. \ c. * d. # e. $?
a) \
6) i have mainprogram and subgram...if i compile mainprogram
without stop run..what will u get in compilation time?
WE will get a Abend su4038
6)if I mentioned stop run in cics what happened?
7) DATAONLY, MAPONLY functionality?
these two options are used in send map command..
like
exec cics send map('map1') mapset('mapset1') from(....)
maponly/dataonly
end-exec.
if we code maponly then only map without any data in fields will b reflected at terminal but in case of dataonly the currend map at terminal will b unchanged only data within field will b updated.....
8) Re: what is ASRA, AEY9?
A)ASRA : An ASRA is the CICS interrupt code, the equivalent of an MVS abend code like SOC7.
AEY9 : unsupported command issued / DB2 DB not up
9) what is the difference between PA & PF keys?
PF key : Wake up the task and transmit modified data.
PA Key : Wake up the task only.
10) Re: Where the Plan is located in CICS-DB2
Answer
# 1 In CICS-DB2 Plan is located RCT table
11) Re: SUPPOSE I HAVE 60 CHARACTERS STING. IN THAT I WANT FIND OUT HOW MANY TIMES 'A'(ASSUME)WILL REPEATED AND I HAVE TO PASS 'E' IN PLACE OF 'A'ALONG THAT STRING.
Answer
ASSUME WS-NAME HAS 60 CHARACTERS
INSPECT WS-NAME TALLYING WS-COUNT CHARACTER 'A'
INSPECT WS-NAME REPLACING ALL 'A' BY 'E',
12) How do pass the values to the parameters in cobol
Answer # 1 )
You can pass the values to cobol program using 3 ways:
1.passing the parameters from SYSIN
2.using parm
3.using file
Answer # 2 )
1) PARM (Receive in Linkage Section)
2) SYSIN DD* (Receive with ACCEPT statement)
3) Files ( Declare/Define/Open in the program)
13) 01rec1.
05 a pic 999v99 value 123.12
05 b pic 99v9 value 45.9
02 rec2.
05 x pic 999v99
05 y pic 99v99
05 z pic x(3) value 'abc'
if rec1 is moved to rec2 then what is the value of rec2?
rec2 will be
123124590
14) I have a cobol program with a sub program. How ca i find that
it is a dynamic call? or static call..?
It is very easy to find...........
1st u check the stmt call 'sub-name' or call 'ws-name'...
if it is call 'sub-name' then it is STATIC CALL
OR
If it is call 'ws-name' then it is DYNAMIC CALL....
Or)
In a main program if we are calling subprogram directly ie
by giving 'call subprog' then it is static call.
ex:call subprog.
if we are moving the subprogram name to the working storage
variable and calling the working storage variable then it a
dynamic call ie.,
ex:
01 ws-var1 pic x(10).
move subpgrog to ws-var1.
call ws-var1.
15) what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.?
COND parameter allows to specify condition based on the
return code of earlier steps will allow the current job
steps to execute or to bypass.
we can code cond at step as well as at job statement.if any
of the steps with in job issue a return code that satisfy
the cond code at job stmt. then the system bypass the
remaining steps and terminate the job.
===
Region-specify the limit of the real or virtual storage
allocated for any of the job steps.
if you specify region parameter at job stmt then it
override the specified region parameter at each job steps
with in the job.
===
Time-it specify the total cpu time all the job steps in a
job use.
if you specify time at job level then it implies to entire
job.if you specify at step level it implies only to the
particular step.
16) waht is inspect verb? where it can be in real time?
Inspect is use to count the occurrences of a character in a
string & replace the char or sub-string in a string.....ect..
In real time if u do any mistake in entering data like
account no....524000200 rather then 542000200
by using Inspect U can achieve it easily ......
18) if we display var1 then what will b displayed in below
condition.
77 var1 pic s9(2) value -10.
77 var1 pic s9(2) value -11.
" " " -12.
" " " -13.
-14
...
...
-19.
a) It will give Compilation error as the variable is not
uniquely defined
u r wrt but if we declare diff var for above values then result will b like
value result
-10 1{
-11 1J
-12 1K
-13 1L
19) what is use of linkage section? 2)what is difference between comp and comp-3
a) 1) Linkage section is used to accept data from outside the program.either its parm part of Jcl or Call from any other programs,they pass data into called program thru linkage section only.
2)Comp is binary.its the type how system stores ur data.
pic s9(1)-->pics9(4) --occupies 2bytes
pic s9(5)---pic s9(8) ----4 bytes
pic s9(9)---pics9(18)-----8 bytes
comp-3 is for packed decimal data where each character occupies half byte and sign is stored in last nibble.
20)_ Re: if a pic 9(3) value 354,b pic x(2) value '46' then a)a>b 2)a<b 3)error
Answer
IBM Cobol will do an alphanumeric comparison because one of
the fields is PICTURE X. "354" will be compared to "45" and
be found to be lower. Answer b) is correct.
21) How to define a array dynamically.....
A)Use the Occurs Depending on clause.
01 College-table
05 Student-table occurs 10 to 20 times depending on
NUM_Stud.
Here the size of array is dependent on Number of students.
Thus this is dynamically created.
22) WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH
Answer
# 2 First thing is we can see this kind of differece only in VB
files not in fixed block files.
LRECL of VB file will contain the maximum record length of
a file + 4 bytes RDW(Record Descriptor Word) field which
gives the length of the record as the file contains
variable record lengths.
Example : if we have EMP-FILE VB file which contains 80
THRU 100 CHARECTERS
So the LRECL of this file is going to be 100+4 which is 104
bytes.
23) an anybody give me example of subscript and index
A)index is no of occurance we can find data exactly
subscript is displacement mainli its is used in arrays to
load the data
(or)
In IBM Cobol there are two methods of accessing elements in
a table (array). By subscript, which you explicitly define
in the Data Division or by index, which is implicitly
defined by the compiler.
01 subscript-for-table COMP PIC S9(4).
If you want the 20th item, set the above to 20 and use
field-looked-for (subscript-for-table).
An index is the displacement of an item from the start of a
table. For a subscript, the displacement, which is needed
to find the item, is calculated at run time (from the
subscript and the length of the data item(s)). So an index
is faster, but is generally considered more complex to use.
Some features, like SEARCH ALL, require the use of an INDEX.
24) How to increase the logical record length of existing PS
file?
I think there is one way to do this. Simply copy the
existing PS to another file(give '/' beside the PS and Give
option 17(copy)) It will ask for DSname(give any).
you will get 2 options as below
1. Allocate using same attributes
2. specify your own attributes
select '2' option from the above and change the LRECL as
you need.
now delete the actual file and rename the copied file to
original that's it. your requirement has been met:)
or)
this is possible through the utility IEBGENER.
//sysut1 dd DSN= <input datsset>
//sysut2 dd dsn =<output dataset>
dcb=(lrecl,100,blksize=1000)
.....
//
25) How to resolve the soc4 and soc7 errors?
A) Soc4 can resolved using mispleed dd name and dd name is not
matching with file
and soc7 check the sysdump and copy the offest address then
correct it in the program.
Or) soc-4 Storage violation error
soc-7 Invalid data in numeric field
or)
You have to look at the dump and note down the offset
address.Then check the instruction with this offset address
in the program compilation output.
Or
If you are blessed with having debugging tools then life is
a lot easier.Debug the program , the execution will stop at
the abending instruction.The advantage is that you can skip
through the statement with changing values and see if there
are any other abends in the program apart from this.Usually
very useful for resolving multiple S0C7 abends at one go!
If i'm wrong..ppl are welcome to correct me!
26) How to read the last 100 records from a COBOL file. The file contains N number of records.
Answer
# 2 let consider,
First declear 2 count variables A,B.
first count all the records i.e. N and put it into A
varialbe.
compute statement B=A-100, i.e. B=N-100
now again use the read-para untill condition B=A
and in read para incrased the value of B=B+1 after each
read.
Or)
How to read the last 100 records from a COBOL file. The file contains N number of records.
Answer
# 8 PROCEDURE DIVISION.
PARA.
OPEN INPUT STUDFILE.
PERFORM PARA1 UNTIL EOF = 1.
DISPLAY 'TOTAL NO:OF RECORDS ' A.
COMPUTE B = A - 100.
MOVE 0 TO EOF.
CLOSE STUDFILE.
OPEN INPUT STUDFILE.
PERFORM PARA2 UNTIL EOF = 1.
CLOSE STUDFILE.
STOP RUN.
PARA1.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE A = A + 1.
PARA2.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE C = C + 1.
IF C >= B AND EOF NOT = 1
DISPLAY STUD-REC.
If anybody doesn't understand this logic i can explain..
In PARA2 the file is read from the beginning and the moment
the value of C reaches the value of B i.e value of C = B
and then it will satisfy the condition IF C >= B and from
there it will start displaying the records till end.
27 ) what is the difference between the variable length and fixed lenght.how it varies in the cobol.
Answer # 1)
vareable length record is the record contain different
format(length) but the first 4 bytes taking length of record.
the fixed length record must be declaring length otherwise
throw the error.so after fill the records md fields fillup
th e filler clause.
Or) if we didnt mention length then it is variable length,if we
declare the size then it is fixed length
In JCL:
We have to code acutual lentgh + 4 Bytes for Variable
length files.For fixed length files we have to code actual
length.
in COBOL:
In FD Section we have to write
Recording Mode is F --> for Fixed length files,
Recording Mode is V --> for Variablelength files
28) How do you code Cobol to access a parameter that has been defined in JCL?
Answer# 1)
Ff it is SYSIN input in JCL,
ACCEPT <VARIABLE> FROM SYSIN
If it parameter is give through PARM, then COBOL program
should recieve through LINKAGE SECTION
or) Re: How do you code Cobol to access a parameter that has been defined in JCL?
Answer # 2
environemnt division
file1 assign to ddname
file2 assign to ddname
for this in JCL //DDNAME DD DSN.......
LINKAGE SECTION
01 LN-LEN PIC S9(4) COMP.
01 X PIC X
01 Y PIC X
IN JCL THROUGH PARM (MAX 1 TO 100 CHAR)
procedure division.
ACCEPT X
ACCEPT Y.
IN JCL THROUGH SYSIN DD*
pls correct me if anything wrong
HARISH POOMGAME SHIVAPPA(hassan,karnataka)
NIIT TECHNOLOGY
KOLKATA
Re: How do you code Cobol to access a parameter that has been defined in JCL?
Answer
# 1 Ff it is SYSIN input in JCL,
ACCEPT <VARIABLE> FROM SYSIN
If it parameter is give through PARM, then COBOL program
should recieve through LINKAGE SECTION
Re: How do you code Cobol to access a parameter that has been defined in JCL?
Answer
# 2 environemnt division
file1 assign to ddname
file2 assign to ddname
for this in JCL //DDNAME DD DSN.......
LINKAGE SECTION
01 LN-LEN PIC S9(4) COMP.
01 X PIC X
01 Y PIC X
IN JCL THROUGH PARM (MAX 1 TO 100 CHAR)
procedure division.
ACCEPT X
ACCEPT Y.
IN JCL THROUGH SYSIN DD*
29) Re: what is sort? whis is internal & external sort ?when do u go for inter sort & external sort? tell about some sort utilites?
Answer
# 1 Sort is a utility using which we can sort a VSAM/ NON-VSAM
file in a perticuler order i.e Assending or Discendin.
Internal Sort - It is a process to sort the file using JCL
External Sort - It is a process to sort the file using
cobol program .
Sort Utilites
sort INREC " select the fields then sort then"
sort OUTREC " sort the fields then select the records out
of them
Include " include a perticuler record
omit " except the perticuler record"
Sum fields = NONE to elemintae duplicate records
sort fields = (start postion , number of characters , type,
order )
30) What are the situations u have used in ur project for
Subcript and Index ?
1.if u use Subscript why not Index,why u choose Subscript
only?
2.if u use Index why not Subscript,what abt Displacement?
SUBSCRIPT: No. of occurences of a table is called Subscript.
INDEX: The disposition of the element.
Index can be used in Table data searching and Sorting but
Subscript won't be useful for the above.
Subscript reperesents as a occurence no. it must be
converted to displacement value each time its used so.. it
is less efficent than index.
Or) ---subcript is a occurence of arry element
---index is a displacement no of an array element
subcript is declared as a variable in wss but index declared
using index by clause
No comments:
Post a Comment