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

what is the minimum number of lines a Cobol program should have to successfully compile and run

11 Answers   ABC, Societe Generale,


Define cobol?

0 Answers  


The order of precedence of arithmetic operators in an expression can be overridden with the use of (a) [] (b) () (c) {} (d) Any of the above

3 Answers   TCS,


what is amode(24), amode(31), rmode(24) and rmode(any)?

0 Answers  


I have files that contains both duplicates files(occur more than twice) and non-duplicate files.The file is already sorted by a key.I want to determine those records that are duplicate and will be move to a duplicate file and non- duplicate files to be move to a valid file.thank you.help please

2 Answers  


What are the different rules to perform a Search?

0 Answers  


i have a sequencial file contains multiple records, i want to extract one row which contains various fields like order number,date,warehouse,.ect.. in to the another file by accepting the order number from jcl. how can i do it. pls help me..

4 Answers   CGI,


which is better either static call or dynamic call? and why?

5 Answers   HCL,


EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?

0 Answers   Accenture,


What are different data types in cobol?

0 Answers  


In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?

1 Answers   CSC,


what is a zoned decimal data type and how it will be stored?

2 Answers   IBM,


Categories