dimpy


{ City } bangalore
< Country > india
* Profession *
User No # 119646
Total Questions Posted # 36
Total Answers Posted # 41

Total Answers Posted for My Questions # 27
Total Views for My Questions # 54104

Users Marked my Answers as Correct # 11
Users Marked my Answers as Wrong # 3
Answers / { dimpy }

Question { Atos Origin, 11120 }

How 10 Digits are stored in Packed Decimal?


Answer

Correct me if I am wrong
here value should be 6
as 1 space will be taken for sign(+/-)
and every byte will take 2 digit
10 digit + 1 sign = 11
hence 6*2 = 12
hence value should be 6.

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 12680 }

what is the result of the following?

DIVIDE A INTO B GIVING C.

a.C=A/B
b.the reminder of B/A is stored in C
c.C=B/A
d.the reminder of A/B is stored in C


Answer

c. B/A

Is This Answer Correct ?    0 Yes 0 No


Question { TCS, 7495 }

which of the following can be used as a check protection symbol
a.Z
b.S
c.*
d.+


Answer

* A check protect symbol--a leading numeric character position into which an asterisk is placed when that position contains a zero. Each asterisk (*) is counted in the size of the item.

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 6683 }

study the following code
01 A1
05 B PIC 99
05 C PIC X(4)
01 A2
05 B PIC 99V99
05 C PIC A(4)
pick out the valid statement from the following
a.A1 and A2 can not have sub-ordinates
b.A1 and A2 can have the same sub-ordinates but must have
same PIC clause
c.there is nothing wrong
d.A1 and A2 can have same sub-ordinates provided they are
not at 01 level


Answer

c.there is nothing wrong
WORKING-STORAGE SECTION.
01 A1.
05 B PIC 99.
05 C PIC X(4).
01 A2.
05 B PIC 99V99.
05 C PIC A(4).
PROCEDURE DIVISION.
DISPLAY 'HELLO'.
STOP RUN.

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 7776 }

study the following
01 A PIC 99V0 VALUE 5
01 B PIC 9V9 VALUE 6
01 C PIC 99V9 VALUE 2.5
01 D PIC 99 VALUE 3
COMPUTE A ROUNDED B C = A+B*C/D
ON SIZE ERROR PERFORM PRINT-ERROR
the comments of A.B.C after execution of the above
statement are
a.A=10 B=0 C=10
b.A=10 B=9.9 C=9.9
c.A=10 B=0 C=9.9
d.A=10 B=6 C=10


Answer

10A
6 B
10C

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 5584 }

consider the following two IF statements:
IF X AND NOT Y MOVE A TO B
IF Z=1 OR 9 MOVE A TO B
select one of the following data divusion entries which
gives identical
results for both the above IF statements
a.01 Z PIC 9
88 X VALUE 1.9
88 Y VALUE 0.2 THRU 8
b.01 Z PIC 9
88 X VALUE 0.2 THRU 8
Y VALUE 1.9
c.01 Z PIC 9
88 X VALUE 1.9
88 NOT-Y VALUE 0.2 THRU 1.9
d.none of yhe above


Answer

there should not be any PIC clause defination on 01 level
01 Z PIC 9

Is This Answer Correct ?    0 Yes 0 No

Question { IBM, 67724 }

How to read records from flat file in reverse order through
COBOL program?


Answer

1. Using FileAid

//STEP0100 EXEC PGM=FILEAID

//SYSPRINT DD SYSOUT=*

//DD01 DD DSN=YOUR INPUT DATASET,DISP=SHR

//DD01O DD DSN=YOUR OUTPUT FILE IN REVERSE ORDER,

// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,

// SPACE=(CYL,(X,Y),RLSE)

//SYSIN DD *

$$DD01 COPYBACK

