View previous topic :: View next topic |
Author |
Message |
ST Beginner
Joined: 04 Jan 2003 Posts: 24 Topics: 12
|
Posted: Mon Jan 06, 2003 10:46 am Post subject: Few Questions in COBOL |
|
|
Hi,
Can anyone let me know answers to the following
1) How we can check palindrome in Cobol ex: string 'AKA' in other way is also 'AKA'
2) Upcase and lowercase of a string ex:abc to be converted as ABC and vise versa
3) Reverse a string say ex: 1234 is to be converted as 4321? is it thru Reverse video?
4) File status for 'open' problem in a SEQ file is it 90 or 92?
5)How can we find out no. of records in a PS file where when we don't have access to it even Browse?
Thanks in adv
ST |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Jan 06, 2003 11:31 am Post subject: |
|
|
ST,
1. Code: |
WORKING-STORAGE SECTION.
01 MY-STRING PIC X(3) VALUE 'AKA'.
01 REV-STRING PIC X(3).
PROCEDURE DIVISION.
MOVE FUNCTION REVERSE(MY-STRING) TO REV-STRING
IF MY-STRING = REV-STRING
DISPLAY 'THE GIVEN STRING IS A PALINDROME'
ELSE
DISPLAY 'THE GIVEN STRING IS NOT A PALINDROME'
END-IF
GOBACK.
|
2.Converting to uppercase or lowercase (UPPER-CASE, LOWER-CASE)
3.Converting to reverse order (REVERSE)
4.For sequential files the open error is 05 and for vsam files it is 35.
5.You cannot find the no: of records if you don't have access to browse the file.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
ST Beginner
Joined: 04 Jan 2003 Posts: 24 Topics: 12
|
Posted: Mon Jan 06, 2003 1:06 pm Post subject: |
|
|
Kolusu,
Thanks a lot.....
But cant we find out the no. of records by using SORT, sortin and sortout will display the no. of records..doesn't it..?
ST |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Jan 06, 2003 1:18 pm Post subject: |
|
|
ST,
There are so many ways to find the no: of records in a file.check this link for various ways to find the no: of records in a file.
Counting no: of records in a file
But if you don't have access to browse the dataset, then none of solutions listed in the above link will work.All the batch jobs will abend with S913 with a reason code 38.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
niks_jude Beginner
Joined: 23 Nov 2006 Posts: 8 Topics: 2
|
Posted: Mon Dec 04, 2006 5:08 am Post subject: |
|
|
The palindroome check would work only when the string completely occupies the variable field.
Eg.Won't work for this.
01 str pic x(10) value "rar ".
rev-str = " rar" |
|
Back to top |
|
 |
|
|