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
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 |
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 |
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 |
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 |
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 |
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
What is the difference between index and subscript?
What are subroutines ? and how do we pass data to the sub routines?
how many bytes does s9(15) occupy in comp1 comp2 and comp3 ?
I have PS flat file with 14 records. I want to read from 4th to 9th record and want to write those 6 records (4th record to 9th record) to another PS file (output file). there is no key defined in the input file. I just want read a certain Consecutive records. can any one please give me the procedure division Coding for this. I have coded the below coding but the READ-PARA is performing only 1 time even though I have 14 records in my input file (i.e FILE-1): PROCEDURE DIVISION. A000-SECTION. MOVE 0 TO I. OPEN INPUT FILE-1. IF CHECK-KEY1 > 0 DISPLAY "OPEN ERROR FOR FILE-1, CODE IS:" CHECK-KEY1 END-IF. OPEN EXTEND NEWFILE-1 IF CHECK-KEY3 > 0 DISPLAY "OPEN ERROR FOR NEWFILE-1 COD IS" CHECK-KEY3 END-IF. PERFORM READ-PARA THRU EXIT-PARA UNTIL EOF-REC = 'YES'. DISPLAY " FINALLY OUT OF LOOP" CLOSE FILE-1 CLOSE NEWFILE-1 STOP RUN. READ-PARA. ADD 1 TO I READ FILE-1 AT END MOVE 'YES' TO EOF-REC IF I > 3 AND < 10 PERFORM WRITE-PARA ELSE DISPLAY "NOT IN RANGE" END-IF. EXIT-PARA. EXIT. WRITE-PARA. WRITE NEW-REC FROM FILE1-REC.
what is subscript in cobol?give realtime example?
hi friends,can any one post the ibm mainframe inteqview questions for 1year exp candidate,for itc infotech interview?. have any body attended for this in the past?...
Hai friends why we need to read a file before re-write a record?
BY seeing a program how can we say that it is static call or dynamic call
Can printer files (having 133 characters) be of variable length?
when iam reading a flat file which has 100 records through cobol program when iam reading 50th records it gets abends .. so when i run the program again it should read from 50th record .where it got abened ? how it is possible
) How do u handle errors in BMS macro?