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

Can anyone tell me how to handle the array beyond the limit. If we have an array or a table which can handle 5000 records but now we have to compensate 20000 records with the same array? how to handle the situation.

2 Answers  


Identify the invalid dataname from the following: (A) savings-account (B) annual-allocation-for-overhead (C) samount250 (D) 12demand

4 Answers   TCS,


how to display the dataset information?

2 Answers  


i have a variable block which is used in my cobol program as input file having records of 4080 after compilation while runing the program im getiing file attribut mismatch and it is saying tht the record length of the file is 4084 can any one knw the answer how to reslove it ?

2 Answers  


How can you pass values from COBOL program to non-COBOL programs?

2 Answers  






Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?

6 Answers   ABC, IBM, Mphasis, Wipro,


How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

0 Answers   HeadStrong,


IDENTIFICATION DIVISION. PROGRAM-ID. MOVEPGM. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-I PIC 9(2). PROCEDURE DIVISION. A1000-MAIN-PARA. PERFORM PARA-X WITH TEST BEFORE UNTIL WS-I= 5 STOP RUN. PARA-X. DISPLAY "BEST2". I m getting error s722,while executing the program, seems getting in loop, can anybody tell me why

3 Answers  


Write a program to enter and display the names of students in a class using the occurs clause.

0 Answers  


Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY AB BY B GIVING C Which of the following is true ? (a) The execution of the above may result in size error. (b) The execution of the above will result in size error. (c) The definition of C is invalid resulting in compilation error. (d) No error will be thee and the program would proceed correctly.

4 Answers   TCS,


01 text-data pic x(100). move 'xyzdbfrjjg u' to text-data. how to find the value of last index of text-data?

3 Answers   Mind Tree,


What is the difference between working storage copybook and linkage section copybook?

5 Answers   TCS,


Categories