i want a program using by if, evaluate , string, unstring,
perform, occurs?
Answers were Sorted based on User's Feedback
Answer / raghunath
refer to www.mainframegurukul.com for the answer
| Is This Answer Correct ? | 1 Yes | 1 No |
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 |
What is the difference between performing a SECTION and a PARAGRAPH?
What is the maximum length of a field you can define using COMP-3 in COBOL?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
01 x pic s9(8) comp. How will the following value be internally allocated '18787'
I want ALL jcl ERROR cods
WHAT IS SOC3?HOW IT CAN BE RESOLVED?
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
Hi , I am posting some questons which are asked at interview. These may help u for ur interview... what is static and dynamic call?
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.
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.
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
Can the OCCURS clause be at the 01 level?