/*

Is This Answer Correct ?    1 Yes 0 No

Question { IBM, 67724 }

How to read records from flat file in reverse order through
COBOL program?


Answer

//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT DATASET,DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE IN REVERSE ORDER,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,D)
OUTREC FIELDS=(1,80)
/*

Is This Answer Correct ?    4 Yes 0 No

Question { IBM, 67724 }

How to read records from flat file in reverse order through
COBOL program?


Answer

When REVERSED is specified, OPEN statement execution positions the QSAM file at its end. Subsequent READ statements make the data records available in reversed order, starting with the last record


Open INPUT filename REVERSED

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 16479 }

How to define variable 9(20) in COBOL, because compiler
does not allow us to declare variables with Pic 9(18). Can
anyone please let me know the answer... I know one answer
to this question which is to use Compiler option Arith
(Extend) during Compilation. It extends the maximum limit
to 9(32)..Just wanted to know if there is any other way to
extend this?


Answer

try with this:

01 VARIABLE-ABC.
03 VAR-1 PIC 9(18).
03 VAR-2 PIC 9(2).




or
use PROCESS ARITH(EXTEND) before IDENTIFICATION DIVISION

ARITH option syntax

.-COMPAT-.
>>-ARITH(-+-EXTEND-+-)-----------------------------------------><


When you specify ARITH(EXTEND):
The maximum number of digit positions that you can specify in the PICTURE clause for packed-decimal, external-decimal, and numeric-edited data items is raised from 18 to 31.

Is This Answer Correct ?    0 Yes 0 No

Question { IBM, 5867 }

Consider the below example

call a-test1.
--
--
--
a-test1.
if a=b
perform a-test through a-exit
next sentence
else
if b=c
perform c-test through c-exit.
if a=d
perform d-test through d-exit.
a-test.
--
--
a-exit.
exit.

can u tell me what will happen if a=b
after looping into a-exit will the control go back to a-
test1.

will the condition a=d be checked???


Answer

Compilation Error.
both NEXT SENTENCE and CONTINUE place holder.
above situation NEXT SENTENCE will give compilation error
CONTINUE will not generate compilation error

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 9455 }

01 A pic 9(100) find record length of it


Answer

----TRY
Compilation error ---
IGYDS1145-S More than 18 digit positions were specified in a "PICTURE
"PICTURE" string of "S9(18)" was assumed.

run error ----
03.21.40 JOB33062 £HASP165 SIQAGHB ENDED AT OSPART - ABENDED S706 U0000 CN(INT
ERNAL)
***

Is This Answer Correct ?    2 Yes 1 No

Question { TCS, 12193 }

ID DIVISION.
PROGRAM-ID. PLO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 VAR1 PIC 9(2).
01 VAR2 PIC X(2).
PROCEDURE DIVISION.
ACCEPT VAR2.
MOVE VAR2 TO VAR1.
STOP RUN.

if i give 'PI' in var2 then what will b output of progr.
any abend?????


Answer

No abend
but unpredictable result

WORKING-STORAGE SECTION.
01 VAR1 PIC 9(2).
01 VAR2 PIC X(2).
PROCEDURE DIVISION.
ACCEPT VAR2.
MOVE VAR2 TO VAR1.
DISPLAY VAR1.
DISPLAY VAR2.
STOP RUN.


//STEP02 EXEC PGM=COB7
//STEPLIB DD DSN=DEA.SIQAGH.LOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
PI
/*



output
P9
PI

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 10941 }

have in 100 records in a flat file i want to move records
like 1,3,5,7,9,11,.. to Output file1 and
2,4,6,8,10,12,14 .. records moved to Output file2..Pls
Provide real time answer..


Answer

FILE-CONTROL.
SELECT INP ASSIGN TO INF
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INP
RECORDING MODE IS F.
01 INP-REC.
10 STUDENT-ID PIC 9(3).
10 STUDENT-NAME PIC X(20).
FILE-CONTROL.
SELECT INP ASSIGN TO INF
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INP
RECORDING MODE IS F.
01 INP-REC.
10 STUDENT-ID PIC 9(3).
10 STUDENT-NAME PIC X(20).
WORKING-STORAGE SECTION.
01 C PIC 99 VALUE ZEROS.
01 D PIC 99V99 VALUE ZEROS.
01 E PIC 99.99.
01 I PIC 99 VALUE ZEROS.
01 WS-INP-REC.
10 WS-STUDENT-ID PIC 9(3).
10 WS-STUDENT-NAME PIC X(20).
05 EOF PIC X VALUE 'N'.
01 PRINT-CHAR PIC X(20).
PROCEDURE DIVISION.
OPEN INPUT INP.
READ INP INTO WS-INP-REC.
PERFORM UNTIL EOF = 'Y'
ADD 1 TO I
DISPLAY I
DIVIDE 2 INTO I GIVING C REMAINDER D
MOVE D TO E
DISPLAY E
IF (D IS ZERO)THEN
DISPLAY WS-STUDENT-NAME
END-IF
READ INP INTO WS-INP-REC AT END MOVE 'Y' TO EOF
END-READ
END-PERFORM.
CLOSE INP.
GOBACK.

output :
01
01.00
02
00.00
BRPITA
03
01.00
04
00.00
DRPITA
05
01.00
06
00.00
FRPITA

input :
000001 070 ARPITA
000002 080 BRPITA
000003 090 CRPITA
000004 100 DRPITA
000005 110 ERPITA
000006 120 FRPITA

Is This Answer Correct ?    0 Yes 1 No

Question { 1553 }

How to read records in reverse order in flat file?


Answer

I know we can do it by reading all records into an array....
Then read records in reverse order by using subscript or index
but can any body give me the exact code.

--read the record in index and access it backward using index or subscript

Is This Answer Correct ?    0 Yes 0 No

 [1]   2   3    Next