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

i have a requrement in A as viswa!@#$%&^**reddy i need to move viswareddy in B without junk values pls say how to do ths reply fast

4 Answers   L&T,


Give some advantages of REDEFINES clause?

2 Answers   Syntel,


Can we move SPACES to numeric field and ZEROES to alphabetic field? If yes what are the way doing this?

6 Answers   T systems,


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

2 Answers   TCS, Wipro,


What is the local-storage section?

0 Answers  






What are the differences between COBOL and COBOL II?

1 Answers   CSC,


77 I pic 99 value 5 Perorm para-A I times. Para -A. move 10 to I. How many times the para-A will be executed.?

9 Answers   TCS,


how we can edit records in vsam data set and non vsam data sets

2 Answers   ACS,


what is the difference between Plan & package

3 Answers   IBM,


i need a small 3d program using inline and outline.

0 Answers  


How to use the same cobol program in Batch and CICS onlines ? Please expalin with an example. Thanks in advance.

1 Answers  


Explain what you understand by passing by value.

0 Answers  


Categories