Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
richie

New User

Joined: 11 Jun 2005
Posts: 24

 Posted: Thu Jun 16, 2005 5:21 pm    Post subject: COBOL Interview Questions Hi, Please let me know the answers and explanations of the following 3 questions: a)The smallest negative dollar amount with a dollar in the output that can be edited Through the picture string -\$\$\$\$ is 1) ?1000 2) ?9999 3) ?999 4) ?100 b)The DATA DIVISION Entries are 01 REC-1. 02 A PIC 9(4)V99 VALUE 4567.50 02 B PIC 99V9 VALUE 45.2. 01 REC-2. 02 C PIC ZZZ9.99 02 D PIC 99.99. What will be the content in REC2 after the execution of MOVE REC-1 TO REC-2. c)IF NOT AGE LESS THAN 30 AND 40 GO TO PARA-AGE-MIDDLES. The controls will go to the paragraph named PARA-AGE- MIDDLE. (a) if AGE is greater than or equal to 40. (b) If AGE is greater than or equal to 30. (c) If AGE is greater than or equal to 30 but less than 40 (d) If AGE is less than or equal to 30. Thanks

priyesh.agrawal

Senior Member

Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

 Posted: Thu Jun 16, 2005 6:12 pm    Post subject: Re: COBOL Interview Questions a) First 4) ?100 b) Second 456750452 c) Third (a) if AGE is greater than or equal to 40.
vrexy

New User

Joined: 19 May 2005
Posts: 7
Location: bangalore

 Posted: Thu Jun 23, 2005 2:27 pm    Post subject: which is smallest?? Hi, which one z smallest?? -1 or -2 ???? I thought -9999 z right answer for first query. cheers, rexy.
donevin

New User

Joined: 07 Jun 2005
Posts: 70
Location: South Africa

 Posted: Fri Jul 15, 2005 2:45 pm    Post subject: Re: COBOL Interview Questions There is more to the second question than meets the eye. First, remember you are moving a 9 character alphanumeric field (REC-1) to a 12 character alphanumeric field (REC-2). Therefore REC-2 will be 456750452 followed by three spaces. This is because in REC-1 the decimal point is implied and doesn't take up any space, whereas in REC-2 the decimal points are seen as characters in the alphanumeric item REC-2. So, the 2 decimal points plus the two field sizes gives us a total of 12 characters and since the receiving field is alphanumeric and bigger than the sending field the data in the receiving field is padded on the right hand side with spaces. But even before this, for the code to compile there must be a full stop after the value of field A.
gsnvsr

New User

Joined: 06 Jul 2005
Posts: 40

 Posted: Fri Jul 15, 2005 5:40 pm    Post subject: Re: COBOL Interview Questions For the first question, I believe -9999 is the correct answer.. Best regards, prasad

New User

Joined: 05 Jun 2005
Posts: 41