In Line Perform ques

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
nareshv_99
Member
Posts: 25
Joined: Sun Feb 05, 2012 10:59 pm
Location: Bangalore

In Line Perform ques

Post by nareshv_99 » Mon Feb 06, 2012 9:25 pm

i was asked the below que in CSC interview

01 WS-VAR PIC X(1) VALUE 0.


in procedure division

PERFORM WS-VAR 1 BY 1 UNTIL WS-VAR >= 10
DISPLAY "HELLO"
END-PERFORM.

you know the question rt.. how many times HELLO will be displayed in spool ?

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon Feb 06, 2012 10:07 pm

well,
why don't we start off with you telling us how a PIC X(1) can ever be GE 10?
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

nareshv_99
Member
Posts: 25
Joined: Sun Feb 05, 2012 10:59 pm
Location: Bangalore

Post by nareshv_99 » Tue Feb 07, 2012 8:43 am

answer it dude..
interviewer will confuse you.. ;)

tamilselvan.sampath
Member
Posts: 26
Joined: Mon Jan 23, 2012 11:17 pm

Post by tamilselvan.sampath » Thu Feb 09, 2012 7:50 pm

it will goes to infinite loop......

nareshv_99
Member
Posts: 25
Joined: Sun Feb 05, 2012 10:59 pm
Location: Bangalore

Post by nareshv_99 » Thu Feb 09, 2012 10:10 pm

yep.. i was asked this question thru telephone.. so i didn't pay attention to the pic clause of var..

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Feb 10, 2012 3:36 pm

nareshv_99 wrote:yep.. i was asked this question thru telephone.. so i didn't pay attention to the pic clause of var..
But the picture clause will make a difference and it won't be an infinite loop then if the variable in question is of PIC X(2).
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others