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 can we code index in an array of cobol pgm?

1 Answers   Wipro,


What is SQL Code -904 and -903 in DB2 And how to handle it?

1 Answers   IBM,


here is my compile and link edit steps in a jcl //COMPILE1 JOB (3CUS,S),'CCDM TEST' //STEPNAME EXEC PGM=IGYCRCTL,PARM='DYNAM,RENT,LIB,OBJECT, // OFFSET,APOST,OPTIMIZE',REGION=4096K //STEPLIB DD DSNAME=PM7351.TEST2.COB,DISP=SHR //SYSIN DD DSNAME=PM7351.TEST2.COB(PGM1),DISP=SHR //SYSUT1 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT2 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT3 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT4 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT5 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT6 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT7 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSPRINT DD SYSOUT=* //SYSLIN DD DSNAME=&&LOAD,DISP=(MOD,PASS),UNIT=SYSDA, // SPACE=(10,(10,10)),DCB=BLKSIZE=400 //LKED EXEC PGM=IEWL,REGION=1024K //SYSPRINT DD SYSOUT=A //SYSLIB DD DSN=PM7351.TEST2.LOADLIB,DISP=SHR // DD DSN=PM7351.TEST2.COB(PGM1),DISP=SHR //SYSLMOD DD DSN=PM7351.TEST2.LOADLIB, // DISP=SHR //SYSUT1 DD UNIT=SYSDA,DCB=BLKSIZE=1024,SPACE=(CYL,(1,1)) //SYSTERM DD SYSOUT=* //SYSLIN DD DSN=&&LOAD,DISP=(OLD,DELETE) //SYSIN DD DUMMY i am getting IEW2013I 0F08 NO MEMBER NAME WAS SPECIFIED. MODULE WAS SAVED USING TEMPNAM1. could any one tell me the resolution for this..?

1 Answers  


Determine the total no of bytes in the following. 01 rec1. 02 a pic x(6) 02 b redefines a. 03 c occus 6 times pic 9. 02 d occurs 6 times pic 9. 03 e pic x(5) 03 f pic 999.

12 Answers  


can i use multiple when statements in search & search all ? justify ur answer?

2 Answers  






What is the use of LINKAGE SECTION?

1 Answers  


is this below syntax correct? CALL 'subprg' using A,B Please help

2 Answers  


How do u sort the table for Search ALL? Is it only using ASCENDING KEY IS statement in occurs clause? If the data is input in non ascending order, will the ASC KEY IS automatically sort the data? or will it throw compile time error?

1 Answers   CTS,


01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?

7 Answers  


In which area will you utilize 88 level items in cobol?

0 Answers  


wht r the advantages of 77 level number ?

8 Answers   TCS,


How can you get the ksds file records into your cobol program?

0 Answers  


Categories