i need a program by giving input as a abcd in any randem order
but i need a output as 1234 related to abcd. i.e,. a for
1,b=2,c.....etc..

Answers were Sorted based on User's Feedback



i need a program by giving input as a abcd in any randem order but i need a output as 1234 related..

Answer / parvatraj m bhuti

first we have to initialize the letters a=1,b=2,....
like that z=26..

then we have to read the variable v pic x(4)( which may be
abcd or any other) from input

Then we have to un string the variable v into 4 other
variables as a1,a2,a3,a4.

then
compute x1= (a1*10)+a2;
compute x2= (x1*10)+a3;
compute x3= (x2*10)=a4;

Then display ('answer is = ", x3);
That will be the answer.

Is This Answer Correct ?    2 Yes 0 No

i need a program by giving input as a abcd in any randem order but i need a output as 1234 related..

Answer / kamaldeep

We can use:
INSPECT ws-var1 CONVERTING 'ABCD' TO '1234'.
this will replace a with 1, b with 2, c with 3 & d with 4

Is This Answer Correct ?    2 Yes 0 No

i need a program by giving input as a abcd in any randem order but i need a output as 1234 related..

Answer / prasad bhavanasi

through EVALUATE WE CAN GET THE output wt asked the q.


if a=1,b=2,o=15,z=26...etc if u want fulfil this kind of
requirment thru only EVALUATE ONLY.....In interviews this
type questions asks only for ur thinking...thats it...no
need to think very deep...all the best

Is This Answer Correct ?    2 Yes 1 No

i need a program by giving input as a abcd in any randem order but i need a output as 1234 related..

Answer / prasad

i need a program by giving input as a abcd in any randem order
but i need a output as 1234 related to abcd. i.e,. a for


ex a=1,b=2,c=3 like this
or

c=3c<b,b<a.

Is This Answer Correct ?    0 Yes 2 No

i need a program by giving input as a abcd in any randem order but i need a output as 1234 related..

Answer / krishnan

EVALATE ABCD
WGEN 'ABCD'
DISPLAY '1234'
WHEN 'BCDA'
DISPLAY '1234'
Like that we will try i this is not a proper method but
they need only the output is 1234 means we try this also

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More COBOL Interview Questions

In EBCDIC, how would the number 1234 be stored?

2 Answers   TCS,


what is the coding difference between COBOL and CICS.

8 Answers   Cap Gemini,


study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10

4 Answers   TCS,


What is the difference between write & move in COBOL?

3 Answers   CSC, HHB,


SSRange is used to do a range check on which of the Following. SUBSCRIPT,INDEX,REFERENCE MODIFICATION,Run-time option.

3 Answers   Lehman Brothers,






how to remove leading spaces and zeroes in a cobol variable.is there any easy way to do it

2 Answers  


When we code these comp,comp1,comp-2,comp-3 and comp4 values. I know the differnece.I mean when we will prefer if it is new program.Explain in detail with memory examples. Thanks in advance.

1 Answers   CTS,


If we use GO BACK instead of STOP RUN in cobol?

1 Answers   Temenos,


Why do we use COMP-3 variables for computation, when we know that they are non displayable fields and require additional MOVE to numeric field before we populate it in output Reports?

1 Answers   Accenture,


Name the sections present in data division.

0 Answers  


what is mainframe? what is the mainframe software ? what is use in s/w field?

7 Answers   CSE,


Can anyone explain me CALL procedure in COBOL.Does it carries similarities like call by reference in C.

1 Answers  


Categories