i want a program using by if, evaluate , string, unstring,
perform, occurs?

Answers were Sorted based on User's Feedback



i want a program using by if, evaluate , string, unstring, perform, occurs?..

Answer / raghunath

refer to www.mainframegurukul.com for the answer

Is This Answer Correct ?    1 Yes 1 No

i want a program using by if, evaluate , string, unstring, perform, occurs?..

Answer / Sarika Srivastava

COBOL does not have built-in functions called 'evaluate', 'unstring', or 'occurs'. However, you can achieve similar functionality using other COBOL constructs. Here's a simple example of using IF, PERFORM, and STRING:nn```COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE-PROGRAM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-NAME PIC X(50) VALUE ''.
01 WS-INPUT PIC X(80).
PROCEDURE DIVISION.
DISPLAY 'Enter a string: '.
ACCEPT WS-INPUT.
MOVE WS-INPUT TO WS-NAME.
IF LENGTH(WS-NAME) > 10 THEN
DISPLAY 'The provided string has more than 10 characters.'
GO TO PROGRAM-END.
ELSE
DISPLAY 'The provided string is less than or equal to 10 characters.'
END-IF.
PERFORM VARYING WS-INDEX FROM 1 BY 1 UNTIL WS-INDEX > LENGTH(WS-NAME)
MOVE SUBSTRING(WS-NAME FROM WS-INDEX BY 1) TO WS-INPUT.
IF WS-INPUT = 'A' THEN
DISPLAY 'The string contains the letter A.'
END-IF.
END-PERFORM.
PROGRAM-END.
STOP RUN.
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

What is the difference between performing a SECTION and a PARAGRAPH?

5 Answers   Accenture, Patni,


What is the maximum length of a field you can define using COMP-3 in COBOL?

1 Answers   UGC Corporation,


Why is it necessary that file needs to be opened in I-O mode for REWRITE?

1 Answers  


01 x pic s9(8) comp. How will the following value be internally allocated '18787'

4 Answers   Steria,


I want ALL jcl ERROR cods

1 Answers  


WHAT IS SOC3?HOW IT CAN BE RESOLVED?

1 Answers  


hi is there any means of deletin a record from a ps usin cobol not using jcl?eg if i am reading a record and if some condition is matched tat particular record must be deletd fom the ps

5 Answers   iNautix,


Hi , I am posting some questons which are asked at interview. These may help u for ur interview... what is static and dynamic call?

2 Answers   TCS,


How can we find out wether to declare the data items like Integer, Char,Comp? If comp types how can we decide wether it is Comp and Comp3.How it is? Please Explain... Cheers.

1 Answers   Syntel,


Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.

2 Answers   RBS,


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1 Answers  


Can the OCCURS clause be at the 01 level?

2 Answers  


Categories