Will the variable POS in the following code have a value of
2 or not?

01 POS PIC S9(4) COMP VALUE 2.
01 FIRST-NAME PIC X(10) VALUE 'ABC'.
01 LAST-NAME PIC X(10) VALUE 'XYZ'.
01 NAME PIC X(20) VALUE SPACES.

STRING FIRST-NAME DELIMITED BY SPACES
' ' DELIMITED BY SIZE
LAST-NAME DELIMITED BY SPACES
INTO NAME
WITH POINTER POS

Answers were Sorted based on User's Feedback



Will the variable POS in the following code have a value of 2 or not? 01 POS PIC S9(4) COMP VAL..

Answer / shobhit garg

No, It wont have value 2. rather value of POS will be 9.

Pointer specifies the number of non blank characters moved
to the receiveing string ( in our case its NAME).

So FIRST-NAME will return 3 bytes then a space then LAST-
NAME will return 3 bytes means overall 7 bytes.

Since our POS varibale starts from 2 , so overall count for
POS will be 2 + 7 = 9

Is This Answer Correct ?    7 Yes 0 No

Will the variable POS in the following code have a value of 2 or not? 01 POS PIC S9(4) COMP VAL..

Answer / jyoti prakash

total no in pos field is 9 byte

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

HOW WE WILL SORT THE ARRAY WHICH IS GOING TO USE FOR SEARCH ALL?

2 Answers   Cap Gemini,


How to Write the RESTART Logic Using COBOL?

4 Answers   GalaxE, L&T, Syntel, TCS,


What is report-item?

1 Answers   IBM,


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

0 Answers  


How you can characterize tables in cobol?

0 Answers  






Where the Plan is located in CICS-DB2

2 Answers   IBM,


What is the meaning of 'TALLING' verb in cobol?

5 Answers  


What was removed from COBOL in the COBOL II implementation?

0 Answers  


Hi, My interviewer ask A calls B and C calls B, a and b are static c and b are dynamic.what happens if they compile and execute at same time.

3 Answers   iGate,


Difference between next and continue clause

4 Answers   Kanbay,


I want ALL jcl ERROR cods

1 Answers  


Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 Answers  


Categories